On the joys of reinstalling systemd-boot

This happened to me one-time-too-many, so I am finally noting it down here. I have a Mac Book Pro, where I have Apple’s macOS (forcibly) co-exist with Archlinux. As per the instructions of the very fine Arch Wiki,1 I use systemd-boot as the bootloader, to choose which OS to boot.

And everything ran smoothly ever after—until it was time to update macOS, that is.2 You see, following the (ig)noble tradition of Microsoft’s operating systems, when rebooting after having completed an update, macOS gets a bit full of itself, and simply assumes he owns the place—by which I mean it overrides previous bootloader settings, rendering it impossible to boot up Archlinux. At this point, I would patiently look up the instructions for how to reinstall the boot loader, do it, and then… forget about it. Until it was time to update macOS again… This happened a couple of times, but now I got fed up. So here are the instructions.

Basically you have to boot up from a live USB, mount enough of your existing system in order to be able to chroot into it, do it, and then run the command that sets up the bootloader. In my case, I use disk encryption (the encrypted volume is /dev/sda3), and inside this encrypted volume there are several LVM logical volumes; the one for root (/) is named my-root. Also, I have a separate /boot (/dev/sda1) partition. So the instructions below are for this specific scenario—adapt to your own needs.3

So first, insert the live USB, power up the machine, and hit <F2> until you are shown a list of drives from which to boot up. Select the USB one, and once you are on the prompt of Live Arch, do the following:

# cryptsetup open /dev/sda3 foobar
# mount /dev/mapper/my-root /mnt
# mount /dev/boot /mnt/boot
# arch-chroot /mnt
# bootctl --path=/boot install

The bootloader should be back to its proper functioning form. So exit the chroot (Ctrl-D), unmount what you mounted before, close the encrypted drive, and reboot:

# ^D
# umount /mnt/boot
# umount /mnt
# cryptsetup close foobar
# reboot

Remove the USB drive, and if everything went fine, you should now see the bootloader listing both macOS and Archlinux as options for boot up.

November 15, 2021. Twitter.

EDIT, February 24, 2022. Slightly amended the instructions to account for the fact that inside the encrypted volume, I have LVM set up.


  1. https://wiki.archlinux.org/title/MacBookPro11,x#Setup_bootloader↩︎

  2. If, by any chance, you are wondering why I kept mac OS installed, it’s because it is required to be able to update the firmware.↩︎

  3. In the event that you do not have an LVM setup, then in the line mount /dev/mapper/my-root /mnt, instead of my-root you might have to use foobar.↩︎