Skip to content

RFE: Udev /dev/disk/by-purpose symlinks #18035

Closed

Description

@grawity

Is your feature request related to a problem? Please describe.

This is related to the mailing list thread "Mount options for ESP, LUKS and rootfs in automatic partition discovery and mounting".

Describe the solution you'd like

Make udev create /dev/disk/by-purpose symlinks to partitions using the existing GPT partition discovery logic. For example, the EFI System Partition would be /dev/disk/by-purpose/efi-system and it could be used in a fstab entry like this:

/dev/disk/by-purpose/efi-system  /efi  vfat  rw,fmask=0133,dmask=022,flush  0  1

This would allow the sysadmin to use the regular /etc/fstab (or .mount units) to configure mount options for auto-detected partitions, without having to add a separate config file specifically for gpt-generator, and without having to hardcode the specific "by-uuid" name.

(I don't think it would be useful to have generic "by-parttypeuuid" symlinks, as there could be e.g. multiple EFI System Partitions on a machine and there would be no way to mount the "current" one, whereas I imagine that "by-purpose/efi-system" should always point to the one that was currently used for booting.)

Describe alternatives you've considered

There were suggestions to add a kernel parameter or a dedicated config file for systemd-gpt-generator, but I don't like bloating the kernel command-line with things that would be easier to manage in /etc. And when it comes to mount options, we already suggest using /etc/fstab for things like /proc and even the rootfs (via systemd-remount-fs).

Activity

  1. added
    RFE 🎁
    on Dec 21, 2020
  2. cmurf commented on Dec 24, 2020

    @cmurf
    Contributor

    Whether this belongs in systemd proper, or just for deconfliction with coreos/bootupd project...

    What about the multiple EFI System partition case? Both ESP's have the same "by-purpose" so how would or should that be handled? The bootupd preliminary idea is to just stop doing mdraid, and firmware raid, and have a server sync all instances of the ESP with a canonical source. And it's also responsible for setting NVRAM boot entries and order, so that the firmware can do the proper fall back.

  3. grawity commented on Dec 24, 2020

    @grawity
    ContributorAuthor

    What about the multiple EFI System partition case? Both ESP's have the same "by-purpose" so how would or should that be handled?

    I don't think it should be handled in any special way.

    The idea of this RFE is that they would be handled exactly the same as they're currently handled by the already existing code in systemd-gpt-auto-generator. Currently it has to choose one ESP to auto-mount at /efi or /boot; this would follow the same logic. (Even if you have multiple clones of the ESP, the firmware still picks a specific one to boot from.)

    Systems which use bootupd to manage multiple ESPs would simply ignore this new symlink like they currently ignore the gpt-generator; I assume they would want to mount the canonical partition by its UUID anyway.

  4. poettering commented on Dec 25, 2020

    @poettering
    Member

    What about the multiple EFI System partition case?

    We only automount the ESP if the boot loader told us which one was used to boot, and ignore all others.

    Both ESP's have the same "by-purpose" so how would or should that be handled? The bootupd preliminary idea is to just stop doing mdraid, and firmware raid, and have a server sync all instances of the ESP with a canonical source. And it's also responsible for setting NVRAM boot entries and order, so that the firmware can do the proper fall back.

    I am sorry, but you want ESP on RAID? That's a broken setup. People should get out of their head that that could ever work. Firmware fs drivers support writing and do not support raid, hence any write access will fuck up the raid. (And boot loaders write to it, for automatic boot counting/assessment)

    The UEFI people have not defined RAID-backed ESP as something that is part of the spec, and hence it just doesn't work in the general case. If you put RAID into something it's supposed to improve reliability, but if the layer that is the primary user of the RAID storae doesn't actually care about RAID then it will improve fragility, nothing else.

    Really, forget about having RAID-backed ESP. it's nonsense.

  5. cmurf commented on Dec 25, 2020

    @cmurf
    Contributor

    We only automount the ESP if the boot loader told us which one was used to boot, and ignore all others.

    Is the proper way to inhibit automount to create an fstab entry with noauto? Is there a non-fstab way to inhibit the automounting of the ESP? What if the bootloader doesn't tell you whicih one was used to boot? (I don't know if GRUB does that.)

    I am sorry, but you want ESP on RAID?

    I don't, but it already exists. Sysadmins do it, distros do it, the idea keeps coming up. I want bootupd to manage syncing multiple ESP, instead of using mdraid - for exaclty the reasons you mention.

  6. added a commit that references this issue on Apr 3, 2025
    3777c6e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFE 🎁gpt-auto

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions