From disc preparation to base system install.
We are going to install Void Linux in a Thinkpad x280 Laptop. And we are going to do it in the hard way.
On the one hand, we are goin to use disk encryption. I tried following the instructions of the oficial documentation, but after the first reboot the system did not work properlly. Not totally sure about what went wrong. So we are going to explore some variants. On the other hand, we are going to install a window manager based desktop instead of a full desktop environment. We will do this for two reasons: to save some RAM and because I like to learn about how things work.
Two things that we need to have to start the process:
First of all, we type bash to be in an emulator terminal in order to have command history and autocomplete. We will use lsblk to identify the disks and partition in our computer. Our disk is /dev/nvme0n1. With other types of disks, the identification will probalbly be something like /dev/sda.
Now, we have to delete the old partitions that the disk may have and create thre new ones. In our scheme, we will have three partitions
# cfdisk /dev/nvme0n1
We select GPT table and configure three partitions:
We are leaving the kernel outside of the encryption
bash lsblk
# Format the encrypted partition with default LUKS2 format
cryptsetup luksFormat /dev/nvme0n1p3
# Open of the encrypted partition and mount it on 'cryptvoid'
cryptsetup luksOpen /dev/nvme0n1p3 cryptvoid
# Creation of the LVM on the open container
pvcreate /dev/mapper/cryptvoid
vgcreate void-vg /dev/mapper/cryptvoid
# Creation of the logical volumenes
lvcreate -L 12G -n swap void-vgF
lvcreate -L 450G -n raiz void-vg
# lvcreate -l 100%FREE -n raiz void-vg
If we use the other variant, we need to specify the luskFormat --type luks1
swap root
# Formatof the UEFI partition (FAT32) and the intermediate /boot (EXT4)
mkfs.vfat -F32 /dev/nvme0n1p1
mkfs.ext4 /dev/nvme0n1p2
# Root and Swap format
mkfs.ext4 /dev/mapper/void--vg-raiz
mkswap /dev/mapper/void--vg-swap
# Mounting
mount /dev/mapper/void--vg-raiz /mnt
mkdir -p /mnt/boot
mount /dev/nvme0n1p2 /mnt/boot
mkdir -p /mnt/boot/efi
mount /dev/nvme0n1p1 /mnt/boot/efi
swapon /dev/mapper/void--vg-swap
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/
# Base system install
XBPS_ARCH=$ARCH xbps-install -S -R "$REPO" -r /mnt base-system cryptsetup lvm2 grub-x86_64-efi
# fstab generation
xgenfstab -U /mnt > /mnt/etc/fstab
We now enter into the new system:
xchroot /mnt
# Inside the chroot:
# Security permissions
chown root:root /
chmod 755 /
# Administrator password and system identification
passwd root
echo "void-fastboot" > /etc/hostname
# Locale and language
echo "LANG=es_ES.UTF-8" > /etc/locale.conf
echo "KEYMAP=us" > /etc/rc.conf
# Only one locale in the configuration file. We could also have uncommented that line.
echo "es_ES.UTF-8 UTF-8" >> /etc/default/libc-locales
xbps-reconfigure -f libc-locales
# Setting of the local time zone
ln -sf /usr/share/zoneinfo/Europe/Madrid /etc/localtime
# Take note of the UUID of the encrypted phisical partition
blkid -o value -s UUID /dev/nvme0n1p3
# 1. Edit GRUB file: vi /etc/default/grub
# 2. Modify the line adding our particular UUID and cryptographic parameters:
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=4 rd.lvm=1 rd.luks.uuid=[UUID]"
# GRUB installation on the EFI partition
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id="Void-GRUB"
# Dracut
mkdir -p /etc/dracut.conf.d
echo 'add_dracutmodules+=" crypt lvm "' > /etc/dracut.conf.d/10-crypt.conf
# System reconfiguration
xbps-reconfigure -fa
GRUB_ENABLE_CRYPTODISK=y on the GRUB file
# exit
# reboot