Dual-boot with systemd-boot fails only at one system

Hello everyone,

I am having troubles dual booting my system.

Goal: Two separate Linux systems on one drive, using same boot and swap partition. One is for aimed for my work and one for me privately.

What I did: Created the partitions with an GPT partition table, boot, swap, root-work, root-private and one home partition (only for root-private). Installed Manjaro (i3wm edition) on both root partitions separately, successfully.
Installed systemd-boot. All necessary files (vmlinuz, initramfs) are in /boot. Created two entries in /boot/loader/entries/system1.conf and system2.conf with the PARTUUID from blkid.

Problem: system1 boots without problems, but when I try to boot system2 (via the menu form systemd-boot during startup) it tells me:

[FAILED] Failed to mount /boot.
See ‘systemctl status boot.mount’ for details.
[FAILED] Dependency failed for Local File Systems.

At the bottom is a “emergency console” but it wont let me log in (no response whatsoever). I can only hard shut down.

I also checked the partition with fsck.ext4, but no problems reported.

The strange thing (in my point of view) is that one system works and one doesn’t, while both should be the same (manjaro) and both have “same” boot and /etc/fstab entries (except PARTUUID information of course).

Any suggestions, ideas, help?

Thanks a lot

What do you mean by using same boot partition?

Post disk layout, fstab, content of those systemX.conf entries, etc.

When using systemd boot the kernel is placed on the $esp partition. This requires a separation of kernel images and init.

When booting two Manjaro systems - I recommend using a custom package to handle the kernel installation.

One such package kernel-install-mkinitcpio is created by @dalto over at EndeavourOS forum - along with a guide - and this work equally good at Manjaro.

Wouldn’t it just be a lot easier to simply add a second user instead?

1 Like

For this layout you need to mount different partitions as /boot, or like i do “bind-mount” a subdir of the $ESP as /boot :wink:

  1. Mount the $ESP at /efi
  2. Bind-mount fe. /efi/system1 as /boot for booting “system1”
    Bind-mount fe. /efi/system2 as /boot for booting “system2”

See another post of mine on that topic:

That way systemd-boot is able to find the kernel etc inside $ESP/system1 and $ESP/system2 respectively.
You need to point to those locations in the boot-loader-configs ofcourse.

You need to have separate / (root) filesystems if you want to use different Linux distros.
You can’t use the same partition because they are configured differently in many configurations and binaries…
Except if you use different sub-volumes inside a BTRFS ofcourse, in which case each /(root) filesystem needs to be in it’s own sub-volume.


So to recap, you need:

  1. One $ESP partition to hold systemd-boot and different kernels/etc.
  2. One swap partition, this can be shared because your operating systems don’t run at same time.
  3. Two or more root filesystems, one for each of the specific Linux distro/version.
  4. One home partition, this could be shared, but ofcourse depends heavily on the Desktop kind you use, which needs to be same on all the Linux versions you use to boot.

I totally agree with that suggestion, and is most likely a far better choice for his intended usage :+1:

@stl8vgl3, Linux is by design meant for more as one user at the same time, unlike M$ :slight_smile:
You could have thousands of different users on the same machine, all with their own config/documents/etc.
They could even all work at same time, using different terminals (RDP) while using the same single hardware as the server running their stuff :wink:

1 Like

By same boot partition I mean 1 EFI partition that both systems would mount via /etc/fstab

Disk Layout (lsblk):

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme0n1 259:0 0 931,5G 0 disk
├─nvme0n1p1 259:1 0 512M 0 part /boot
├─nvme0n1p2 259:2 0 34,4G 0 part
├─nvme0n1p3 259:3 0 8G 0 part [SWAP]
├─nvme0n1p4 259:4 0 97,7G 0 part /
└─nvme0n1p5 259:5 0 741,1G 0 part

partition 5 is supposed to be /home.

fstab of system1:

# <file system> <mount point> <type> <options> <dump> <pass>
PARTUUID=b5bfc9e1-8305-4783-97af-6235d6ee5784 /boot vfat umask=0077 0 2
PARTUUID=20b6e326-7774-4383-bc90-ff72633def4c / ext4 defaults,noatime 0 1
PARTUUID=36e3f725-e84e-4638-b390-335661a3c1e2 none swap defaults 0 0

fstab of system2:

# <file system> <mount point> <type> <options> <dump> <pass>
PARTUUID=b5bfc9e1-8305-4783-97af-6235d6ee5784 /boot vfat umask=0077 0 2
PARTUUID=20b6e326-7774-4383-bc90-ff72633def4c / ext4 defaults,noatime 0 1
PARTUUID=0f81807b-eb5a-4411-8b25-50b1ebda8663 /home ext4 defaults,noatime 0 2
PARTUUID=36e3f725-e84e-4638-b390-335661a3c1e2 none swap defaults 0 0

systemd-boot entries:

title System1
linux /vmlinuz-5.10-x86_64
initrd /initramfs-5.10-x86_64.img
options root=PARTUUID=7eb75eb5-aa11-444f-a9c4-175368d14897 rw

title System2
linux /vmlinuz-5.10-x86_64
initrd /initramfs-5.10-x86_64.img
options root=PARTUUID=66b35c7a-8d09-43d0-b7e1-e5e629131af1 rw

I don’t see how this will work. You will run the same kernel and same initramfs for both distros? And what will happen when you update one instance?

Granted, it should work at least in the beginning. :stuck_out_tongue:

1 Like

This info would have been much more followable if you edit it and replace with the output of lsblk --fs or similar that shows both the partition type and filesystems on them plus the UUIDs you use.
I’m replying on the go and don’t remember the exact flags for that output, so check the man page of it

Plus I can’t spot where you Mount the $ESP
Oh wait you mount it on /boot :woman_facepalming:

I did however notice that you use different PARTUUIDs for the root Mount point in your fstab entries compared to the ones you provide as kernel options…

All in all, it looks like you just have identical systems you boot, with only difference that one does not mount the home partition.
This is like reaching your left ear using your right arm over your head…
Totally unnecessary and far better solved by creating an extra user account on one system.

I was also wandering about that PARTUUIDs in fstab. I have not found the Partition with the corresponding PARTUUID. But system1 boots, so I am not going to change that.

I have tried and changed the fstab of system2 (which doesn’t boot) though, to match the partition and the boot entry. Without any success.

I want separate systems, because I don’t want games installed on my work system and I don’t want the software for working installed on my private on (including licenses and stuff). As I am using root quite some time on both systems, adding users doesn’t solve this problem.

I mean, I also use same swap for both systems?! What does it matter if I use the same kernel. The are not booted simultaneously anyways.

As for updates, no problem keeping a backup of /boot and copying the “old” kernel in to boot the other system and updated it as well. Given I get it to work.

Unless you use hibernation the swap partition is a swap partition and it can be shared with any system.

It matters because the kernel modules may not - likely does not - match on the binary level.

And if one system is updated, the modules of the other system may not match the kernel any more :wink:

You are still using same system, no matter if it is a different partition or not its all same hardware :wink:

But no offense but if you believe you know better as all of us, and don’t want to follow provided info, then well what else can i say but:
:vulcan_salute:
HF & GL :wink:

Perhaps post

bootctl

from both systems. Chroot in second one.

I would still advise against doing what you want to do though. You think you’ll somehow have less work and be less prone to errors when it will be exactly opposite - instead of problems with one system you’ll have problems with both systems caused by one of them. In fact, that’s already the case right now.

If you insist on doing it the hard way:

  1. Format the drive into two separate partitions as this WILL solve a multitude of problems.
  2. Install the OS as separate installations in each.
  3. Call one WORK and the other PLAY, or your choice of title
  4. Give both of them the same passwords, to make your life easier and boot into either as necessary. To change you’re going to need to reboot to close one to use the other.
    This does mean that you will have 2 separate OS’s to maintain, but it’s far easier to get this to work than the abomination you’re trying.

It is possible to achieve what you want using systemd boot and create loader folders using the machine-id

cat /etc/machine-id

You could also achieve this by using BIOS/GPT - which of course rules out systemd boot and force you to use GRUB.

Mogrify to use BIOS/GPT and GRUB

To mogrify your system to BIOS/GPT without reinstalling any of the systems.

  1. Disable EFI - to ensure BIOS boot
  2. Boot a live ISO

Your partition layout indicates

$esp on p1

delete the partition

sgdisk --delete=1 /dev/nvme0n1

create a new partition

sgdisk --new=1::+32M --typecode 1:ef02 --change-name 1:"BIOS boot partition" /dev/nvme0n1

do not create any filesystem on the partition

$system-a on p2

Mount the partition and change root

mount /dev/nvme0n1p2 /mnt
chroot /mnt /bin/bash

Ensure the system is fully up-to-date and mogrify your system to use grub

pacman-mirrors --continent
pacman -Syyu grub

edit fstab and comment the previous boot mount

nano /etc/fstab
#UUID=XXXX-YYYY                            /boot      vfat    umask=0077 0 2

Edit your default grub file and modify below variables

nano /etc/default/grub
[...]
GRUB_DISTRIBUTOR="Manjaro system-a"
[...]
GRUB_DISABLE_OS_PROBER=false
[...]

Then run grub-install and rebuild the grub.cfg

grub-install --target=i386-pc --recheck --boot-directory=/boot /dev/nvme0n1
grub-mkconfig -o /boot/grub/grub.cfg

Exit the root and unmount the partition

exit
umount /mnt

$system-b on p4

The process is almost identical to system-a

except the target partition - mount the p4 partition instead

mount /dev/nvme0n1p4 /mnt

and the distributor id the default grub

[...]
GRUB_DISTRIBUTOR="Manjaro system-b"
[...]

Result

The result is an effective separation of the two systems - that is - no kernel clash/interference due to shared /boot

Whatever you think I am trying, but I do have separate partitions already, ever have had.

Thank you very much. This seems to do it.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.