Systemd-boot alongside Grub2


I would like to install Grub2 alongside systemd-boot as a sort of ‘secondary’ bootloader to work around the BTRFS Snapshot menu thing.

Basically, I want to systemd-boot to be my primary bootloader every time I power up my laptop, and I want systemd-boot menu to have an option to boot into ‘Grub’. It would be nice to have it boot directly into Grub’s ‘Snapshot’ menu instead of its main menu but either way will suffice as a work around.

I am sure some will find this a little redundant but nonetheless, it is something I would like to do.

Thank you in advance

I would start reading there.


I see it is not only me!
I read again the old thread and thought, the Grub issue happened at a certain stage when the Grub developers made a change to Grub that requires some action by the user to avoid it breaking.

I remember there was some other thread(s) where I believe I posted a hook I made w automatically handle this so Grub won’t break (I will try find and update this post). UPDATE: I found it here Grub Hook to grub-install and grub-mkconfig?

To be fair I have to say that I like the feeling of security with the old Grub that I can use the snapshot feature and boot from a previous snapshot, as well I like the simplicity and faster boot time of systemd-boot.

So, I see 2 solutions for this Grub issue:

  • fork Grub from an old non problematic features done by Grub developers so it is the old Grub we used
  • use the hook I mentioned to be installed by default if the user chose Grub as a boot loader. Though I am sure EndeavourOS developers can make the hook better than what I did.

Maybe the systemd-boot developer notices such discussions and feature “requests” by users and add it to systemd-boot.

Booting from a previous working snapshot is actually a good feature especially for non techie users ( like me) and new comers to Linux and to Arch/Arch based distros.

I really hope some developer(s) consider the above 2 suggestions.

I have to be fair and state that it was not me who actually did the hook, I didn’t even know there was something like hooks. I did it with the help and guidance of all my friends here especially @dalto and @pebcak and others.

1 Like

There are a few significant issues with this. I can only talk about an mkinitcpio system (not dracut).

  • AFAIK, systemd-boot and the accompanying scripts configure pacman to install system kernels at the $ESP (/efi/ by default), while grub looks for kernels at /boot/.
  • Even if your $ESP is /boot/, the above scripts place the kernels inside subfolders (named by MachineID).
  • The above scripts replace (or re-populate) the kernel preset files (used by mkinitcpio to generate and save kernel images), using the default name .preset.
  • If you modify the scripts to make both grub and systemd-boot usable, you will have kernels in two places, one set for systemd-boot and one set for grub usage.

It might be workable (I haven’t tested myself) if you change the preset filenames.

Warning: Wait for @dalto (the developer) to comment first, before you proceed
Warning: Use at your own risk. I have no responsibility if you break your system.

# Test first
sed -n '/preset_file=/s/packagename}\.preset/packagename}-sb.preset/p' /usr/bin/gen-mkinitcpio-preset

# Change preset filenames for systemd-boot with kernel-install-mkinitcpio
sudo sed -i '/preset_file=/s/packagename}\.preset/packagename}-sb.preset/g' /usr/bin/gen-mkinitcpio-preset

# Remove preset files, so mkinitcpio will re-create the default ones (select your installed kernels names)
test -f /etc/mkinitcpio.d/linux.preset && sudo rm /etc/mkinitcpio.d/linux.preset
test -f /etc/mkinitcpio.d/linux-lts.preset && sudo rm /etc/mkinitcpio.d/linux-lts.preset

# Re-install your kernels to trigger creating new images (select your installed kernels names)
sudo pacman -S linux linux-lts

# Install grub package
sudo pacman -S grub

# Install grub bootloader
# Read archwiki for the proper command

# Create grub configuration file
sudo grub-mkconfig -o /boot/grub/grub.cfg

# Change boot order, and set systemd-boot entry as first
efibootmgr -v
# Get boot entry ids and use efibootmgr -o <1stID>,<2ndID>,<3rdID> to change boot order

If it works as expected, you should know that the change to script gen-mkinitcpio-preset will be overwritten after the relevant package is upgraded.

I am leaving for vacations now :beach_umbrella:

1 Like

kernel-install-mkinitcpio re-wires the mkinitcpio presets so it is incompatible with running a more traditional setup with grub at the same time on the same install.

However, this doesn’t happen with dracut.

With either dracut or mkinitcpio you will have an issue with the kernel. You would need to make local changes so the kernel would get copied to /boot.

I think the best solution would be to use grub if you want to boot snapshots.

However, if you really want both, I would probably not use the EOS automation for systemd-boot. Instead, choose grub from the installer and then do as systemd-boot install per the Arch wiki instead. That methos would be more compatible with maintaining both grub and systemd-boot. Although, again, I don’t recommend it.

My hack/workaround proposal was to change the preset filename, so mkinitcpio would create two sets of kernel images. Do you think it would work like that?

I don’t think it would work but I would have to test it to be sure.