anatol / booster

Fast and secure initramfs generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

systemd-boot now can default to `/efi` as the folder for initramfs images. How does booster cope with that?

enihcam opened this issue · comments

I'm asking this question because I see some hardcoded /boot in booster codebase, so the logic will fail in this case, according to https://www.freedesktop.org/software/systemd/man/systemd-gpt-auto-generator.html

The ESP is mounted to /boot/ if that directory exists and is not used for XBOOTLDR, and otherwise to /efi/.

Here is my root directory layout. As you can see there is no /boot

~ $ ls -l /
total 16K
lrwxrwxrwx   1 root root    7 Sep 18 21:18 bin -> usr/bin/
drwxr-xr-x  11 root root 2.6K Sep 28 10:20 dev/
drwxr-xr-x   2 root root    0 Sep 28 10:20 efi/
drwxr-xr-x   1 root root 2.0K Sep 28 10:07 etc/
drwxr-xr-x   1 root root    8 Apr  6  2017 home/
lrwxrwxrwx   1 root root    7 Sep 18 21:18 lib -> usr/lib/
lrwxrwxrwx   1 root root    7 Sep 18 21:18 lib64 -> usr/lib/
drwxr-xr-x   1 root root    0 May  2 10:15 mnt/
drwxr-xr-x   1 root root    0 Mar 27  2017 opt/
dr-xr-xr-x 140 root root    0 Sep 28 10:20 proc/
drwxr-x---   1 root root  138 Sep 28 10:24 root/
drwxr-xr-x  16 root root  460 Sep 28 10:24 run/
lrwxrwxrwx   1 root root    7 Sep 18 21:18 sbin -> usr/bin/
drwxr-xr-x   1 root root   14 Mar 27  2017 srv/
dr-xr-xr-x  11 root root    0 Sep 28 10:20 sys/
drwxrwxrwt   8 root root  160 Sep 28 10:26 tmp/
drwxr-xr-x   1 root root   80 Sep 28 09:55 usr/
drwxr-xr-x   1 root root  116 Sep 28 10:07 var/

So, instead of ad-hoc script, I thought an elegant way to copy initramfs artifacts over to $BOOT directory is to use systemd-kernel-install

An example would be:
https://gitlab.com/dalto.8/kernel-install-for-dracut

What do you think?

For more details regarding to /efi:
https://www.freedesktop.org/software/systemd/man/systemd-boot.html

However, dracut fixed this already as an alternative solution, so maybe you can take the following code as a reference?
dracutdevs/dracut@093bc9b
dracutdevs/dracut@49ea6c4

On Arch Linux, Booster provides a shell script that puts the initramfs image at /boot. The shell script does not currently accommodate this which (should) cause the image to not be built. As a result, since there's no image, this implies that the bootloader wouldn't find it.

As a workaround, you would have to manually build and specify the appropriate path

On Arch Linux, Booster provides a shell script that puts the initramfs image at /boot. The shell script does not currently accommodate this which (should) cause the image to not be built. As a result, since there's no image, this implies that the bootloader wouldn't find it.

As a workaround, you would have to manually build and specify the appropriate path

right, that's the problem. as a workaround, i manually replaced /boot with /efi. hopefully there'll be a more elegant approach to resolve this.

@enihcam To follow up, is there any specific reason why you do not have a /boot directory? I understand the case where one can have both /boot and /efi but not only /efi.

This is an Arch Linux script so the default boot path for initramfs images and other components is /boot. If going by mkinitcpio and assuming you have only 1 ESP partition, /efi seems to be only reserved for UKIs which (should) require the user to adjust the new mount point of the ESP to /efi, leaving boot files like the kernel/microcode/initramfs residing within the root partition.

I understand that there are cases for other ESP mount points, but what's yours specifically?

commented

@enihcam To follow up, is there any specific reason why you do not have a /boot directory? I understand the case where one can have both /boot and /efi but not only /efi.

This is an Arch Linux script so the default boot path for initramfs images and other components is /boot. If going by mkinitcpio and assuming you have only 1 ESP partition, /efi seems to be only reserved for UKIs which (should) require the user to adjust the new mount point of the ESP to /efi, leaving boot files like the kernel/microcode/initramfs residing within the root partition.

I understand that there are cases for other ESP mount points, but what's yours specifically?

i don't really care what the directory be named. also, i'd have to manually write into /etc/fstab to enable mount of /boot. same thing, i'd have to manually tweak systemd to disable /efi. :)

I cannot remember which, either grub, arch's mkinitcpio, or dracut (but I think one of the first two) has some functionality hard-coded to /boot. So I went with that, but I've found that even creating /efi causes systemd to enable efi.automount, which does as it's named. It didn't cause issues on my machine but could others. I can't remember what created /efi, but I removed it and everything works fine.

This is outside the scope of the issue, but relevant -- @anatol , is compatibility with systemd's kernel-install & systemd-ukify something that you'd want? If so, I have written a plugin script for booster to work in this context & could send a PR for you to look at. No worries if not!