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

auto detect root device according to Discoverable Partitions Specification (DPS) (boot without root= and without /etc/fstab) #2590

Open
adrelanos opened this issue Dec 17, 2023 · 6 comments
Labels
enhancement Issue adding new functionality

Comments

@adrelanos
Copy link

By supporting the Discoverable Partitions Specification (DPS) the following things would be possible:

  • booting without the root device (root=) on the kernel command line, and
  • without /etc/fstab.

The benefit for the user would be that corner cases such as changed disk uuids after backup/restore no longer result in a broken boot with a dracut rescue shell.

It could also simplify operating system build scripts and installers.

DPS is also supported by systemd-boot.

history:

related but non-duplicate:

@adrelanos adrelanos added the enhancement Issue adding new functionality label Dec 17, 2023
@LaszloGombos
Copy link
Collaborator

Thanks for raising this issue.

DPS is also supported by systemd-boot.

Do you have a pointer for this for more information ?

I understand that dracut is not only used with systemd-boot, but it would be great to understand what is the current situation with systemd-boot regardless.

If systemd-boot already discovers partitions, wouldn't systemd-boot already correctly set the root= command line argument ?

@adrelanos
Copy link
Author

My knowledge on systemd-boot is limited to curiosity, preliminary research.

https://www.freedesktop.org/software/systemd/man/latest/systemd-boot.html mentions Boot Loader Specification ~6 times.

systemd-stub(7) may be used as UEFI boot stub for executed kernels, which is useful to show graphical boot splashes before transitioning into the Linux world. It is also capable of automatically picking up auxiliary credential files (for boot parameterization) and system extension images, as companion files to the booted kernel images.

Quote DPS:

The OS can discover and mount the necessary file systems with a non-existent or incomplete /etc/fstab file and without the root= kernel command line option.

The root= parameter passed to the kernel by the boot loader may be omitted if the root partition is the first one on the disk of its type. If the root partition is not the first one on the disk, the root= parameter must be passed to the kernel by the boot loader.

Quote https://wiki.archlinux.org/title/systemd-boot

options – space-separated command line options to pass to the EFI program or kernel parameters. Optional, but you will need at least root=dev rw if booting Linux where dev is a block device specifier for the root (/) volume. See persistent block device naming for more information. This parameter can be omitted if the root partition is assigned the correct Root Partition Type GUID as defined in Discoverable Partitions Specification and if the systemd mkinitcpio hook is present.

From that I take that systemd-boot might but will not necessarily pass root= to the kernel / initrd.

Therefore I conclude, if dracut wanted to be compatible with DPS it would need to support boot without root= (and probably also without /etc/fstab).

systemd-boot isn't signed yet for compatibility with Secure Boot... Or is it?

@paravoid
Copy link

@adrelanos what is it that does not work for you right now? In Debian, with dracut 060+5-1, I can boot without root=, with both GRUB2 and systemd-boot. I admit I've only superficially tested this, so perhaps you ran into a problem that I haven't?

@adrelanos
Copy link
Author

I had no idea that dracut works with systemd-boot and can boot without root=. Is this documented? I haven't tested that yet.

@LaszloGombos
Copy link
Collaborator

LaszloGombos commented Feb 1, 2024

According to https://github.com/dracutdevs/dracut/blob/master/modules.d/99base/init.sh#L129 root= argument is mandatory (when systemd is not used). At very least this is inconsistent.

@paravoid can you perhaps share more about your setup ? What is the value of /proc/cmdline ? Is the root perhaps set in the kernel itself CONFIG_CMDLINE

Would be useful to understand in what conditions this works.

@LaszloGombos
Copy link
Collaborator

LaszloGombos commented Feb 10, 2024

The decision of what to mount in the Linux kernel has to be made before it examines the initramfs contents, so root= is used to signal "we are not keeping this initramfs" because that's literally what root= means.

It seems it is expected that root= is not discovered by initramfs, but instead it should be discovered by the firmware or the bootloader before dracut even has a chance to run, so i think this idea is out of scope for dracut.

If root= is not specified, the expectation is that there is no transition to actual rootfs from initramfs - which is a thing that some distributions do - for example http://tinycorelinux.net

Therefore I conclude, if dracut wanted to be compatible with DPS it would need to support boot without root=

without root= or root= with an empty arguments are two very different distinct cases. Please be mindful of that. See for the exact language - https://www.freedesktop.org/software/systemd/man/latest/systemd-gpt-auto-generator.html

root= with an empty argument is the same as root=gpt-auto

missing root= means "we are not keeping this initramfs"

If we want to keep this discussion going, we should probably restate the problem to 'handle root=gpt-auto' in dracut.

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

No branches or pull requests

3 participants