Jul 8, 2022
Void Linux installation notes

How to install Void Linux with LUKS disk encryption without LVM.

Install information:

Login

root:voidlinux

Interactive shell

bash

Create partition table

partitionsizecodefs
boot (/dev/sda1)512 MiBef00efi
root (/dev/sda2)the rest8300ext4

Create filesystems

cryptsetup luksFormat /dev/sda2
cryptsetup open /dev/sda2 cryptroot
mkfs.ext4 /dev/mapper/cryptroot
mount /dev/mapper/cryptroot /mnt

mkfs.fat -F32 /dev/sda1
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot

Mount Linux system

mkdir /mnt/dev && mount --rbind /dev /mnt/dev
mkdir /mnt/proc && mount --rbind /proc /mnt/proc
mkdir /mnt/sys && mount --rbind /sys /mnt/sys

or

for d in dev proc sys; do mkdir /mnt/$d && mount --rbind /$d /mnt/$d; done

Install Void base-system

xbps-install -Sy -R https://repo-fi.voidlinux.org/current -r /mnt base-system cryptsetup grub-x86_64-efi neovim

Copy resolv.conf so DNS works in the chroot

cp /etc/resolv.conf /mnt/etc/resolv.conf

chroot

chroot /mnt /bin/bash

Set root password

passwd

root permissions

chown root:root /
chmod 755 /

Set hostname

echo <yr-hostname> > /etc/hostname

Add user

useradd -m -G wheel rj1
passwd rj1

Enable sudo

nvim /etc/sudoers

Set timezone/keymap

nvim /etc/rc.conf

Set locale

echo "LANG=en_US.UTF-8" > /etc/locale.conf

Uncomment your locale in /etc/default/libc-locales

nvim /etc/default/libc-locales

Enable nonfree repo + install microcode patch

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

Setup fstab

nvim /etc/fstab

Example fstab:

tmpfs                                           /tmp    tmpfs   defaults,nosuid,nodev   0       0
UUID=21b8b8e9-29ca-4d2f-a7fc-3face2fc2b0a       /       ext4    defaults                0       0
UUID=0536-48CF                                  /boot   vfat    defaults                0       2

Use :r!blkid /dev/sda2 -sUUID -ovalue in vim to insert the desired UUID

Edit grub config

Edit /etc/default/grub

nvim /etc/default/grub

Append rd.auto=1 to GRUB_CMDLINE_LINUX_DEFAULT

e.g. GRUB_CMDLINE_LINUX_DEFAULT="loglevel=4 rd.auto=1"

Install grub

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id="void"
grub-mkconfig -o /boot/grub/grub.cfg

Add cryptsetup to our initramfs

echo 'add_dracutmodules+=" crypt "' > /etc/dracut.conf.d/dracutmodules.conf

Add hostonly setting to dracut

echo 'hostonly=yes' > /etc/dracut.conf.d/hostonly.conf

Build initramfs

Note: the following command will reconfigure all of the packages you have installed, this is a simple way to generate the initramfs and enable our locale choice(s) by reconfiguring the glibc-locales package

xbps-reconfigure -fa

You can exit the chroot and reboot now

Have fun!