A week ago I was excited to move to Manjaro, after using PopOS for three years. To make the transition as smooth as possible I dual booted Manjaro along side Pop. As Pop uses a systemd-boot installation in /boot/efi
, I also selected that option during the Manjaro Architect installation, expecting it to integrate seamlessly. However, to the only thing that did was remove all my existing sdboot entries in /boot/efi/loader/entries
. After posting this as a feature request on the forum here, I still wanted to resolve the issue myself, as I manually had to copy the kernel images, and recreate the sdboot entries everytime a kernel or initramfs image got updated.
Problem
Regardless of bootloader installation installation location, the kernel image installation location is currently hardcoded into the pacman hooks to /boot
. If any other sdboot installation dir is used, such as /boot/efi
or /efi
, this obviously creates problems, as the bootloader is unable to access the images during boot.
Solution
To mitigate this issue, the respective pacman hook scripts have to changed to dynamically detect the bootloader installation directory. The scripts are /usr/share/libalpm/scripts/mkinitcpio-install
and /usr/share/libalpm/scripts/mkinitcpio-remove
. Additionally, to integrate better with multi-boot setups, compliance with the Systemd bootloader specification, specifying that boot files should be installed in EFI/<distro>-<root-uuid>
, would be really nice to have. In my case this is /boot/efi/EFI/ManjaroLinux-cb3b0f4f-3639-4b20-9154-f1254bff5fd3
.
Patch
To solve this problem, and thus make Manjaro’s sdboot integration more robust, I have changed the mkinitcpio-install
, mkinitcpio-remove
, alongside with the sdboot entry generator sdboot-manage
in this GitHub repo, which could theoretically directly replace the current scripts. As sdboot-manage seems to belongs to the “systemd-boot-manager” repo on Gitlab, I have also created a merge request there to implement the patch.
Testing
To test the patch, I have used the install.sh
script also located in my GitHub repo to install a custom hook to /etc/pacman.d/hooks
to overwrite the system hooks, which appears to work flawlessly. However, this is only test for systemd-boot. I don’t use other bootloaders such as Grub, and thus haven’t tested the patch on them, as they also need to be able to pick-up the new installation location of the images.