
I’ve been using linux close to a decade now and I’ve pickup various amounts of knowledge from hopping from distro to distro. My journey has looked something like this: Ubuntu -> Linux Mint -> Manjaro -> PopOS -> Arch Linux -> Gentoo -> Void Linux.
I’ve picked up quite a few tricks and seen how some distro maintainers package things as well as different ways to bootstrap a linux system, but I’ve found that Void Linux has a nice balance between customizabilty, simplicity, and extencibility.
This guide is heavily based on Sakaki’s gentoo install guide which in it’s self is worth a read. It’s outdated but provides a lot of extra info on some of the commands we’ll be running here.
With all that being said, let’s dive in to how I like to setup my workstations in void linux.
things to keep in mind during the guide
...
means a continuation/placement of text/files
<...>
means a placehodler for user input/choice/text
if you’ll be using wifi rather than ethernet
activate the wpa_supplicant service
this seems to be enabled by default on the newer images, but you can double check
# you can grep for it in /var/service
ls /var/service | grep wpa_supplicant
# if it's not there, go ahead and enable it
ln -s /etc/sv/wpa_supplicant /var/service/
# you can debug the service using sv
sv restart wpa_supplicant
connect to your wifi using the wpa_cli command line tool
wpa_cli
> scan
> scan_results
> add_network
> set_network 0 ssid <network-name>
# ---------------------------------------------
> set_network 0 psk <network-password>
# --- or for ESP networks (AKA no password) ---
> set_network 0 key_mgmt NONE
# ---------------------------------------------
> enable_network 0
> save_config
> quit
lastly check if the internet works
ping voidlinux.org
HORAHH!
base install
update packages + install essential packages
xbps-install -Syu xbps parted
partition + format + encrypt the main disk
parted -sa optimal /dev/<disk> \
mklabel gpt \
mkpart BOOT 0% 501MiB set 1 esp on \
mkpart ROOT 501MiB 100%
cryptsetup luksFormat --type luks2 /dev/<disk-partition-2>
mkfs.fat -F32 /dev/<disk-partition-1>
open the encrypted partition + create lvm scheme for system
export SWAP_SIZE=$(($(grep MemTotal /proc/meminfo | cut -d " " -f8) + 2000000))KB"
gpg --decrypt /media/usb/luks_laptop.gpg \
| cryptsetup --key-file - luksOpen /dev/<disk-partition-2> root
vgcreate system /dev/mapper/root
lvcreate -L $SWAP_SIZE system -n swap
lvcreate -l 100%FREE system -n linux
mkswap /dev/mapper/system-swap
create BTRFS
subvolumes for the system
mkfs.btrfs /dev/mapper/system-linux
# -- mount options for a nvme ssd -----
export BTRFS_OPTS="defaults,noatime,autodefrag,compress-force=zstd:1"
# -- or mount options for a sata ssd --
export BTRFS_OPTS="defaults,noatime,autodefrag,compress-force=zstd:2"
# -- or mount options for a sata hdd --
export BTRFS_OPTS="defaults,noatime,autodefrag,compress-force=zstd:13"
# -------------------------------------
mount -o $BTRFS_OPTS /dev/mapper/system-linux /mnt
btrfs subvolume create /mnt/@void
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@snapshots
umount /dev/mapper/system-linux
mount BTRFS
subvolumes to there respective directories
mount -o $BTRFS_OPTS,subvol=@ /dev/mapper/system-linux /mnt
mkdir /mnt/{.snapshots,home,boot}
mount -o $BTRFS_OPTS,subvol=@ /dev/mapper/system-linux /mnt
mount -o $BTRFS_OPTS,subvol=@home /dev/mapper/system-linux /mnt/home
mount -o $BTRFS_OPTS,subvol=@snapshots /dev/mapper/system-linux /mnt/.snapshots
mount /dev/<disk-partition-1> /mnt/boot
bootstrap the system with xbps-install
REPO=https://repo-default.voidlinux.org/current
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 cryptsetup lvm2 btrfs-progs gummiboot neovim gnupg
now onto system configuration
chroot into the /mnt
and configure some basics
xchroot /mnt /bin/bash
passwd root
echo urmom > /etc/hostname
echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "en_US.UTF-8 UTF-8" >> /etc/default/libc-locales
xbps-reconfigure -f glibc-locales
setup the FSTAB
file for all our mounts
export BOOT_UUID=$(blkid -s UUID -o value /dev/<disk-partition-1>)
export ROOT_UUID=$(blkid -s UUID -o value /dev/mapper/system-linux)
export SWAP_UUID=$(blkid -s UUID -o value /dev/mapper/system-swap)
cat <<EOF > /etc/fstab
> tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0
> UUID=$BOOT_UUID /boot vfat defaults,noatime 0 2
> UUID=$ROOT_UUID / btrfs $BTRFS_OPTS,subvol=@ 0 1
> UUID=$ROOT_UUID /home btrfs $BTRFS_OPTS,subvol=@home 0 2
> UUID=$ROOT_UUID /.snapshots btrfs $BTRFS_OPTS,subvol=@snapshots 0 2
> UUID=$SWAP_UUID swap swap defaults 0 2
> EOF
enable microcode updates for intel devices
xbps-install -Sy void-repo-nonfree
xbps-install -Su intel-ucode
echo 'early_microcode="yes"' >> /etc/dracut.conf.d/intel_ucode.conf
dracut setup
export CRYPT_UUID=$(blkid -s UUID -o value /dev/<disk-partition-2>)
cat <<EOF > /etc/dracut.conf
>
> hostonly="yes"
> use_fstab="yes"
> show_modules="yes"
> filesystems+=" btrfs "
> add_dracutmodules+=" lvm btrfs crypt dm "
>
> kernel_cmdline+="rd.luks rd.luks.uuid=$CRYPT_UUID rd.luks.allow-discards "
>
> EOF
gummiboot setup
gummiboot install
cat <<EOF > /boot/loader/void-options.conf
> rd.luks rd.luks.uuid=$CRYPT_UUID
>
> rd.lvm
> rd.lvm.vg=system
> rd.lvm.lv=system/linux
>
> root=UUID=$ROOT_UUID
> rootfstype=btrfs
> rootflags=subvol=/@ rd.luks.allow-discards"
> EOF
regenerate system config
xbps-reconfigure -fa
exit + unmount all paritions on /mnt
+ reboot
exit
umount -R /mnt
reboot
post install items (after reboot)
setup a new user
useradd -m -G wheel,audio,video,input <username>
passwd <username>
chsh -s /bin/bash <username>
echo "%wheel ALL=(ALL:ALL) ALL" > /etc/sudoers.d/wheel
disable root user
logout of root
logout
login as newly created user
VOID login: <username>
Password: <password>
disable root account
sudo passwd -dl root
wala, base install done!