You are not logged in.

#1 2016-02-21 08:40:49

STREBLO
Member
Registered: 2015-02-15
Posts: 135

Multiple Booting Arch With Share /boot partition

I'm trying to boot multiple different installs using systemd-boot and I want to share a boot partition between them.

Currently I have tried to set it up with a /boot/installs directory where I put different kernels and images but I'm having trouble with how the files will be updated. What would be the best way to do this so that when there are updates everything gets put in the right place?

I found multiple examples in the wiki of how to move your kernel images after an update but they seem to need the original kernels to stay in the original place and just be copied. Can I not move them so there is nothing in the original /boot directory and everything is just in the sub directories of my installs? When I tried that I would get:

sudo mkinitcpio -p linux                                                       
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/installs/Butters/initramfs-linux.img
==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-linux'
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/installs/Butters/initramfs-linux-fallback.img -S autodetect
==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-linux'

Is there a better way to do this?

Offline

#2 2016-02-21 09:29:23

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: Multiple Booting Arch With Share /boot partition

You need to know what your real goal is. The simplest solution would be to use refind instead of systemd boot. It can read kernels from other partitions that the one it is booted. It has even drivers to read partitions with the most common filesystems (ext{2,3,4}, etc...). You can thus have a partition for every instance of arch you want to boot containing everything, including /boot. Here is an example of refind.conf:

timeout 5
scanfor manual
textonly true
textmode 1024
showtools shell, memtest, gdisk, apple_recovery, mok_tool, shutdown, reboot, firmware
default_selection ArchLinux

menuentry "ArchLinux" {
volume <GUID of the partition containig /boot>
loader /boot/vmlinuz-linux
options "root=UUID=xxxxxxxxxxxxxxxx ipv6.disable=1 rw initrd=/boot/intel-ucode.img initrd=/boot/initramfs-linux.img"
}

If you absolutely want to use systemd boot with all the kernels inside the EFI partition; you can create several directories, say /archlinux-1 /archlinux-2, etc... inside it. Then bind mount the /boot partition correctly. Here is an fstab example for archlinux-1 (replace it with archlinux-2, etc... in the other installations).

UUID=<uuid of the efi filesystem> /mnt/efi vfat 0 0
/mnt/efi/archlinux-1 /boot none bind 0 0

Alternatively, you can replace /boot by a symlink that point to the correct directory inside the efi partition (also untested).

Last edited by olive (2016-02-21 09:37:37)

Offline

#3 2016-02-21 10:27:35

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: Multiple Booting Arch With Share /boot partition

olive wrote:

you can replace /boot by a symlink that point to the correct directory inside the efi partition

The FAT filesystem does not support symlinks.

+1 for bind mounts.

See https://wiki.archlinux.org/index.php/EF … bind_mount

Offline

#4 2016-02-21 16:14:42

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: Multiple Booting Arch With Share /boot partition

Head_on_a_Stick wrote:

The FAT filesystem does not support symlinks.

That's right but you can define a symlink inside your root partition that point to a directory in a FAT file system.

/boot -> /mnt/efi/archlinx-1

This is allowed, the symlink does not reside in the FAT filesystem.

Last edited by olive (2016-02-21 19:32:09)

Offline

#5 2016-02-22 01:14:55

STREBLO
Member
Registered: 2015-02-15
Posts: 135

Re: Multiple Booting Arch With Share /boot partition

Interesting... Sounds like bind mounts are the way to go... I guess I was over complicating things trying to move everything around. I'll try bind mounts and hopefully that works, otherwise I guess I'll try refind however I really don't like using it.

Offline

#6 2016-02-23 01:13:18

STREBLO
Member
Registered: 2015-02-15
Posts: 135

Re: Multiple Booting Arch With Share /boot partition

I was about to try this and then I thought of something. If I were to bind mount every different EFI directory depending on what I boot, wouldn't I have to install systemd-boot to every single directory? I kind of wanted to have systemd boot installed to the boot partition with directories under it, so that I could use to single install of system to boot . Am I not understanding what you guys are saying?

Offline

#7 2016-02-23 08:15:12

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: Multiple Booting Arch With Share /boot partition

When systemd boot, it is sees the efi partition as /. Inside your installations, bind-mounting /boot would just mean that /boot is another way to see /mnt/efi/archlinux-1 (see my previous post). So as seen as in archlinux-1; you would have:

/mnt/efi if the mounted efi partition
/mnt/efi/archlinux-1 is where the kernels and initrd of the first installations would end up.
/mnt/efi/archlinux-1/vmlinuz-linux is the kernel as seen by your installation.
/archlinux-1 is the path of the previous directory with the efi partition as / , as seen by systemd when it boots
/archlinux-1/vmlinuz-linux is the parth of the kernel as seen by systemd-boot when it boots
/boot is an alternative way to see  /mnt/efi/archlinux-1, somewhat similar to a symlink (by the way you can use a real symlink and forget bind mounting if you want).
/boot/vmlinuz-linux is just an alternative way to see /mnt/efi/archlinux-1/vmlinuz-linux, because /boot/vmlinuz-linux is where the kernel end up by default, it would just end up in the right place without having to be moved.

You can install systemd-boot where you want, for example in /mnt/efi/systemd-boot; of course you can only have one. You have to mention the path of each kernel and initrd as documented above. Note that according to the wiki, some utilities (bootctl, systemd-efi-boot-generator) assume that /boot is the mounted efi partition. This wouldn't be the case in this configuration. bootctl seems to support a --path option, so you can use it with --path=/mnt/efi (the mounted efi partition is /mnt/efi); I don't know about systemd-efi-boot-generator but I think you will need to write boot entries manually anyway. These automated tools generally work only for the most simple installation (on single Linux installation installed in the most standard way).

Last edited by olive (2016-02-23 08:33:28)

Offline

#8 2016-02-23 21:42:47

STREBLO
Member
Registered: 2015-02-15
Posts: 135

Re: Multiple Booting Arch With Share /boot partition

Ok, i think i get it. mount my boot partition with a sub directory holding systemd boot, another holding the kernels, and symlink/bind mount tĥe right install to boot? So, even though arch wont be booted yet it will  still respect symlinks?

Offline

#9 2016-02-23 22:01:29

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: Multiple Booting Arch With Share /boot partition

STREBLO wrote:

Ok, i think i get it. mount my boot partition with a sub directory holding systemd boot, another holding the kernels, and symlink/bind mount tĥe right install to boot? So, even though arch wont be booted yet it will  still respect symlinks?

The symlinks (or bind-mount) is just so that when the installed system want to put something in /boot (typically when you update the kernel), it end up in the correct place, namely /mnt/efi/archlinux-1. I don't really understand what you mean by your last sentence.

Offline

#10 2016-02-24 01:04:12

STREBLO
Member
Registered: 2015-02-15
Posts: 135

Re: Multiple Booting Arch With Share /boot partition

olive wrote:
STREBLO wrote:

Ok, i think i get it. mount my boot partition with a sub directory holding systemd boot, another holding the kernels, and symlink/bind mount tĥe right install to boot? So, even though arch wont be booted yet it will  still respect symlinks?

The symlinks (or bind-mount) is just so that when the installed system want to put something in /boot (typically when you update the kernel), it end up in the correct place, namely /mnt/efi/archlinux-1. I don't really understand what you mean by your last sentence.

Right, disregard that last sentance, I was thinking the symlink was going to be booted off, but of course that isn't what it's for..

Offline

Board footer

Powered by FluxBB