Void Linux with Btrfs subvolume

sankar vinayak
6 min readMar 17, 2023

--

Void Linux is a rolling release distro like archlinux but it is more focused on stability rather than bleeding edge so it can be considered as a middle ground between arch and point releases like fedora, ubuntu, Debian

Unlike archlinux, fedora and other popular distributions void does not use the system but it uses runit as the init system so managing processes are a bit different. Also, void linux provides both musl as well as the glib options

Like archlinux void provides a TUI installer but setting up btrfs subvolumes using that is something I didn’t manage to do. So this is an option.

Btrfs file system provides options like snapshot and rollback so it is best to create subvolumes under the main partition and use them rather than use it as is in other file systems like ext4.

I will be focusing on a UEFI x86_64 glib installation with @ and @home subvolumes under Btrfs with live iso.

Getting the installation medium

The live iso or tarball can be downloaded from the void-linux download page. It can be used to create a bootable medium using tools like etcher or by using the dd command. By booting into the void linux live you will be seeing the following or the xfce based on the iso you choose.

Void linux installer

Login

the username and password are root and voidlinux. You can start the tui installer by logging in and entering void-installer, but here I will be using the manual chroot install. Make sure you have an active internet connection. It can be achieved by using wpa_supplicant and dhcpcd

Start install

bash is available in the shell

Partitioning

For UEFI installation we need at least two partitions one for root (/) and one for efi boot (/boot/efi)

It can be created using fdisk or cfdisk. A GPT partition table first partition for efi less than 1GB of type EFI system and the rest linux system (or some for swap)

Create filesystem

The UEFI can make use of FAT32 and the Btrfs volume so it can be created by

mkfs.vfat /dev/sdXn
mkfs.btrfs /dev/sdXm

Creating subvolume

After creating the file system mount it and create subvolumes

mount /dev/sdXm /mnt
btrfs su cr /mnt/@
btrfs su cr /mnt/@home

now we have the subvolume we needed so we can unmount the partition using

umount /mnt

Mounting partitions and create root

We can mount the @subvolume as root and @homeinside it and for UEFI mount the other partition in /boot/efi

mount -o noatime,compress=lzo,space_cache=v2,subvol=@ /dev/sdXm /mnt 
mkdir /mnt/home
mount -o noatime,compress-lzo,space_cache_v2,subvol=@home /dev/sdXm /mnt/home
mkdir -p /mnt/boot/efi
mount /dev/sdXn /mnt/boot/efi

Install base system

Select a mirror based on your location and set the REPO variable and ARCH based on the system architecture

REPO=https://repo-default.voidlinux.org/current
ARCH=x86_64

Copy the keys

The RSA keys need to be copied to the new system so that xbps package manager can verify the packages it can be done by

mkdir -p /mnt/var/db/xbps/keys
cp /var/db/xbps/keys/* /mnt/var/db/xbps/keys/

The base system from the specified mirror with the architecture will be synchronized and installed to the mounted root by using

XBPS_ARCH=$ARCH xbps-install -S -r /mnt -R "$REPO" base-system

if everything is set right then xbps will start downloading packages to the specified location. wait till it is done.

Chroot

Now we have a base system ready in /mnt We can change our root to the newly installed system bash shell by

xchroot /mnt /bin/bash

you will see your prompt change as

entering chroot output

and check for update by

xbps-install -Su

Configuration

Hostname

Now we can set the host name either by editing the /etc/hostname file

for that install editor of choice by

xbps-install package-name

or by using echo

echo hostname>/etc/hostname

Timezone

You can set the timezone by

ln -s /usr/share/zoninfo/region/zone /etc/localtime

Locale

You can set locale by uncommenting the required locale in `/etc/default/libc-locales

locales

locales can be generated by

xbps-reconfigure -f glibc-locales

Other changes

Some more options are available in /etc/rc.conf

Users and password

Password of the root user can be done by using the command and confirming the password

passwd

Add user

New user other than root can be created by using the command

useradd username

to add them to groups use

usermod -aG group username

in order to use sudo the user needs to be in wheel group and it should be permitted by using visudo and uncommenting the corresonding line

set password of the user by using

passwd username

fstab

fstab help in mounting volumes during the boot

we can copy the current mount details to it by

cp /proc/mounts /etc/fstab

edit the file /etc/fstab we can delete all extra mounting details below the one we added like devtmpfs,devpts,cgouup...

change last column value to 1 (file system error corrected) for / and 2 (system should be rebooted) for others

add an entry for ram in the file as

tmpfs           /tmp        tmpfs   defaults,nosuid,nodev   0 0

Grub install

install the x86_64 efi version of grub and install it to the efi partition and name it as Void by using

xbps-install grub-x86_64-efi
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id="Void"

On successful installation you will see

grub-install output

Success

Now you have successfully intalled void linux with btrfs ubvolumes in a uefi system .

You can finallize the install by

xbps-reconfigure -fa

exit chroot,unmount and reboot by

exit
umount -R /mnt
shutdown -r now

Post install

You can now boot into the system you installed with your username and password

NetworkManager

NetworkManager is a tool help in netwok connection it can be enabled by

sudo ln -s /etc/sv/NetworkManager /var/service/

make sure other tools like dhcpcd are not enabled if yes disable or unlink it by

sudo unlink /var/services/dhcpcd

Enable repositories

There are non free and multilib repositories availabe which are not installed by default it can be installed by using

sudo xbps-install void-repo-nonfree void-repo-multilib void-repo-multilib-nonfree

sync the repositories by using

sudo xbps-install -Su

xmirror

xmirror is a tool which help in easily switching the servers

dbus

dbus is a system bus which allow different processes to communicate with one another. It can be installed and setup by

sudo xbps-install dbus
ln -s /etc/sv/dbus /var/service/dbus

reboot after creating the service

seatd

seatd is a session demon for graphical user interfaces

it can be installed and enabled by

xbps-install seatd
usermod -aG _seatd $USER
ln -s /etc/sv/seatd /var/service/

displaymanager

you can install display manager like gdm,sddm,lightdm.. to get a graphical display manager it can be set up as

sudo xbps-install displymanager-name
sudo ln -s /etc/sv/displaymanager-name /var/service/

display manager will be automatically start

General case

In general you can install package with xbps-install command and enable corresponding service if needed by creating symlink from /etc/sv/service-name to /var/service/

--

--