Instructions on how to install Void Linux on a Raspberry Pi 3 Model B.
How‑To: Installing Void Linux on a Raspberry Pi
This is a short tutorial for how to install Void Linux on a Raspberry Pi 3 Model B.
I used the following:
- Raspberry Pi 3 Model B
- 16GB microSD card
Regarding the third and fourth items, we do want to get the Pi ready for SSH access as soon as possible but at the very beginning it’s great to have direct access to the machine.
If you have a different model of Raspberry Pi, these instructions might still work but bear in mind that your mileage may vary.
Step 1. Download a live image
Void Linux makes live images available for Raspberry Pi devices. I downloaded the glibc version because I’m afraid of trying new things but if you live life on the edge try the musl image and let me know if the rest of this guide worked for you!
Step 2. Install the live image
Use whatever tool you prefer to install the live image onto your SD card. I went with Etcher.
Step 3. Boot the Raspberry Pi
Install the SD card into your Pi and start it up. If all goes well, you should find yourself at a login prompt. At the time of writing, the live image has a
root user with password
Step 4. Resize root partition
The live image contains two partitions: a boot partition and the root partition. The bad news is that the root partition is only 2GB. The good news is that we can resize it from within Void.1 Normally, it’s not advisable to resize a partition while you’re using it, but since the root partition comes at the ‘end’ of the partition table, we can safely extend it into the remaining space without any issues.
We’ll resize with sdisk so let’s start it up. We need to pass
--force so that we can change a partition that’s in use:
# sfdisk -N 2 /dev/mmcblk0 --force
sfdisk will greet you with a scary warning. Fear not; we don’t have much to do. Next input the following in the sfdisk shell:
/dev/mmcblk0p2: - +
Is that it? What does it mean? Well, the
- tells sfdisk to leave the beginning of the partition where it is and the
+ tells it to fill the remaining space. After the command is received, sfdisk will show you the new partition table and ask if you want to write this to disk. Press
y to confirm.
Now to resize the file system:
# resize2fs /dev/mmcblk0p2
Reboot your system:
# reboot now
Confirm the changes are reflected in the partition table:
You should see the root partition fills up the remaining space.
Step 5. Get on WiFi
Three points to note up front:
- The next couple of steps draw heavily on Kevin Patel’s excellent guide. Thank you Kevin for writing this. I don’t think I would have got my setup working without it!
The default shell for the root user is Dash. It does not have the same niceties as Bash (particularly tab completion) and so while I’ve omitted the invocations to focus on the key aspects, I strongly recommend running
bashafter every reboot.
If you’re not using WiFi, feel free to skip this step.
We need to find out the name of our wireless device:
# ip link
Change to the following directory:
# cd /etc/wpa_supplicant
Make a copy of the default configuration:
# cp wpa_supplicant.conf wpa_supplicant-<device>.conf
Add the network details:
# wpa_passphrase <ssid> <key> >> wpa_supplicant-<device>.conf
Start the daemon:
# wpa_supplicant -B -i<device> -cwpa_supplicant-<device>.conf
Enable the dhcpd service:2
# ln -s /etc/sv/dhcpcd /var/service
Test the connection:
# ping voidlinux.org
Hopefully you’re seeing sweet responses. Enable the wpa_supplicant service:
# ln -s /etc/sv/wpa_supplicant /var/service
Step 6. Set up the system time
Unlike most computers, the Raspberry Pi does not have a battery-powered clock that it uses to ‘remember’ the current time when you shut it down. This can cause issues when updating packages so now that we have access to the Internet, let’s enable the system time daemon:
# ln -s /etc/sv/ntpd /var/service
# xbps-reconfigure -f chrony
Check if it works:
Step 7. Sync and update
Sync and update:
# xbps-install -Su
Run this again to make sure everything is up to date:
# xbps-install -Su
Step 8. Set up D-Bus
Enable the dbus daemon:
# ln -s /etc/sv/dbus /var/service
# reboot now
Step 9. Set up SSH
Enable the sshd daemon:
# ln -s /etc/sv/sshd /var/service
Find your IP address:
# ip addr
Try to SSH from another machine:
# ssh root@<ip-address>
Step 10. Create an ordinary user
Create a user and add it to some basic groups:3
# useradd -m -s /bin/bash -g users -G wheel,network,audio,video <username>
Change the password:
# passwd <username>
To give users in the wheel group the power to
sudo, first start
Then uncomment the following:
# %wheel ALL=(ALL) ALL
At this point, you should be able to SSH into the Pi as your new user.
At this point, you probably want to tweak your SSH configuration (
/etc/ssh/sshd_config) but I’ll leave that, and any other software you want to install up to you. Welcome to the Void! ✺
If you create your own image from the rootfs tarballs, you can choose a different size. I found this process intimidating and went with the simpler approach of resizing the root partition. ↩
One of the differences between Void Linux and most other Linux distributions is that it does not use systemd. The runit system that Void uses instead loads the entries that are in
/var/service. The common practice is to symlink services you want to ‘enable’ into this directory. ↩
Perhaps betraying its BSD heritage, Void Linux calls its admin group ‘wheel’ by default. ↩