Requires PiKVM OS version 2022.06.20 or newer.
-
Install ZeroTier, then start and stop it to generate an identity
rw pacman -S zerotier-one systemctl enable --now zerotier-one.service systemctl stop zerotier-one.service
-
Copy the ZeroTier address
cat /var/lib/zerotier-one/identity.public | cut -d: -f 1
-
Add the new address to your ZeroTier network on my.zerotier.com (click your network, then Settings → Advanced → Manually Add Member → Node ID)
-
Move ZeroTier identity files from
/var/lib/zerotier-one
to persistent storagepst=/var/lib/kvmd/pst/data/zerotier-one kvmd-pstrun -- cp -a /var/lib/zerotier-one/{*.public,*.secret} $pst
-
Add a directory named
networks.d
and create an empty file named<network id>.conf
insideread -r -p "Enter your network ID: " NETWORK_ID kvmd-pstrun -- mkdir -p $pst/networks.d kvmd-pstrun -- touch $pst/networks.d/$NETWORK_ID.conf
If you need to set additional settings for your network (e.g. DNS), create another file named
<network id>.local.conf
in the same directory with your settings.:echo "allowDNS=1" >> $pst/networks.d/$NETWORK_ID.local.conf
-
Delete
/var/lib/zerotier-one
then add it to/etc/fstab
rm -r /var/lib/zerotier-one echo "tmpfs /var/lib/zerotier-one tmpfs mode=0755 0 0" >> /etc/fstab
-
Edit the
zerotier-one.service
to copy the persistent store and mount the in-memory volumesystemctl edit zerotier-one.zervice
[Unit] # Creates a systemd dependency for the tmpfs mount Requires=var-lib-zerotier\x2done.mount ConditionPathIsReadWrite=/var/lib/zerotier-one [Service] # Cleans zerotier-one runtime directory before start ExecStartPre=-/usr/bin/find /var/lib/zerotier-one -mindepth 1 -delete # Copies secrets and identities from persistent storage to runtime directory ExecStartPre=/usr/bin/cp -a /var/lib/kvmd/pst/data/zerotier-one /var/lib/
-
Make the system read-only again
ro
-
Start the ZeroTier service and verify your device is connected to your network
systemctl start zerotier-one.service zerotier-cli listnetworks
Running
systemctl status zerotier-one.service
you should see the newoverride.conf
steps and some successful logs:* zerotier-one.service - ZeroTier One Loaded: loaded (/etc/systemd/system/zerotier-one.service; enabled; preset: disabled) Drop-In: /etc/systemd/system/zerotier-one.service.d `-override.conf Active: active (running) since Tue 2024-03-26 13:31:41 EDT; 2min ago Process: 10378 ExecStartPre=/usr/bin/find /var/lib/zerotier-one -mindepth 1 -delete (code=exited, status=0/SUCCESS) Process: 10380 ExecStartPre=/usr/bin/cp -a /var/lib/kvmd/pst/data/zerotier-one /var/lib/ (code=exited, status=0/SUCCESS) Main PID: 10406 (zerotier-one) Tasks: 25 (limit: 4015) CPU: 5.119s CGroup: /system.slice/zerotier-one.service `-10406 /usr/bin/zerotier-one Mar 26 13:31:41 pikvm systemd[1]: Starting ZeroTier One... Mar 26 13:31:41 pikvm systemd[1]: Started ZeroTier One. Mar 26 13:31:41 pikvm zerotier-one[10406]: Starting Control Plane... Mar 26 13:31:41 pikvm zerotier-one[10406]: Starting V6 Control Plane...
-
Grab your ZeroTier IP, open it in your browser, and you should see PiKVM.
ip a | grep zt
Thank you for this document, it really helps a lot, but there are some mistakes need to be fixed.
Step 5:
Before this command, you need to create folder first using this command
kvmd-pstrun -- mkdir $pst
Step 6:
After the folder is removed, you need to create an empty folder so it can be mounted using command
mkdir /var/lib/zerotier-one
After making tmpfs, you need to use mount -a to make it take effect or zerotier service will fail
Step 7:
Typo, it should be zerotier-one.service