Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Minimal instructions for installing Void Linux on MBR + Legacy BIOS
# Obtain the latest Void Linux base live ISO from:
# https://voidlinux.org/download/ (plain musl version)
# Write it to a USB drive:
# sudo dd bs=4M if=void-live-x86_64-musl-20181111.iso of=/dev/sdb status=progress oflag=sync
# Switch to bash (easier to use while installing)
bash
# Set UK keymap
loadkeys uk
# Set up WiFi
wpa_passphrase <MYSSID> <key> >> /etc/wpa_supplicant/wpa_supplicant.conf
wpa_supplicant -i <device> -c /etc/wpa_supplicant/wpa_supplicant.conf -B
# Set up partitions (MBR)
parted /dev/sdX mklabel msdos
cfdisk /dev/sdX
# 1 - 1G primary partition, set the bootable flag
# 2 - 100% primary partition
# Set the filesystem for the boot partition
mkfs.ext2 /dev/sdX1
# Create the encryptied partitions
cryptsetup luksFormat --type luks2 --cipher aes-xts-plain64 --key-size 512 --hash sha256 /dev/sdX2
cryptsetup luksOpen /dev/sdX2 sysroot
# Set up LVM
pvcreate /dev/mapper/sysroot
vgcreate void /dev/mapper/sysroot
lvcreate --size 2G void --name swap
lvcreate -l +100%FREE void --name root
# Set the filesystems
mkfs.xfs -i sparse=0 /dev/mapper/void-root
mkswap /dev/mapper/void-swap
# Mount the new filesystem
mount /dev/mapper/void-root /mnt
swapon /dev/mapper/void-swap
mkdir /mnt/boot
mount /dev/sdX1 /mnt/boot
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
# Install Void Linux
xbps-install -Sy -R https://mirrors.dotsrc.org/voidlinux/current -r /mnt base-system lvm2 cryptsetup grub nano htop tmux
# Chroot into the new Void Linux install and set permissions
chroot /mnt
bash
# Set permissions
chown root:root /
chmod 755 /
# Set root password
passwd root
# Add a new user
useradd -m -s /bin/bash -U -G wheel,users,audio,video,cdrom,input MYUSERNAME
passwd MYUSERNAME
# Configure suders
nano /etc/sudoers # Uncomment the line containing %wheel ALL=(ALL) ALL
# Configure timezone and default keymap
nano /etc/rc.conf
# TIMEZONE="Europe/Jersey" # (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
# KEYMAP="uk"
# Set up hostname
echo somehostname > /etc/hostname
# Set up the locale
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
# UUID for disks
BOOT_UUID=$(blkid -o value -s UUID /dev/sdX1)
CRYPTD_UUID=$(blkid -o value -s UUID /dev/sdX1)
# Edit fstab
nano /etc/fstab
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/mapper/void-root / xfs defaults 0 1
# /dev/voidvm/void-swap swap swap defaults 0 0
echo "UUID=${BOOT_UUID} /boot ext2 defaults 0 2"
# Configure GRUB
echo "GRUB_CMDLINE_LINUX_DEFAULT=\"loglevel=4 slub_debug=P page_poison=1 acpi.ec_no_wakeup=1 rd.auto=1 cryptdevice=UUID=${CRYPTD_UUID}:sysroot root=/dev/mapper/void-root resume=/dev/mapper/void-swap\"" >> /etc/default/grub
echo "GRUB_ENABLE_CRYPTODISK=y" >> /etc/default/grub
# Install grub
grub-install /dev/sdX
xbps-reconfigure -f linux4.19 # use the current known kernel version
# Copy WiFi config over to the new install
cp /etc/wpa_supplicant/wpa_supplicant.conf /mnt/etc/wpa_supplicant/wpa_supplicant.conf
# Reboot
exit
umount -R /mnt
reboot
# Quick chroot back in if needed:
cryptsetup luksOpen /dev/sdX2 sysroot
vgchange -a y void
mount /dev/mapper/void-root /mnt
mount /dev/sdX1 /mnt/boot
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
chroot /mnt
bash
@JhonnyRice
Copy link

JhonnyRice commented Mar 14, 2022

Thanks! Extremely helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment