Dual boot using ELILO and rEFInd on Slackware

Published: 2021-01-10 | Last Updated: 2021-02-02 | ~5 Minutes Read

Context

After deciding to switch over to Slackware current due to a hardware upgrade I thought I’d also start using UEFI. This decision turned out to be interesting and beneficial in some ways.

I will miss LILO

As stated in the Slackware documentation LILO does not support booting from UEFI capable hardware. After many years of using LILO to manage my dual boot system I was quite sad to let it go.

I was however happy to find out that ELILO was available inside the Slackware installation media, so I installed that instead.

As a side note, I was pointed to GRUB2 as this is also available on Slackware however for some odd reason (probably my lack of familiarity with it) I was not able to install it successfully after following the provided documentation. I decided to continue with ELILO as it is perfect for my needs.

Installing ELILO

During the EFI installer you’re asked if you’d like to install ELILO which is done thanks to the eliloconfig script written by Patrick Volkerding.

I selected the following options and got ELILO installed:

eliloinstall-1 eliloinstall-2 eliloinstall-3 eliloinstall-4

After installing ELILO a new entry was created in the EFI partition of my system, located in /dev/sda1, along with the entries from the secondary OS I installed, however only Slackware would boot since ELILO can’t chainload another boot loader like I was used to with LILO.

I looked at the options suggested by Rod Smith in his post about EFI boot loaders and thought that a boot manager would allow me to continue to use ELILO and keep the dual boot setup that I needed.

I looked at the options provided and decided to give rEFInd a try.

Installing rEFInd

Installing rEFInd was quite simple, there are currently two available slackbuilds, one where you build from source and a pre-build binary option. Building from source failed on Slackware current. After trying the pre-build binary I was able to get rEFInd installed successfully on my system.

After the installation I simply ran refind-install as root in my terminal and all the boot options were detected automatically. With the installation complete I restarted my system and was able to see the rEFInd menu with some entries available.

I then hid some of the options that appeared on the rEFInd menu by pressing the Delete key while they were highlighted, with that we’re left with our two options:

refind-image

Kernel Updates

As you may know, for Slackware current there are constant updates to the Linux Kernel. Upon updating from Slackware 14.2 to current, I wanted to start using the generic Kernel instead of huge as well. The process that I now follow on every Kernel update is the following:

Update the system as usual:

# slackpkg update
# slackpkg upgrade-all

If there are kernel updates in the new released packages then you may see something like the following at the end of the update:

Your kernel image was updated, and lilo does not appear to be used on
your system.  You may need to adjust your boot manager (like GRUB) to
boot the appropriate kernel (after generating an initrd if required).
Press the "Enter" key to continue...

Once the updates are complete I run the mkinitrd_command_generator.sh script:

root@epsilon:~# /usr/share/mkinitrd/mkinitrd_command_generator.sh
Modules for kernel 5.10.3 aren't installed.
root@epsilon:~# /usr/share/mkinitrd/mkinitrd_command_generator.sh -k 5.10.5
#
# mkinitrd_command_generator.sh revision 1.45
#
# This script will now make a recommendation about the command to use
# in case you require an initrd image to boot a kernel that does not
# have support for your storage or root filesystem built in
# (such as the Slackware 'generic' kernels').
# A suitable 'mkinitrd' command will be:

mkinitrd -c -k 5.10.5 -f ext4 -r /dev/nvme0n1p1 -m xhci-pci:ohci-pci:ehci-pci:xhci-hcd:uhci-hcd:ehci-hcd:hid:usbhid:i2c-hid:hid_generic:hid-asus:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:hid_multitouch:jbd2:mbcache:crc32c_intel:crc32c_generic:ext4 -u -o /boot/initrd.gz

Don’t forget to execute the command that you get, the generator script does not execute the command for you, it just gives you the appropriate command to execute.

Once executed I got a new initrd.gz file in /boot and I copied to /boot/efi/EFI/Slackware:

# cp /boot/initrd.gz /boot/efi/EFI/Slackware

I also copied the generic kernel to the same location:

# cp /boot/vmlinuz-generic-5.10.5 /boot/efi/EFI/Slackware

Now I executed the eliloconfig script again, and last but not least I execute the refind-install script one last time:

root@slack-current:~# refind-install
ShimSource is none
Installing rEFInd on Linux....
ESP was found at /boot/efi using vfat
Found rEFInd installation in /boot/efi/EFI/refind; upgrading it.
Installing driver for ext4 (ext4_x64.efi)
Copied rEFInd binary files

Notice: Backed up existing icons directory as icons-backup.
Existing refind.conf file found; copying sample file as refind.conf-sample
to avoid overwriting your customizations.

An existing rEFInd boot entry exists, but isn't set as the default boot
manager. The boot order is being adjusted to make rEFInd the default boot
manager. If this is NOT what you want, you should use efibootmgr to
manually adjust your EFI's boot order.
Creating new NVRAM entry
rEFInd is set as the default boot manager.
Existing //boot/refind_linux.conf found; not overwriting.

This will set rEFInd as the default boot manager and will allow us to boot back into the rEFInd menu.

Once we reboot we will come back to the familiar rEFInd menu screen and when we select Slackware we will boot to our newly updated system.