pikvm / pikvm
- четверг, 30 июля 2020 г. в 00:22:02
Open and cheap DIY IP-KVM based on Raspberry Pi
Join the comunity chat for questions and support!
A very simple and fully functional Raspberry Pi-based IP-KVM that you can make with your own hands. This device helps to manage servers or workstations remotely, regardless of the health of the operating system or whether one is installed. You can fix any problem, configure the BIOS, or even reinstall the OS using the included CD-ROM or Flash Drive emulation.
make build
and installed to an SD-card using make install
. The hardware can be made in half an hour and without soldering.ipmitool
, ipmiutil
or any existing network infrastructure that supports IPMI to monitor and manage the server's power.This project is developed on a non-commercial basis by Open Source enthusiasts. If you find Pi-KVM useful or it has saved you a long trip to check on an unresponsive server, you can support the lead developer by donating a few dollars via Patreon or PayPal. With this money, he will be able to buy new hardware (Raspberry Pi boards and other components) to test and maintain various configurations of Pi-KVM, and generally devote significantly more time to the project. At the bottom of this page are the names of all the people who have helped this project develop with their donations. Our gratitude knows no bounds!
If you wish to use Pi-KVM in production, we accept orders to modify it for your needs or implement custom features you require. Contact us via live chat or email the lead developer at: mdevaev@gmail.com
Q: What is the status of this project?
A: Although this page is rarely updated, the project is actively maintained and developed. You can verify this by checking the activity in our other repositories.
Q: Does this support the HDMI-USB dongle from AliExpress?
A: Yes, and Pi-KVM works great with it. However, we recommend to use HDMI-CSI bridge because the USB dongle has several major disadvantages compared to it: USB gives a lot of latency (200ms vs 100ms) and it doesn't support stream compression control (you won't be able to use Pi-KVM in a place with a poor internet connection). It also cannot automatically detect screen resolution. All this is caused by the hardware limitations of the dongle itself. It may be used, but the loss of these features is probably not worth the ten dollars saved.
Q: Can I connect multiple servers to a single Pi-KVM?
A: Yes, but it will require additional work to set up. Pi-KVM can be connected to a multi-port HDMI/USB switch and the switch's buttons can be connected via optocouplers to the Pi's GPIO pins to switch channels. If your KVM switches channels using keyboard shortcuts, there is a chance that it will not be able to work with OTG (v2 platform, see bellow), since it does not fully implement the USB stack. In this case, you will have to use an Arduino board to emulate the keyboard & mouse. (Pi-KVM supports this configuration)
Q: Can I use Pi-KVM with non-Raspberry Pi boards?
A: Yes, but you will have to prepare the board OS yourself. As for the Pi-KVM software, you will need to replace the RPi.GPIO module and some files (such as UDEV rules). If you are a developer or an experienced system administrator, you will not have any problems with this. In addition, we are open to patches. If you need help with this, please contact us via Discord: https://discord.gg/bpmXfz5
Our future v3 platform will contain an optional HID module for such cases, so you won't have to build anything yourself.
Pi-KVM supports several different hardware configurations, referred to as platforms. At the moment, there are two main ones: v0 and v2.
It is recomended to buid v2 since it supports all features including the Mass Storage Drive feature. It's also the easiest to make.
We are also currently developing our own HAT for the Raspberry Pi 4. It will have all the features of the v2 platform, including:
Sounds interesting? Subscribe in this form or join to https://discord.gg/bpmXfz5 and we will let you know when you can purchase the board. Prototypes will be ready in Q4 2020, and pre-orders will be available sooner. If you are considering ordering a wholesale lot, please email to mdevaev@gmail.com.
Insert the flexible flat cable of the HDMI bridge into the narrow white connector on the Raspberry Pi (the closest one to big USB sockets). Use only the cable that was included with the device package, or make sure that the third-party cable has the correct pinout.
Connect USB dongle to exactly this port. It is bound in the software so the OS does not confuse the video device with something else.
Raspberry Pi 2 and 3 | Raspberry Pi 4 |
---|---|
![]() |
![]() |
Here is a diagram shows that how to connect all of the pieces (click to full size).
Raspberry Pi 4 note: since one USB-C female connector is used to receive power and perform keyboard/mouse/drive emulation a special Y-cable must be made that splits the DATA and POWER lines of USB-C (see reasons). It can be made from two suitable connecting cables, or soldered together from scratch. Be sure to check the circuit diagram below, otherwise you may damage your devices. The appropriate USB pinout(s) can easily be found on Google. Please note that if you make a Y-cable from two no-name cables, the colors of the wires may not match those shown. Use a multimeter to make sure the connections are correct.
See video howtos:
Also check out this small PCB for ATX (if you know how to make PCBs): https://easyeda.com/mark.gilbert/zerow-kvm-v1
The Pi-KVM OS is based on Arch Linux ARM and contains all the required packages and configs for it to work. To build the OS you will need any Linux machine with a recent version of Docker (>= 1:19) with privileged mode enabled. (used for fdisk and some other commands, have a look through our Makefiles if you don't trust us :) )
When starting with a clean OS (Like Ubuntu 18) you need to install and configure docker (after adding your user to the docker group you must log out and log back in), as well as git and make.
[user@localhost ~]$ sudo apt-get install git make curl binutils -y
[user@localhost ~]$ curl -fsSL https://get.docker.com -o get-docker.sh
[user@localhost ~]$ sudo sh get-docker.sh
[user@localhost ~]$ sudo usermod -aG docker $USER
Re-login to apply the changes.
Git checkout the build toolchain:
[user@localhost ~]$ git clone https://github.com/pikvm/os
[user@localhost ~]$ cd os
Determine the target hardware configuration (platform):
BOARD=rpi4
for Raspberry Pi 4 or BOARD=zerow
, BOARD=rpi2
, BOARD=rpi3
for other options.PLATFORM=v2-hdmi
for RPi4 or ZeroW with HDMI-CSI bridge.PLATFORM=v0-hdmi
for RPi 2 or 3 with HDMI-CSI bridge and Arduino HID.PLATFORM=v2-hdmiusb
for RPi4 with HDMI-USB dongle.PLATFORM=v0-hdmiusb
for RPi 2 or 3 with HDMI-USB dongle and Arduino HID.Create the config file config.mk
for the target system. You must specify the path to the SD card on your local computer (this will be used to format and install the system) and the version of your Raspberry Pi and platform. You can change other parameters as you wish. Please note: if your password contains the # character, you must escape it using a backslash like ROOT_PASSWD = pass\#word
.
[user@localhost os]$ cat config.mk
# rpi3 for Raspberry Pi 3; rpi2 for the version 2, zerow for ZeroW
BOARD = rpi4
# Hardware configuration
PLATFORM = v2-hdmi
# Target hostname
HOSTNAME = pikvm
# ru_RU, etc. UTF-8 only
LOCALE = en_US
# See /usr/share/zoneinfo
TIMEZONE = Europe/Moscow
# For SSH root user
ROOT_PASSWD = root
# Web UI credentials: user=admin, password=<this>
WEBUI_ADMIN_PASSWD = admin
# IPMI credentials: user=admin, password=<this>
IPMI_ADMIN_PASSWD = admin
# SD card device
CARD = /dev/mmcblk0
If you want to configure wifi (for ZeroW board for example) you must add these lines to config.mk
:
WIFI_ESSID = "my-network"
WIFI_PASSWD = "P@$$word"
Build the OS. It may take about one hour depending on your Internet connection:
[user@localhost os]$ make os
Put SD card into card reader and install OS (you should disable automounting beforehand: systemctl stop udisk2
or something like that):
[user@localhost os]$ make install
After installation remove the SD card and insert it into your RPi. Turn on the power. The RPi will try to get an IP address using DHCP on your LAN. It will then be available via SSH.
If you can't find the device's address, try using the following command:
[user@localhost os]$ make scan
Only for v0. Now you need to flash the Arduino. This can be done using your RPi. Before starting this operation, disconnect the RESET wire from the Arduino board, otherwise the firmware will not be uploaded. Connect the Arduino and RPi with a suitable USB cable. Log in to the RPi and upload the firmware. Then connect the RESET wire, disconnect the USB cable, and reboot the RPi.
[user@localhost os]$ ssh root@<addr>
[root@pikvm ~]# rw
[root@pikvm ~]# systemctl stop kvmd
[root@pikvm ~]# cp -r /usr/share/kvmd/hid ~
[root@pikvm ~]# cd ~/hid
[root@pikvm hid]# make
[root@pikvm hid]# make install
[root@pikvm hid]# reboot
Congratulations! Your Pi-KVM will be available via SSH (ssh root@<addr>
) and HTTPS (try to open it in a browser at https://<IP addr>
). For HTTPS a self-signed certificate is used by default.
The Pi-KVM file system is always mounted in read-only mode. This prevents it from being damaged by a sudden power outage. To change the configuration you must first switch the filesystem to write mode using the command rw
from root. After the changes, be sure to run the command ro
to switch it back to read-only.
NEVER edit /etc/kvmd/main.yaml
. Use /etc/kvmd/override.yaml
to redefine the system parameters. All other files that are also not recommended for editing have read-only permissions. If you edit any of these files, you will need to manually make changes to them when you upgrade your system. You can view the current configuration and all available KVMD parameters using the command kvmd -m
.
Almost all KVMD (the main daemon controlling Pi-KVM) configuration files use YAML syntax. Information on the format's syntax can be found at the link provided.
If you want to disable the web terminal use these commands:
[root@pikvm ~]# systemctl disable kvmd-webterm
[root@pikvm ~]# systemctl stop kvmd-webterm
To disable authorization completely edit the file /etc/kvmd/override.yaml
:
kvmd:
auth:
enabled: false
then restart kvmd
:
[root@pikvm ~]# systemctl restart kvmd
If you don't need ATX power control you can disable the relevant Web-UI menu in /etc/kvmd/override.yaml
:
kvmd:
atx:
type: disabled
then restart kvmd.
To use Wake-on-LAN with your server you must define some options such as the server's MAC address and (optionaly) IP address. Use /etc/kvmd/override.yaml
. The format is:
kvmd:
wol:
mac: ff:ff:ff:ff:ff:ff
Replace ff:ff:ff:ff:ff:ff
with the MAC of your server. By default, a packet is sent via a broadcast request to the entire IPv4 network (255.255.255.255
, port 9
), but you can address it to a specific static address:
kvmd:
wol:
mac: ff:ff:ff:ff:ff:ff
ip: 192.168.0.100
# port: 9 # By default
To use IPMI BMC you need to set up an appropriate account and run the kvmd-ipmi
daemon (systemctl start kvmd-ipmi
and systemctl enable kvmd-ipmi
). Although Pi-KVM supports the IPMI protocol, we strongly recommend that you do not use it outside of trusted networks due to the protocol's insecurity. Refer to the file /etc/kvmd/ipmipasswd
to configure IPMI account.
To use VNC you need to change the keyboard layout for non-US client keyboards using /etc/kvmd/override.yaml
. For example:
vnc:
keymap: /usr/share/kvmd/keymaps/ru
By default username and password authentication is used. This is not supported by all clients (we recommend TigerVNC). To enable passphrase authentication, you need to edit the file /etc/kvmd/vncpasswd
to set passphrases and enable this feature in /etc/kvmd/override.yaml
:
vnc:
auth:
vncauth:
enabled: true
After that you can enable the kvmd-vnc
daemon (systemctl start kvmd-vnc
and systemctl enable kvmd-vnc
). VNC will be available on port 5900 by default.
It is reccomended to disable the automatic quality adjust setting if there is one in your client (this is called "Auto-Select"in TigerVNC).
Please note: we strongly discourage the use of VNC on untrusted networks. The current implementation does not use encryption, and your passwords are transmitted over the network in a plain text. The existing anonymous TLS mode is also not secure enough.
To use Arduino HID with v2 platform:
rw
./etc/kvmd/override.yaml
(remove {}
in the file before):
kvmd:
hid:
type: serial
reset_pin: 4
device: /dev/kvmd-hid
/etc/udev/rules.d/99-kvmd.rules
:
KERNEL=="ttyAMA0", SYMLINK+="kvmd-hid"
systemctl disable getty@ttyGS0.service
.console=ttyAMA0,115200
and kgdboc=ttyAMA0,115200
from /boot/cmdline.txt
.reboot
.On step 8 (make install
), you may encounter the following error:
/root/.platformio/packages/tool-avrdude/avrdude: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
Create a symlink for this library:
[root@pikvm ~]# ln -s /usr/lib/libtinfo.so.6 /usr/lib/libtinfo.so.5
And run make install
again.
Unexpected interruption while loading the image for Mass Storage Drive
If problems occur when uploading even a small disk image it may be due to unstable network operation or antivirus software. It is well known that Kaspersky antivirus cuts off Pi-KVM connections during uploading, so you should add the Pi-KVM website to Kaspersky's list of exceptions or not filter web requests with the antivirus. Antivirus programs can also affect the performance of certain interface elements, for example the quality slider.
For Kaspersky, the steps to add the network address of Pi-KVM's website to the exclusion list is: Protection -> Private browsing -> Categories and exclusions -> Exclusions
Glitchy/Wrong BIOS resolution
On some motherboards, the BIOS may be displayed at a lower resolution, or with some rendering issues/glitches, specially on newer ASUS ones.
e.g
This can be solved by enabling the Compatibility Support Module (CSM) in your BIOS, usually under the Boot options.
If you can't or don't want to enable the CSM, you can try connecting a DisplayPort monitor, or a dummy plug. If you remove the DP cable/adapter the bug will reappear.
If none of this works, try connecting the DP cable first, boot into the BIOS, disable the CSM and shutdown (do not restart) your PC. Then, boot into the BIOS and enable the CSM before shutting down your PC. Then connect the HDMI and turn your PC on again.
If you have any problems or questions, contact us using Discord: https://discord.gg/bpmXfz5
These kind people donated money to the Pi-KVM project and supported work on it. We are very grateful for their help, and commemorating their names is the least we can do in return.