Finishing installation

Intel microcode

chroot# xbps-install -Su void-repo-nonfree intel-ucode

Note: If you're using an AMD CPU, install linux-firmware-amd instead.

GRUB

chroot# xbps-install grub-x86_64-efi
chroot# grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id="Void Linux"

Swapfile

In order to have an encrypted swap, let's use a more clean approach by using a swapfile for, duh, swap. For this example, I'll create a swapfile of 16 GiB, but you can choose the best size for your installation:

chroot# btrfs subvolume create /var/swap
chroot# truncate -s 0 /var/swap/swapfile
chroot# chattr +C /var/swap/swapfile
chroot# btrfs property set /var/swap/swapfile compression none
chroot# chmod 600 /var/swap/swapfile
chroot# dd if=/dev/zero of=/var/swap/swapfile bs=1G count=16 status=progress
chroot# mkswap /var/swap/swapfile
chroot# swapon /var/swap/swapfile

Now, you'll need a tool to calculate the resume_offset kernel parameter for btrfs. You can either follow this guide on Arch Linux's wiki or you can use XBPS to build a template I maintain myself of the same code cited in Arch's wiki.

After calculating the value, set it to a variable, let's say, RESUME_OFFSET, and append the following to GRUB's config:

chroot# echo GRUB_CMDLINE_LINUX="resume=UUID=$ROOT_UUID resume_offset=$RESUME_OFFSET" >> /etc/default/grub

Note: This won't be an issue with Void, but be aware that you need Linux kernel version 5.0+ in order to use a swapfile with btrfs.

Regenerating configurations

Finally, regenerate configurations and reboot the machine:

chroot# xbps-reconfigure -fa
chroot# exit
# umount -R /mnt
# shutdown -r now