I recently installed Slackware 15.0 on a new machine. elilo didn't work (don't know why). I just previously switched from elilo to grub on a different machine to fix an nVidia problem, so I'm a brand new grub user. Anyway, I grabbed the SlackBuild for grub 2.12 and compiled it on Slackware 15.0 and am using it now.
I use an encrypted /, so I needed to make some modifications (after following README_CRYPT.txt). Here is my drive setup (not every drive is listed):
Code:
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sr0 11:0 1 1024M 0 rom
nvme2n1 259:0 0 1.9T 0 disk
├─nvme2n1p1 259:1 0 850M 0 part /boot/efi
├─nvme2n1p2 259:2 0 12G 0 part
├─nvme2n1p3 259:3 0 61G 0 part
├─nvme2n1p4 259:4 0 2G 0 part /boot
├─nvme2n1p5 259:5 0 32G 0 part
│ └─cryptswap 252:1 0 32G 0 crypt [SWAP]
└─nvme2n1p6 259:6 0 1.8T 0 part
└─luksSLACKROOT 252:0 0 1.8T 0 crypt /
Note that nvme2n1 was originally called nvme0n1 before I installed additional NVME drives in the PCIe slots. This motivated me to switch to using labels instead of raw device names (I replaced real UUIDs by "xx-xx" except for the raw root partition I replaced it with "0x-xx" and the decrypted LUKS / partition with "2x-xx"):
Code:
/dev/mapper/cryptswap: UUID="xx-xx" TYPE="swap"
/dev/nvme2n1p6: UUID="0x-xx" TYPE="crypto_LUKS" PARTLABEL="SLACKROOT" PARTUUID="xx-xx"
/dev/nvme2n1p4: UUID="xx-xx" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="xx-xx"
/dev/nvme2n1p2: LABEL="OS" UUID="xx-xx" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="Basic data partition" PARTUUID="xx-xx"
/dev/nvme2n1p5: UUID="xx-xx" TYPE="swap" PARTUUID="xx-xx"
/dev/nvme2n1p3: LABEL="UBUNTU" UUID="xx-xx" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="xx-xx"
/dev/nvme2n1p1: LABEL_FATBOOT="ESP" LABEL="ESP" UUID="xx-xx" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="xx-xx"
/dev/mapper/luksSLACKROOT: UUID="2x-xx" BLOCK_SIZE="4096" TYPE="ext4"
First I added the following line to /etc/default/grub:
Code:
GRUB_CMDLINE_LINUX_DEFAULT="cryptdevice=UUID=0x-xx:luksSLACKROOT:allow-discards preempt=voluntary delayacct mitigations=off"
Then after generating /boot/grub/grub.cfg I modified it like so to boot my custom kernel. Whenever I upgrade my kernel I also upgrade the symlinks in /boot.
Code:
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Slackware-15.0 GNU/Linux' --class slackware_15_0 --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-2x-xx' {
load_video
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root xx-xx
echo 'Loading Linux current ...'
linux /vmlinuz-current root=UUID=2x-xx ro cryptdevice=UUID=0x-xx:luksSLACKROOT:allow-discards preempt=voluntary delayacct mitigations=off
echo 'Loading initial ramdisk ...'
initrd /initrd-current.gz
}
submenu 'Advanced options for Slackware-15.0 GNU/Linux' $menuentry_id_option 'gnulinux-advanced-2x-xx' {
menuentry 'Slackware-15.0 GNU/Linux, with Linux current' --class slackware_15_0 --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-current-advanced-2x-xx' {
load_video
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root xx-xx
echo 'Loading Linux current ...'
linux /vmlinuz-current root=UUID=2x-xx ro cryptdevice=UUID=0x-xx:luksSLACKROOT:allow-discards preempt=voluntary delayacct mitigations=off
echo 'Loading initial ramdisk ...'
initrd /initrd-current.gz
}
menuentry 'Slackware-15.0 GNU/Linux, with Linux current (recovery mode)' --class slackware_15_0 --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-current-recovery-2x-xx' {
load_video
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root xx-xx
echo 'Loading Linux current ...'
linux /vmlinuz-current root=UUID=2x-xx ro single
echo 'Loading initial ramdisk ...'
initrd /initrd-current.gz
}
menuentry 'Slackware-15.0 GNU/Linux, with Linux previous' --class slackware_15_0 --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-previous-advanced-2x-xx' {
load_video
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root xx-xx
echo 'Loading Linux previous ...'
linux /vmlinuz-previous root=UUID=2x-xx ro cryptdevice=UUID=0x-xx:luksSLACKROOT:allow-discards preempt=voluntary delayacct mitigations=off
echo 'Loading initial ramdisk ...'
initrd /initrd-previous.gz
}
menuentry 'Slackware-15.0 GNU/Linux, with Linux previous (recovery mode)' --class slackware_15_0 --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-previous-recovery-2x-xx' {
load_video
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root xx-xx
echo 'Loading Linux previous ...'
linux /vmlinuz-previous root=UUID=2x-xx ro single
echo 'Loading initial ramdisk ...'
initrd /initrd-previous.gz
}
menuentry 'Slackware-15.0 GNU/Linux, with Linux 5.15.145' --class slackware_15_0 --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.145-advanced-2x-xx' {
load_video
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root xx-xx
echo 'Loading Linux 5.15.145 ...'
linux /vmlinuz-generic-5.15.145 root=UUID=2x-xx ro cryptdevice=UUID=0x-xx:luksSLACKROOT:allow-discards preempt=voluntary delayacct mitigations=off
echo 'Loading initial ramdisk ...'
initrd /initrd-5.5.145.gz
}
menuentry 'Slackware-15.0 GNU/Linux, with Linux 5.15.145 (recovery mode)' --class slackware_15_0 --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.145-recovery-2x-xx' {
load_video
insmod gzio
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root xx-xx
echo 'Loading Linux 5.15.145 ...'
linux /vmlinuz-generic-5.15.145 root=UUID=2x-xx ro single
echo 'Loading initial ramdisk ...'
initrd /initrd-5.5.145.gz
}
I also modified /etc/crypttab, /etc/fstab, and /etc/mkinitrd.conf to use the partition label SLACKROOT:
Code:
# grep SLACKROOT /etc/crypttab
luksSLACKROOT /dev/disk/by-partlabel/SLACKROOT none discard
# grep SLACKROOT /etc/fstab
/dev/mapper/luksSLACKROOT / ext4 defaults,discard 1 1
# grep SLACKROOT /etc/mkinitrd.conf
LUKSDEV="/dev/disk/by-partlabel/SLACKROOT"
LUKSTRIM="/dev/disk/by-partlabel/SLACKROOT" # verify support with 'hdparm -I $dev | grep TRIM'
ROOTDEV="/dev/mapper/luksSLACKROOT"
Now when I add another drive (which I will next week...) it won't matter if the raw device name of / changes.