Using Bootctl (Systemd Boot)


Disclosure
Personally, I do not think bootctl is acceptable as a bootloader as there are serious issues with multiple “same” distros. So say if you have Manjaro lxqt edition and Manjaro kde edition or Ubuntu and Linux Mint, then bootctl may be disastrous.

Also whenever there is a new kernel or installed a new distro, we will need to manually add these entries. as what we do when we use bootctl for the first time. All needs to be done manually. If there is only one linux distro and we intend to keep it this way, bootctl may be a feasible choice. Still a very poor choice in my opinion as it does not have the flexibility and features that grub 2 can offer.

However, these are the steps required if we choose bootctl as the bootloader.

Caveats
o There could be new developments and could supersede what’s written here.
o The following are my own discovered process and if there are more or better procedure, will appreciate comments.
o If wrongly done, it may make the whole system unbootable, so do it with care and at your own risk. Suggest you back up your booting alternatives.

Requirements
o Must only be for UEFI systems and GPT partitioning only.
o ESP must be in fat32 format.
o Systemd version 220 or higher.

Suggestions/Optionals - (recommended, not mandatory)
o If there is an existing $ESP, say for Windows and other /boot/efi linux boots, create a new ESP partition for this.
o Create a size no smaller than 500MB. Note for /boot/efi a 150 MB is more than enough.
But a $ESP for bootctl will need to contain kernels (old and new) and from other OS’s (if applicable) as well

New OS Installation
o Select and mount $ESP as /boot, not as /boot/efi.
o If there is an existing $ESP as /boot/efi, do not use that partition for bootctl.
o Proceed with installation, and when installation is completed, do not shutdown or reboot.
o Go to next section to create files that is required to boot the new installation before exiting installation.

Creating entries and loader.conf
Create the directories needed for bootctl
sudo mkdir -p /boot/loader/entries

Create a file ‘loader.conf’ and save as /boot/loader/loader.conf
Sample loader.conf

timeout 15
 # default cd080bbce7be42c7aa5edd21d0d5db61-*
editor 1
i3  sda6
openbox  sda12
plasma  sda11
kubuntu  sda13

Create new files for individual entries and save as /boot/loader/entries/plasma.conf

Sample plasma.conf

title   plasma  sda11
linux   /vmlinuz-4.1-x86_64
initrd  /intel-ucode.img
initrd  /initramfs-4.1-x86_64.img
options root=UUID=421d87bc-f75a-4de5-a864-4e54509a5103 quiet systemd.show_status=0 resume=UUID=50cde1b3-c98c-4b45-8354-7267ee7293b4 rw

A non-Manjaro entry will look like this.
Sample kubuntu.conf

title   kubuntu  sda13
linux   /vmlinuz-3.19.0-22-generic.efi.signed
initrd  /initrd.img-3.19.0-22-generic
options root=UUID=985ff3e5-536c-47c0-8672-3d8defa70e59 quiet systemd.show_status=0 resume=UUID=50cde1b3-c98c-4b45-8354-7267ee7293b4  quiet splash ro

Now only can we safely exit the installer and reboot.

Adding Existing non-bootctl OS

First, copy over the kernel and initramfs.img to this bootctl ESP. As we know, the $ESP is in fat32 format and therefore we cannot put a sym-link there; so we have to copy the whole kernel and initrd files.
Then create a new entry in entries directory and then add a simple line in loader.conf.
Note that line must be exactly the same as the title heading in the entry.
There’s is no need to do anything else, like going to the new entry OS to do ‘bootctl install’.

But remember, each time there is a new revision or update we will need to repeat the copying over of these vmlinuz and initrd files (and we can remove the old ones, if we like). There is no other alternative. Similarly whenever there is a new kernel for our bootctl OS, we will need to manually amend the entry.conf so the new update is booted instead of the old one.

Booting grub 2 OS’s
Another way to boot grub 2 OS’s is by booting up its core.efi.
This is possible as grub 2 is multiboot compliant.
Copy over the OS core.efi to bootctl $esp.

Add an entry, a typical entry will look like this.
Note I renamed the core.efi to plasmacore.efi so I can distinquish among the other OS’s core.efi

title   Plasmacore
linux   /plasmacore.efi
options root=UUID=63eb91ca-4a96-4652-a489-0b290a13a0da quiet splash rw

Multiple Distro versions
A note here about using bootctl for multiple Manjaro versions, say, Manjaro lxqt and Manjaro i3.
Assume a case where both are on kernel 4.6 rc3 and both are booting up well on bootctl.

We are on i3 and there is a kernel upgrade from 4.6 rc3 to 4.6 rc4. Upgrade proceeds well and 4.6 rc4 is installed well.
Note here, the kernel (and initramfs) at bootctl $ESP which contains the kernels and iniitrd files are now updated to 4.6 rc4.

But when we start up lxqt, note that bootctl will now use 4.6 rc4 because kernel 4.6 has been updated by i3 (being in the same bootctl partition), even though lxqt has not has its kernel updated at that boot time. Usually that will result in a kernel panic and lxqt will not be able to boot. This is doubly bad because there will be no way we can rescue this situation (unless we use an alternative boot like grub2). {footnote - rEFInd similarly has the same problem}

footnotes
o intel-ucode - needs 2 lines of initrd; not a single line initrd with both intel-ucode and manjaro kernel.
o If non-intel, no need for intel ucode initrd line (best uninstall intel-ucode package too)
o If non-intel, install amd-ucode and put in “initrd /amd-ucode.img” instead.
o Non-manjaro intel ucode and amd-ucode is built into kernel, so just one line, as shown.
o Best to use partuuid instead of uuid in a GPT partitioning, examples here are using uuid just to be simple.
o Recommend to create a new ESP for bootctl and not use Windows or existing linux /boot/efi ESP.

References
o Bootctl specs


5 Likes

It can be relatively simple compared to grub2. Tvat being said, if there is need to avoid grub, refind is much better option. And frankly, grub is also better than this…

Heh heh. Didn’t expect anyone to see this frivolity. I edited these out very soon afterwards.
And I did these to keep going with this topic; sort of as a self-amusement.
Self-amusement, did I say? OH that’s a definition for another word in the Oxford dictionary.
But all the same, I had almost the same level of fun. Ha ha ha.

Cheers.

I’ve added another section above (in first post) on booting grub2 OS’s using core.efi.

In another topic on Manjaro forum on syslinux booting, I suggested that other than chainload or booting up vmlinux and initramfs files, we can boot up core.img instead, since grub 2 is multiboot compliant.
So that got me thinking that bootctl can also boot up its core.efi (since it’s uefi not bios-legacy so not core.img but core.efi). And so it works. And I added this to the first post.

Enjoy.

Forum kindly sponsored by