Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
enihcam opened this issue Sep 28, 2023 · 7 comments

Comments

@enihcam
Copy link

enihcam commented Sep 28, 2023

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

@enihcam
Copy link
Author

enihcam commented Sep 28, 2023

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

@enihcam enihcam changed the title systemd-boot now defaults /efi as the folder for initramfs images instead of /boot. How does booster cope with that? systemd-boot now can default to /efi as the folder for initramfs images. How does booster cope with that? Sep 28, 2023
@c3Ls1US
Copy link
Contributor

c3Ls1US commented Sep 28, 2023

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

@enihcam
Copy link
Author

enihcam commented Sep 29, 2023

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.

c3Ls1US added a commit to c3Ls1US/booster that referenced this issue Sep 29, 2023
Fixes anatol#246

In Arch Linux, we currently build and install the initramfs/kernel at /boot and assume that's the layout of the users' system. However, if /boot does not exists then the script will fail, thus leaving it up to the user to build the image and install at a boot path like /efi manually.
@c3Ls1US
Copy link
Contributor

c3Ls1US commented Oct 5, 2023

@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?

@enihcam
Copy link
Author

enihcam commented Oct 6, 2023

@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. :)

@kjkent
Copy link

kjkent commented Jun 19, 2024

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!

@lpnh
Copy link

lpnh commented Jul 26, 2024

edit: Sorry about the previous comment. Changing the default path was no longer necessary after setting up the kernel-install + systemd-ukify + pacman-hook-kernel-install.


I understand using /boot as the default path, but I think it would be nice to have a solution that doesn't require manually editing the scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants