I’ve been working on a new project with my newfound systemd knowledge.I want to have as many distro’s installed at once while using systemd boot.Ubuntu, Debian, and Fedora use grub by default but it’s linux right? It’s all about choice.
So I have a EFI enabled Hyper-V to play with and it’s a 64 HDD cut up like this:
sda1 100M EFI sda2 1G Linux Extended Boot sda3 4G Linux Swap sda4 15G Linux root(x86-64) sda5 15G Linux File System sda6 15G Linux File System sda7 13.9G Linux Home
I install arch linux with systemd-boot per usual and get a booting system off sda4
I then mount /dev/sda5 to /var/lib/machines/ubuntuand install:
pacman -S debootstrap ubuntu-keyring
this lets me run:
debootstrap --include=systemd-container --components=main,multiverse,universe focal /var/lib/machines/ubuntu http://archive.ubuntu.com/ubuntu
Which will install a base Ubuntu 20.04 filesystem to the other partition. I can actually run a whole container instance with systemd and this partition.
systemd-nspawn -b -D /var/lib/machines/ubuntu
Systemd has a whole management suite with machinectl
machinectl status ubuntu
The problem I’ve run into is when I make a container like this I cannot mount the file system. Or at least not as easily. What I end up doing is copying any files from /dev/sda5 to the other partition while the container is not running.
But! when I am in the ubuntu container I can run:
apt install linux-image grub-pc-
That will give me the ubuntu kernel and initramfs without installing grub.
I copy the kernel related files to the systemd XBOOTLDR partition and write a boot config file and BOOM it actually lets me boot both arch and ubuntu from the bootloader and it will use the right HDD partition.
I have more to do to actually get it working nice, and fedora will probably be its own undertaking but I’m really excited about it! Learning a lot about how linux actually boots, it’s no longer really “Black Magic” anymore. Basically any package manager has an “install root” function so it’s really knowing how to use each of them.
One thought on “Linux Multi Boot with Systemd-boot”
Great work! This is the type of info that should be
shared across the net. Disgrace on Google for not positioning this submit higher!
Come on over and seek advice from my site . Thanks =)
my web page; Royal CBD