Ramblings of an aging IT geek
← Ramblings of an aging IT geek
hardware

KVM Over IP, Built From a Pi

A Raspberry Pi, an HDMI capture stick and a USB gadget cable turn into a remote keyboard, video and mouse for the headless boxes in the cupboard.

A soldering iron and small electronics on a bench

The thing that finally drove me to build this was a machine in the cupboard that would not boot, and a BIOS screen I could not see. I had a perfectly good remote shell on everything that was up, and absolutely nothing for the moment a box hangs before the OS even loads. That gap, the pre-boot, the kernel panic, the "press F1 to continue" that nobody is there to press, is exactly where a KVM over IP earns its keep. Commercial ones exist and are lovely and cost more than I wanted to spend on a cupboard.

So I built one out of a Pi. The PiKVM project has been doing this beautifully for years and I am late to it, but the parts list is genuinely small and the result is genuinely good.

What it actually is

The trick is that a KVM over IP needs to do two things the target machine cannot tell apart from real hardware. It has to see the video output, and it has to be a keyboard and mouse. The Pi does both with cheap bits.

For video, an HDMI capture device on USB grabs whatever the target is putting out, BIOS and all, because it is just reading the HDMI signal with no idea or care what is generating it. For input, the Pi 4 can pretend to be a USB HID gadget over its USB-C port, so the target sees a perfectly ordinary keyboard and mouse plugged in. The Pi serves all of this over a web page. You get the screen in your browser and your own keyboard drives the far machine.

A Raspberry Pi wired to a capture stick

The parts and the gotchas

My pile was a Pi 4, an HDMI to USB capture dongle of the cheap and ubiquitous variety, a USB-C cable for the gadget side, and a microSD card. The PiKVM OS image does the heavy lifting, and I flashed it rather than building from scratch because I wanted a KVM, not a project.

Two things tripped me up, so I will save you the time. First, the gadget USB-C port is the same port you would normally power the Pi from, so you need to power the Pi some other way, in my case over the GPIO header with a regulated supply. Get this wrong and you either get no data or you backfeed power into the target, neither of which you want. Second, the cheap capture sticks lie about what resolutions they support, and a few BIOS screens output something odd that the stick refuses. A second dongle from a different batch sorted it, which is the most homelab sentence I have written all year.

Once it was up, the payoff was immediate. I can now sit at my desk, open a tab, and watch a cupboard machine POST. I can mash the boot menu key. I can mount a virtual USB drive and reinstall an OS on a box I cannot physically reach without moving furniture. For something assembled from a Pi and two cheap dongles, it feels faintly magical, and it has already paid for itself the first time a box wedged itself on a Sunday and I fixed it without getting up.