This file was lingering on my computer for a few months. It is at the sime time similar and different to this previous post. Note that the format is mostly a list of instructions without long detailed explanations.

Basic Installation

Let's assume the following disk layout:

# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
vda    253:0    0    32G  0 disk
├─vda1 253:1    0   512M  0 part
├─vda2 253:2    0     1G  0 part
└─vda3 253:4    0  30.5G  0 part

We format as follows:

# mkfs.vfat -F32 /dev/vda1

# cryptsetup luksFormat --type luks1 /dev/vda2
# cryptsetup luksOpen /dev/vda2 cryptboot
# mkfs.ext4 /dev/mapper/cryptboot

# cryptsetup luksFormat --type luks2 /dev/vda3
# cryptsetup luksOpen /dev/vda3 cryptroot
# mkfs.btrfs /dev/mapper/cryptroot

Let's create the basic file system structure:

# mount /dev/mapper/cryptroot /mnt/
# btrfs subvolume create /mnt/@
# btrfs subvolume create /mnt/@home
# btrfs subvolume create /mnt/@log
# btrfs subvolume create /mnt/@cache
# btrfs subvolume create /mnt/@snapshots
# btrfs subvolume create /mnt/@vartmp
# btrfs subvolume create /mnt/@swap

# umount /mnt
# mount -o subvol=@,compress=zstd /dev/mapper/cryptroot /mnt/
# mkdir -p /mnt/{.snapshots,home,var/log,var/cache,var/tmp,var/swap}
# mount -o subvol=@home,compress=zstd /dev/mapper/cryptroot /mnt/home
# mount -o subvol=@log,compress=zstd /dev/mapper/cryptroot /mnt/var/log
# mount -o subvol=@cache,compress=zstd /dev/mapper/cryptroot /mnt/var/cache
# mount -o subvol=@snapshots,compress=zstd /dev/mapper/cryptroot /mnt/.snapshots
# mount -o subvol=@vartmp,compress=zstd /dev/mapper/cryptroot /mnt/var/tmp
# mount -o subvol=@swap,compress=none /dev/mapper/cryptroot /mnt/var/swap

# mkdir  /mnt/boot/
# mount /dev/mapper/cryptboot /mnt/boot/

# mkdir  /mnt/boot/efi
# mount /dev/vda1 /mnt/boot/efi/

And then install the base OS (VoidLinux, libc variant, xbps method):

# export REPO=https://repo-default.voidlinux.org/current
# export ARCH=x86_64
# mkdir -p /mnt/var/db/xbps/keys
# cp /var/db/xbps/keys/* /mnt/var/db/xbps/keys/
# XBPS_ARCH=$ARCH xbps-install -S -r /mnt -R "$REPO" base-system \
    grub-x86_64-efi linux snapper cryptsetup grub-btrfs btrfs-progs htop \
    btop ripgrep neovim

# btrfs filesystem mkswapfile --size 4G /mnt/var/swap/swapfile
# swapon /mnt/var/swap/swapfile

# xgenfstab -U /mnt/ > /mnt/etc/fstab

After which we chroot into our new installation:

# xchroot /mnt /bin/bash

Let's configure the basic things first:

# echo HOSTNAME > /etc/hostname
# ln -sf /usr/share/zoneinfo/<TIMEZONE> /etc/localtime
# nvim /etc/rc.conf     # go through and check the options
# nvim /etc/default/libc-locales
# xbps-reconfigure -f glibc-locales
# passwd    # set root password

Then let's deal with encryption. You can find the partition UUID with the blkid /dev/vda<X> command.

# echo GRUB_ENABLE_CRYPTODISK=y >> /etc/default/grub
# sed -i 's/^GRUB_CMDLINE_LINUX_DEFAULT=".*"/GRUB_CMDLINE_LINUX_DEFAULT="rd.luks.uuid=<UUID-VDA4> loglevel=4"/' /etc/default/grub

# dd bs=1 count=64 if=/dev/urandom of=/boot/root.key
# cryptsetup luksAddKey /dev/vda3 /boot/root.key
# chmod 000 /boot/root.key
# chmod -R g-rwx,o-rwx /boot/root.key

# dd bs=1 count=64 if=/dev/urandom of=/boot.key
# cryptsetup luksAddKey /dev/vda2 /boot.key
# chmod 000 /boot.key

# echo -e 'cryptboot /dev/disk/by-uuid/<UUID-VDA2> /boot.key    luks,discard\ncryptroot /dev/disk/by-uuid/<UUID-VDA4> /boot/root.key    luks,discard' >> /etc/crypttab
# echo -e 'install_items+=" /boot/root.key /etc/crypttab "' > /etc/dracut.conf.d/10-crypt.conf

# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Void
# xbps-reconfigure -fa  # will generate the grub config

You can now exit the chroot, unmount and close the different (encrypted) partitions, and reboot.

Btrfs Snapshots

https://wiki.archlinux.org/title/Snapper

need dbus on voidlinux:

# ln -sf /etc/sv/dbus /var/service/
# reboot    # sv start dbus fails: "fail: dbus: unable to change to service directory: file does not exist"

Then:

# umount /.snapshots
# rm -rf /.snapshots
# snapper -c root create-config /
# mount -a        # remount /.snapshots
# nvim /etc/snapper/configs/root  # enable or disable auto-snapshotting, etc...
# snapper -c root create --description "initial snapshot of working system"

You can edit /etc/snapper/configs/root to configure automatic snapshots and other things.

Select Closer Mirrors

# xbps-install xmirror
# xmirror

Useful Services

Power Management

# xbps-install elogind polkit

# ln -sf /etc/sv/dbus /var/service/     # if not done already
# ln -sf /etc/sv/elogind /var/service/

NTP

# xbps-install chrony
# ln -sf /etc/sv/chronyd /var/service/

Wireless

# xbps-install iwd
# ln -sf /etc/sv/iwd /var/service/
# ln -sf /etc/sv/dhcpcd /var/service/
# usermod -aG network <USERNAME>
# xbps-install impala

Intel Microcode

xbps-install void-repo-nonfree
xbps-install -S
xbps-install intel-ucode

Graphical Interface

Sway

# xbps-install mesa-dri intel-media-driver seatd xorg-server-xwayland noto-fonts-ttf noto-fonts-cjk nerd-fonts dejavu-fonts-ttf xdg-desktop-portal-gtk sway swaylock swayidle swaybg ghostty fuzzel
# ln -sf /etc/sv/seatd /var/service/
# usermod -aG _seatd <USERNAME>

ly is not in the VoidLinux packages, so we need to compile it by ourselves:

$ sudo xbps-install curl wget xz
$ mkdir -p ~/workspace/voidlinux
$ cd ~workspace/voidlinux

$ wget https://ziglang.org/download/0.16.0/zig-x86_64-linux-0.16.0.tar.xz
$ tar xf zig-x86_64-linux-0.16.0.tar.xz

$ cd ~workspace/voidlinux
$ sudo xbps-install git pam-devel brightnessctl libxcb libxcb-devel make gcc
$ sudo usermod -aG input,plugdev,storage <USERNAME>
$ git clone https://github.com/fairyglade/ly.git
$ cd ly
$ ../zig-x86_64-linux-0.16.0/zig build
$ sudo zig build installexe -Dinit_system=runit
$ sudo ln -sf /etc/sv/ly /var/service/
$ sudo rm /var/service/agetty-tty2

Before finishing, let's get an initial sway configuration:

$ mkdir -p .config/sway
$ cp /etc/sway/config ~/.config/sway/

We need to change the default terminal and menu applications:

set $term ghostty
set $menu fuzzel

We can now login to sway via ly.

Sound

# xbps-install pipewire wireplumber libjack-pipewire wiremix
# mkdir -p /etc/pipewire/pipewire.conf.d
# ln -s /usr/share/examples/wireplumber/10-wireplumber.conf /etc/pipewire/pipewire.conf.d/
# ln -s /usr/share/examples/pipewire/20-pipewire-pulse.conf /etc/pipewire/pipewire.conf.d/
# echo "/usr/lib/pipewire-0.3/jack" > /etc/ld.so.conf.d/pipewire-jack.conf
# reboot

Start pipewire from your session manager so that it automatically start when you log-in. (Note that I don't have any sound via the jack plug...)

wiremix is a TUI-based application to control the pipewire.

Bluetooth

# xbps-install libspa-bluetooth bluez bluetui
# ln -sf /etc/sv/bluetoothd /var/service/

bluetui is a TUI-based application written in Rust to control the Bluetooth.

Japanese Keyboard

sudo xbps-install fcitx5-mozc fcitx5-configtool
fcitx5-configtool

Edit Sway configuration to start fcitx on log-in.

exec fcitx5

Post-Installation

Install several useful applications:

$ sudo xbps-install screen yazi rsync firefox vlc meld beancount fava baobab

If you use the tridactyl extension, to navigate in Firefox with vim-like keybindings, and want smooth scrolling:

:set smoothscroll true

Install marimo (like jupyter notebooks but in Python):

$ sudo xbps-install uv
$ mkdir ~/workspace/voidlinux/marimo-uv
$ cd ~/workspace/voidlinux/marimo-uv
$ uv init
$ uv add "marimo[recommended]"