Booting multiple Linux with rEFInd

When I install a Linux OS with an existing Windows OS, I always install the grub bootloader. Now, when I install a second Linux OS and the grub bootloader, this second grub bootloader will become the default bootloader. There is not too much difference between the two grub bootloaders, its only the order of the Linux boot entries and look and feel.

When the Linux grub bootloader is installed/updated , it becomes the default. Because I have added some custom boot entries to my primary Linux, Debian, I would rather keep its bootloader as default. At some point in time, with the Debian grub bootloader as default, I cannot boot into the second Linux.

After the recent Debian upgrade to bookworm, I happen to know rEFInd boot manager and after reading Any downside to using rEFInd instead of GRUB?, I hope rEFInd will be able to solve my boot issues.

It does!


I have a EFI partition on /dev/sda1 .

To install rEFInd on Debian, sudo apt install refind

By default, it will copy/install to /boot/efi/EFI/refind

sudo cp -a /usr/share/refind/fonts/liberation-mono-regular-28.png /boot/efi/EFI/refind/

sudo vi /boot/efi/EFI/refind/refind.conf

I make 3 changes to /boot/efi/EFI/refind/refind.conf

font liberation-mono-regular-28.png
fold_linux_kernels false


Append "include android.cfg" to the end of /boot/efi/EFI/refind/refind.conf

include android.cfg


The rEFInd default font text is too tiny for my eyes, so the font setting use liberation-mono-regular-28.png which comes with the refind package, but the file needs to be copied to /boot/efi/EFI/refind/

By default, fold_linux_kernels setting is true, rEFInd will only show a single boot entry for each partition with a Linux OS. On Debian, there are 2 Linux kernels and rEFInd may not boot the newest one. If fold_linux_kernels setting is false, rEFInd will show 2 Debian boot entries, one for each kernel.

Lastly, I add a custom boot entry (in android.cfg) for Android x86.


sudo vi /boot/efi/EFI/refind/android.cfg

/boot/efi/EFI/refind/android.cfg

menuentry "Android-x86 9.0-r2" {
icon EFI/refind/icons/os_artful.png
volume ALinux
loader /android-9.0-r2/kernel
initrd /android-9.0-r2/initrd.img
options "root=/dev/ram0 androidboot.selinux=permissive SRC=/android-9.0-r2"
}


I have Android x86 desktop on partition /dev/sda8 .
To give the partition file system the label ALinux, sudo e2label /dev/sda8 ALinux

The volume can be either filesystem label, partition label, or partition GUID number.


After booting successfully the various OS, I decides to remove the Debian grub bootloader.

sudo dpkg --purge shim-signed
sudo dpkg --purge grub-efi-amd64-bin grub-efi-amd64
sudo dpkg --purge grub2-common
 
sudo mv /boot/efi/EFI/debian/grubx64.efi /boot/efi/EFI/debian/grubx64.efi.0


The grubx64.efi is renamed, so that the grub bootloader entry will not appear in rEFInd boot screen.

For reference, see Installing and Uninstalling rEFInd .

Comments

blog comments powered by Disqus