A DIY IPMI / IP KVM system utilizing the Raspberry Pi

  • By Ben Curtis
  • Last update: Dec 17, 2022
  • Comments: 15

A DIY IPMI / IP KVM system utilizing the Raspberry Pi

A web-accessable IPMI / IP KVM system that provides full keyboard control, monitor view, and and the ability to reboot computers with standard motherboards remotely as if you were sitting in front of them with a keyboard and monitor.



A full wishlist totaling under $120 at the time of this writing can be found at http://a.co/36FK9T8

Before assembling

On the Pi3, flash http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-09-08/. As of this writing you may use the latest Stretch version, however this was the version used successfully.

On the Pi0, flash http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-03-03/. You must use this version for this to work. There aren't really security implications since the Pi0 can only be accessed from a serial session on the Pi3.

Before putting the SD into the Pi0, add this to the end of /boot/config.txt:


Before putting the SD into the Pi3, create a blank file called SSH on the boot drive to enable SSH.

Also, if you will be connecting via Wifi, create a file in boot called wpa_supplicant.conf that uses unix based line feeds. To ensure that is the case, use Notepad++ or another editor that allows you to change line feed types (bottom right), or copy the config.txt file and rename it. Include the following:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev


Setting up the hardware

Here is a diagram of how you connect all of the pieces:


View the high resolution version

The detailed process is to:

Quick Install

The quick method of installation is to simply run the install script on the Pi3 as the pi user:

wget https://raw.githubusercontent.com/Fmstrat/diy-ipmi/master/install.sh
chmod +x install.sh

Everything will be done on the Pi3 and Pi0 automatically with the video input defaulting to s-video.

If you would like to manage multiple servers with one IPMI system, please see the Managing multiple servers section below.

Be sure to check the bottom of this README for Tips and Troubleshooting!

The long way

If you would like to do things step by step to understand how things work, the following instructions can be used.

Setting up the Pi 3

First, let's get all the software we need:

sudo apt-get update
sudo apt-get -y install libav-tools screen lighttpd php php-cgi git
cd /opt
sudo git clone https://github.com/Fmstrat/diy-ipmi
sudo chown pi diy-ipmi -R
chmod +x /opt/diy-ipmi/Pi3/*.py
chmod +x /opt/diy-ipmi/Pi3/*.sh

To test the ability to reboot the computer via the relay board, run:


Test this script to see if it resets the computer. If you are interested, look in the python script to see the numbers associated with which of the 8 relays you could use for multiple computers.

Next, set up the HTTP server.

read -s -p "Password for web IPMI console (user 'ipmi'): " IPMIPASS
echo ""
echo "ipmi:${IPMIPASS}" | sudo tee --append /var/www/ipmipasswd

sudo lighty-enable-mod fastcgi-php
echo '' | sudo tee --append /etc/lighttpd/lighttpd.conf
sudo adduser www-data gpio
echo 'server.modules += ( "mod_auth" )' | sudo tee --append /etc/lighttpd/lighttpd.conf
echo 'auth.debug = 2' | sudo tee --append /etc/lighttpd/lighttpd.conf
echo 'auth.backend = "plain"' | sudo tee --append /etc/lighttpd/lighttpd.conf
echo 'auth.backend.plain.userfile = "/var/www/ipmipasswd"' | sudo tee --append /etc/lighttpd/lighttpd.conf
echo 'auth.require = ( "/" =>' | sudo tee --append /etc/lighttpd/lighttpd.conf
echo '        (' | sudo tee --append /etc/lighttpd/lighttpd.conf
echo '                "method" => "basic",' | sudo tee --append /etc/lighttpd/lighttpd.conf
echo '                "realm" => "Password protected area",' | sudo tee --append /etc/lighttpd/lighttpd.conf
echo '                "require" => "user=ipmi"' | sudo tee --append /etc/lighttpd/lighttpd.conf
echo '        )' | sudo tee --append /etc/lighttpd/lighttpd.conf
echo ')' | sudo tee --append /etc/lighttpd/lighttpd.conf

cd /var/www/
sudo mv /var/www/html /var/www/html.orig
sudo ln -s /opt/diy-ipmi/Pi3/html /var/www/html

echo '[Server 1]' | sudo tee --append /etc/ipmi.conf
echo 'TTY=/dev/ttyUSB0' | sudo tee --append /etc/ipmi.conf
echo 'VID=/dev/video0' | sudo tee --append /etc/ipmi.conf
echo 'INP=1' | sudo tee --append /etc/ipmi.conf
echo 'PIN=2' | sudo tee --append /etc/ipmi.conf

sudo service lighttpd force-reload
sudo systemctl restart lighttpd
sudo systemctl enable lighttpd

Lastly, get everything running right by completing some tasks and updating /etc/rc.local to ensure they happen at boot:

sudo chmod a+rw /dev/video0
sudo mkdir -p /mnt/ramdisk
sudo mount -t tmpfs -o size=3m tmps /mnt/ramdisk
sudo chown www-data /mnt/ramdisk
sudo v4l2-ctl -d /dev/video0 --set-input=1
sudo chmod a+rw /dev/ttyUSB0

sudo sed -i 's/exit 0//g' /etc/rc.local
echo "chmod a+rw /dev/video0" | sudo tee --append /etc/rc.local
echo "mkdir -p /mnt/ramdisk" | sudo tee --append /etc/rc.local
echo "mount -t tmpfs -o size=3m tmps /mnt/ramdisk" | sudo tee --append /etc/rc.local
echo "chown www-data /mnt/ramdisk" | sudo tee --append /etc/rc.local
echo "v4l2-ctl -d /dev/video0 --set-input=1" | sudo tee --append /etc/rc.local
echo "chmod a+rw /dev/ttyUSB0" | sudo tee --append /etc/rc.local
echo "exit 0" | sudo tee --append /etc/rc.local

Setting up the Pi 0

Make sure you can access the Pi0 from the Pi3 by running:

screen /dev/ttyUSB0 115200

Press enter until you see a login prompt. Do not login. Instead, exit the session by hitting Control-A then typing :quit and pressing enter.

On the Pi3, run:


echo "sudo systemctl enable [email protected]" >> /dev/ttyUSB0
echo "sudo cp /lib/systemd/system/[email protected] /etc/systemd/system/[email protected]" >> /dev/ttyUSB0
echo "sudo sed -i 's/agetty --keep-baud 115200/agetty -a pi --keep-baud 115200/g' /etc/systemd/system/[email protected]" >> /dev/ttyUSB0
echo "sudo systemctl daemon-reload" >> /dev/ttyUSB0

echo "sudo systemctl disable networking" >> /dev/ttyUSB0
echo "sudo apt-get -y remove dhcpcd5 isc-dhcp-client isc-dhcp-common" >> /dev/ttyUSB0
sleep 60

echo "rm -f /tmp/B64" >> /dev/ttyUSB0
for LINE in $(base64 /opt/diy-ipmi/Pi0/enableHID.sh); do echo "echo $LINE >> /tmp/B64" >> /dev/ttyUSB0; done
echo "base64 -d /tmp/B64 > /home/pi/enableHID.sh" >> /dev/ttyUSB0
echo "chmod +x /home/pi/enableHID.sh" >> /dev/ttyUSB0

echo "rm -f /tmp/B64" >> /dev/ttyUSB0
for LINE in $(base64 /opt/diy-ipmi/Pi0/sendkeys.c); do echo "echo $LINE >> /tmp/B64" >> /dev/ttyUSB0; done
echo "base64 -d /tmp/B64 > /home/pi/sendkeys.c" >> /dev/ttyUSB0
echo "gcc -o /home/pi/sendkeys /home/pi/sendkeys.c" >> /dev/ttyUSB0

sudo apt-get -y install libusb-dev
cd /opt/diy-ipmi/Pi0/
gcc -o hub-ctrl hub-ctrl.c -lusb
for LINE in $(base64 hub-ctrl); do echo "echo $LINE >> /tmp/B64" >> /dev/ttyUSB0; done
echo "base64 -d /tmp/B64 > /home/pi/hub-ctrl" >> /dev/ttyUSB0
echo "chmod +x /home/pi/hub-ctrl" >> /dev/ttyUSB0
cd -

echo "sudo /home/pi/enableHID.sh" >> /dev/ttyUSB0
echo "sudo sed -i 's/exit 0//g' /etc/rc.local" >> /dev/ttyUSB0
echo "echo /home/pi/enableHID.sh | sudo tee --append /etc/rc.local" >> /dev/ttyUSB0
echo "echo exit 0 | sudo tee --append /etc/rc.local" >> /dev/ttyUSB0

Access the IPMI

You should now be able to access the IPMI console at http://<RaspberryPi3IP>/. From here you can set up SSL and port forwarding to the device as your situation requires.

Managing multiple servers

Multiple servers can be managed by using multile USB capture devices (one per server), multiple USB-to-Serial adapters each with their own Pi0 (one per server), and using one of the 8 relays on the relay board as the reset button. Once installed, edit /etc/ipmi.conf. The format should be:

[My first server]

[My second server]
  • When hooking up multiple TV tuners and USB-to-Serial devices to Pi0s, it is recommended to use a powered USB hub.
  • The INP field is 1 for s-video or 0 for composite. You can actually use one capture device for two servers by using both inputs.
  • The PIN value is the pin on the relay board. The valid values are 2, 3, 4, 17, 27, 22, 10, 9.


If you're using this on a Linux headless machine that's not running X11, it's easier to read the console if things are nice and big. Disabling the video driver is an easy way to accomplish this as it will just default to a generic NTSC or PAL signal. For instance, with an nVidia card, you could follow these directoins: https://askubuntu.com/questions/481414/install-nvidia-driver-instead-of-nouveau

To enable SSL, you need a combined PEM file which can be created by:

cat myserver.key mycert.crt myca.ca-bundle > mypem.pem

Then add this into the /etc/lighttpd/lighttpd.conf file (editing as required):

$SERVER["socket"] == ":443" {
	ssl.engine = "enable"
	ssl.pemfile = "/opt/certs/mypem.pem"
	server.name = "host.domain.com"
	server.document-root = "/var/www/html"
	ssl.use-sslv2 = "disable"
	ssl.use-sslv3 = "disable"
	ssl.use-compression = "disable"
	ssl.honor-cipher-order = "enable"
	server.errorlog = "/var/log/lighttpd/serror.log"
	accesslog.filename = "/var/log/lighttpd/saccess.log"


If you're not getting video, here are some troubleshooting methods:

First make sure the INP field in /etc/ipmi.conf is set to the right input. Input 0 is usually Composite, and Input 1 is usually S-Video.

Connect a source and test to see if it's working.

apt-get install mencoder
mencoder tv:// -tv driver=v4l2:norm=NTSC:device=/dev/video0:input=1:fps=5 -nosound -ovc copy -o test.avi
v4l2-ctl -d /dev/video0 --set-input=1
avconv -f video4linux2 -i /dev/video0 -vframes 1 -s 720x480 test.jpg

Control-C that, and sftp the files to a host for viewing and playback:

sftp test.avi [email protected]:/folder/test.avi
sftp test.avi [email protected]:/folder/test.jpg

You can test keyboard control from the Pi0 with commands like:

/home/pi/sendkeys /dev/hidg0 keyboard

You will need to type things like "a" and press ENTER to send the "a." Other ways to send keys include things like:

echo 'a' | /home/pi/sendkeys /dev/hidg0 keyboard
echo 'return' | /home/pi/sendkeys /dev/hidg0 keyboard
echo 'shift a' | /home/pi/sendkeys /dev/hidg0 keyboard
echo 'left-meta space' | /home/pi/sendkeys /dev/hidg0 keyboard

To reset the keyboard controller run this on the Pi3:


If you get wierd USB errors, make sure your power brick is strong enough and that you're not trying to power the HDMI to S-Video converter via the Pi3.




  • 1

    Can't access Pi0 via Serial

    You can get the details of my issue here:


    I do get a blank screen via screen /dev/ttyUSB0 115200 but no matter how many times I press enter, a blank screen is all I see. Not sure if it is a driver related issue or what but I can't seem to figure it out.

    Do I need to be passing a parameter?:

    Name:   dwc2
    Info:   Selects the dwc2 USB controller driver
    Load:   dtoverlay=dwc2,<param>=<val>
    Params: dr_mode                 Dual role mode: "host", "peripheral" or "otg"
            g-rx-fifo-size          Size of rx fifo size in gadget mode
            g-np-tx-fifo-size       Size of non-periodic tx fifo size in gadget
            g-tx-fifo-size          Size of periodic tx fifo per endpoint
                                    (except ep0) in gadget mode
  • 2

    hdmi capture device

    Why don't you use directly an hdmi capture device ? https://www.amazon.com/Video-Capture-Device-Windows-System-Including/dp/B075N7FDMN/ref=sr_1_8?s=electronics&ie=UTF8&qid=1511565304&sr=1-8&keywords=usb+video+capture+vga

  • 3

    Multiple Server Config Broke Frontend

    I've added a second Pi0 and configured it in my ipmi.conf thusly:


    My frontend now has a whole bunch of function names etc in the combo box for server selection: https://i.imgur.com/HNYJKoB.png And Video output stopped working. In Chromium dev-tools I see the following error: https://i.imgur.com/FukTolm.png Do I somehow need to format the ipmi.conf differently so the server settings get a CR between them?

  • 4

    What are the hard dependencies on Raspbian for the Pi3?

    In your install guide you state the versions of OS to install on each device, and that a newer version of Raspbian Stretch will probably work on the Pi3 - what are the dependencies here for the Pi3, (and also the Pi0, out of curiosity?),

  • 5

    Cannot connect to webserver

    Hi All,

    The install seems to have gone well, but I cannot access the web site, seemingly due to a problem with lighttpd.

    A screen grab of systemctl status lighttpd.service:


    Can you please help me proceed/troubleshoot?

    Thanks! Justin

  • 6

    No reboot needed - can i skip the relay board?


    Similar to others on here, I am looking at this for remote support for users who are present, so am not worried about remote reboot. Does this mean i can leave the relay board out completely, and therefore the GPIO pins and cables?

    Thanks for a great project! Justin

  • 7

    Keyboard input not working - possible compilation problem with hub-ctrl?

    I'm getting no keyboard commands to my target machine. I can successfully attach to the Pi0 via screen from the Pi3, but issuing sendkeys commands just hang there, If I run hub-ctrl with no arguments on the Pi0 I get this output:

    [email protected]:~$ ./hub-ctrl
    ./hub-ctrl: line 1: /bin: Is a directory
    ./hub-ctrl: line 15: struct: command not found
    ./hub-ctrl: line 16: const: command not found
    ./hub-ctrl: line 17: unsigned: command not found
    ./hub-ctrl: line 18: syntax error near unexpected token `}'
    ./hub-ctrl: line 18: `};'

    Whereas running hub-ctrl on the Pi3 gives this output:

    [email protected]:/opt/diy-ipmi/Pi0 $ ./hub-ctrl
    Hub #0 at 001:000
     INFO: ganged switching.
     WARN: Port indicators are NOT supported.
    Hub #1 at 001:000
     INFO: ganged switching.
     WARN: Port indicators are NOT supported.

    Perhaps a compilation issue? I'll try compiling it on a Pi0 instead, and see if that helps.

  • 8

    HTTP Server not working

    After running install.sh script, the HTTP server does not work and I am unable to connect to the RPi3. I can connect to services on other ports though. Firewall is disabled.

  • 9

    [Suggestion] Add IPMI API Endpoints?

    Mentioned in #17 and something I've been considering for a while and casually researched. Adding some IPMI endpoints and bindings so external software can automate control of the systems being power managed. Possibly a big job!

  • 10

    Upload better resolution hardware setup picture

    I can’t seem to see some of the info I think I need from the the hardware setup picture. Would be appreciated if a higher-res picture could be uploaded, thanks!

  • 11

    Suppor tfor generic HDMI capturers from Aliexpress?

    These: https://www.aliexpress.com/item/1005001880861192.html?spm=a2g0o.productlist.0.0.58ec3289KNoVSz&algo_pvid=f3f3dbfc-0b0b-4e68-81d3-b050fec5c931&algo_exp_id=f3f3dbfc-0b0b-4e68-81d3-b050fec5c931-1&pdp_ext_f=%7B%22sku_id%22%3A%2212000018002094767%22%7D work with Linux.

    Is there a way to support them?

    Also, this looks like something intended for controlling servers, so no mouse support. Is there a way to get mouse + keyboard, and instead of the web view, use VNC?

    Or is there another project that focus on this?

  • 12

    Diagram has incorrect wire to relay

    No idea if this repo is still active but it's a cool project and I bought the parts and am building out a newer version with a current version of Raspbian. I did use the suggested relay and found that to get the power to work it was actually slots one and two on the relay:


  • 13

    try to turn inputstick into KVM over IP


    I suggest to add a very interesting feature for the inputstick

    inputstick reminder



    with a small evolution of functionalities, we can use the inputstick to carry out a KVM over IP

    indeed, for the image return, all you need is an hdmi / vga encoder which broadcasts in IP stream, https://bit.ly/2XE0n8s

    however for ease of use with the inputstick, the ideal would be to be able to use a physical mouse and keyboard, several possibilities:

    • solution 1: the "USB REMOTE" software must therefore be able to send the signals from a mouse and a keyboard connected to the smartphone (Bluetooth or wired), because currently the "USB REMOTE" software does not allow this

    • solution 2: or else the "USB REMOTE" software must be able to connect, via local IP, to a portable computer (windows), and the user therefore uses the keyboard and the mouse of his portable computer (windows) , then "USB REMOTE" collects by IP and transfers by bluetooth the signals for the inputstick

  • 14

    Use 12 $ Rullz Mini HDMI Video Capture Card for HDMI Input.


    I just saw this cheap device on Aliexpress: https://www.aliexpress.com/i/4000917852728.html

    And I wonder whether someone already tested this device on raspberry and for ipmi?

    It would cut short several hardware requirements and cut the price if we could just plug it into the raspberry for HDMI Input purposes.

  • 15

    KVM with only Pi Zero W


    I don't know if you are intending to update this but I am currently looking at getting this running on a single pi zero w. You can now get a CSI to HDMI adaptor so that everything can just run off 1 pi.

    I was wondering if you could help me get this working if you have some spare time.

    Kind Regards