multi-boot with EFI systemd boot <solved>

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
curtvaughan
Level 3
Level 3
Posts: 163
Joined: Sun Dec 21, 2014 5:54 pm
Location: Austin, Tx

multi-boot with EFI systemd boot <solved>

Post by curtvaughan » Mon Aug 12, 2019 9:47 am

Hello. I have just ordered a new System76 laptop which will come pre-installed with PopOS 19.04. It's an Adder WS with two SSD drives and one HDD. I currently have a System76 Oryx Pro with a single SSD and one HDD, which triple boots LinuxMint 19.2, ArcoLinux 19, and PopOS 19.04. The Oryx Pro boots all three systems on the SSD and all /home directories are on the HDD. Even though it came pre-installed with PopOS with systemd boot, I was only able to multi-boot by converting to Grub2. I'd like to configure the new laptop in similar fashion - three system OS partitions on the first SSD, respective /home directories on the second SSD, and a miscellaneous backup/data storage area on the HDD. When I originally configured the older laptop a year ago, it appeared that it wasn't yet possible to multi-boot using systemd boot - or at least no one knew how to do it yet - so I reverted to Grub2 booting. Since then, some documentation has arisen on methods to multi-boot with systemd boot. Since the new Adder laptop will come already configured with single systemd boot, I'd like to keep that boot loader for a multi-boot configuration if possible. I found the following recent documentation on the ArchWiki on how to configure the systemd boot loader for multi-boot (with Arch, of course):

[url]https://wiki.archlinux.org/index.php/sy ... oaders/url]

Do any of you know of any other documentation out there I could use to supplement this article? I'm trying to do some reading up on it before the laptop arrives (in about a week). I basically want to triple boot two Ubuntu based distros (Mint, PopOS) and one Arch based distro (ArcoLinux), all with systemd installed. I may end up going back to Grub2, but I'd like to learn how to get the systemd boot process working, as the pre-installed PopOS systemd boot presents a nice bonus foundation. For better or worse, systemd seems to be a mainstay these days, so might as well learn more details about it. Any leads will be appreciated. I can't really supply many more hardware details on the new laptop until I get delivery.
Last edited by curtvaughan on Tue Aug 13, 2019 9:20 pm, edited 1 time in total.
Move from rim to hub: know the wheel.

Image

JeremyB
Level 20
Level 20
Posts: 10796
Joined: Fri Feb 21, 2014 8:17 am

Re: multi-boot with EFI systemd boot

Post by JeremyB » Mon Aug 12, 2019 5:01 pm

Systemd boot works fine for one Linux distro or dual booted with Windows in EFI. If you want a triple boot Linux in systemd boot, you may want an EFI system partition to be around 2 GB as some kernel files will have to be there from what I know of systemd boot. If POP OS is using systemd, I would snoop in /etc/kernel for the postinst.d and postrm.d folders to see what script they are using to place the kernel files in ESP when a new kernel is installed. My script is named zz-update-systemd-boot in both directories. My script is just something I modified from gisthub after reading https://blobfolio.com/2018/06/replace-g ... ntu-18-04/
Still not sure systemd boot was worth the trouble as grub2 does have options when things go wrong and the kernel files can be just in /boot folder

User avatar
thx-1138
Level 7
Level 7
Posts: 1826
Joined: Fri Mar 10, 2017 12:15 pm
Location: Athens, Greece

Re: multi-boot with EFI systemd boot

Post by thx-1138 » Tue Aug 13, 2019 4:59 am

...from the Arch wiki (that you linked)...
It should be noted that systemd-boot is only able to load the EFISTUB kernel from the EFI system partition (ESP).
................
If the ESP is not mounted to /boot, the kernel and initramfs files must be copied onto that ESP.
From JeremyB's link...
The entry configurations are easy too, but there’s a hitch:
Debian-based systems will not directly install package files to any sort of FAT partition,
but EFI won’t boot from anything other than a FAT partition.
Luckily, the solution is simple: copy your kernels from /boot to /boot/efi/ubuntu.
There’s another hitch: systemd-boot does not go out of its way to generate entry configuration files for you.
As you add or remove kernels, you’ll need to add or remove entries.
...exactly because those limitations exist under *buntu systems currently,
Pop_OS uses kernelstub as a simplified manager that automates / overcomes the above idiosyncracies,
ie. copying the initrd.img & vmlinuz under an EFI sub-directory,
& further updating the corresponding loader.conf entries if such is required.
Else, as Jeremy pointed out, you'd have to script that out yourself. That is to say...
instead of manually writing loader.conf for 3 OSes (...easy part),
& further coming up with a script to manually copy kernels under *buntu (far more complicated),
chances are that all you might need there, would be to simply install kernelstub under all 3 OSes of your choice,
and then just set it to use systemd-boot explicitly (the -m & -l flags).

Which is simple enough and should get the job done...
but it's not quite there / really flexible on the whole when dealing with multiple kernels / OSes etc.
I'd personally prefer rEFInd instead under such setups if you want to avoid grub2 explicitly.

fabien85
Level 7
Level 7
Posts: 1533
Joined: Tue Mar 11, 2014 4:30 pm

Re: multi-boot with EFI systemd boot

Post by fabien85 » Tue Aug 13, 2019 9:05 am

+1 on refind
It will also launch the EFISTUB kernel. The advantage is that it will detect kernels automatically, and you will not need to move them : refind will use a EFI driver to read the partition holding /boot and thus directly read the kernel there.
Even if you really want gummiboot, I suggest you start with refind so that you check whether booting via the kernel instead of grub works fine. Also you will then know which kernel options you may have to pass on.

curtvaughan
Level 3
Level 3
Posts: 163
Joined: Sun Dec 21, 2014 5:54 pm
Location: Austin, Tx

Re: multi-boot with EFI systemd boot

Post by curtvaughan » Tue Aug 13, 2019 8:50 pm

Thanks to all of you for your replies - this gives me some stuff to research and explore. Today I was able to use the Arch link above to enable systemd boot for a dual booted HP laptop about 3 years old. It has ArcoLinux and MX Linux on it, and was previously dual booted using grub in an EFI setting. Following the Arch link I specified above almost to the "T", I was able to set up a bootctl install and updated /boot/efi/loader/entries to point to each of the installed distributions (ArcoLinux and MX Linux). I did all of the alterations in ArcoLinux, after which I was able to get both distributions to boot. Since the laptop was already configured with EFI, it was fairly simple to switch from grub to systemd boot.

When the new laptop arrives later this week (notified today that it has shipped!), it will already be configured with PopOS systemd booted. The challenge will be to attempt to install one or two distros alongside without compromising the systemd boot setup. You guys have given me some great info and food for further thought. Looking into rEFInd is another alternative I hadn't considered. In the remote past, I've only used rEFInd to get an old MacBook Pro to dual boot between Linux Mint and the originally installed OSX. As to why I'm doing all of this - I have no particular anathema toward grub or love of systemd boot - it's mainly in the interest of gaining further practical knowledge in dealing with the newer boot loader process. None of these systems are for production (I'm retired), but being out of the business of computing, I've found a renewed interest in exploring Linux as a hobby. It's a great time for this, Linux having come such a long way since I first goofed around with it in the mid-90s. Thanks again for your support and help. I'm grateful.
Move from rim to hub: know the wheel.

Image

curtvaughan
Level 3
Level 3
Posts: 163
Joined: Sun Dec 21, 2014 5:54 pm
Location: Austin, Tx

Re: multi-boot with EFI systemd boot

Post by curtvaughan » Tue Aug 13, 2019 9:16 pm

JeremyB wrote:
Mon Aug 12, 2019 5:01 pm
... My script is named zz-update-systemd-boot in both directories. My script is just something I modified from gisthub after reading https://blobfolio.com/2018/06/replace-g ... ntu-18-04/
Still not sure systemd boot was worth the trouble as grub2 does have options when things go wrong and the kernel files can be just in /boot folder
Thanks much for the link. This is sort of what I accomplished, in more plodding fashion, by converting my HP ArcoLinux EFI grub2 to systemd boot. Need to look at the details of your script. Very helpful.
Move from rim to hub: know the wheel.

Image

fabien85
Level 7
Level 7
Posts: 1533
Joined: Tue Mar 11, 2014 4:30 pm

Re: multi-boot with EFI systemd boot

Post by fabien85 » Wed Aug 14, 2019 5:16 am

curtvaughan wrote:
Tue Aug 13, 2019 8:50 pm
The challenge will be to attempt to install one or two distros alongside without compromising the systemd boot setup.
Indeed. When you install Mint (or any Ubuntu-based distro), it will by default install grub together with it. No choice with the default installer. Sure you can then go to the boot order and put back your own boot manager first. But everytime you will have a grub update in Mint, it will put grub back first in the boot order. Which is annoying.
There are two options :
- make a default install, switch back to your own boot manager and configure it until you can boot Mint.
Then boot Mint and uninstall grub
- launch the installer with ubiquity -b
that way it will not install grub. At the end of the install you will get a message that the system wont boot since you dont have a bootloader. Ignore it, then configure your boot manager to boot Mint.

Long time ago, Linux could not boot in EFI mode (then grub allowed it, and later support was added directly in the kernel with the EFISTUB). So at that time, people were using refind (or its predecessor refit) to dual-boot on a Mac, where MacOS was in EFI mode while Linux was in Legacy/BIOS mode. Nowadays it's even simpler as you can boot Linux in EFI mode. So you can simply install Linux without bootloader, then go back to MacOS and install refind to enjoy your dual boot.

Post Reply

Return to “Installation & Boot”