Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

cole-h
Copy link

@cole-h cole-h commented Oct 15, 2025

Some parts of systemd, such as the systemd-gpt-auto-generator, rely on the efivarfs kernel module being loaded. However, some kernels don't compile it in, so we need to load it as early as possible to facilitate things in the initrd that run early like generators

@github-actions github-actions bot added the please-review PR is ready for (re-)review by a maintainer label Oct 15, 2025

/* This one we need to load explictly, since auto-loading would happen too late for generators
* like systemd-gpt-auto-generator to read the EFI vars. */
// FIXME: should warn_if_unavailable be `is_efi_boot()` or always `true` or always `false`?
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Just want to draw attention to this question)

/* This one we need to load explictly, since auto-loading would happen too late for generators
* like systemd-gpt-auto-generator to read the EFI vars. */
// FIXME: should warn_if_unavailable be `is_efi_boot()` or always `true` or always `false`?
{ "efivarfs", NULL, true, false, is_efi_boot },
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I didn't guard this inside #if HAVE_EFI since is_efi_boot always returns false if HAVE_EFI is not defined, but that's a trivial change I could make.

@cole-h cole-h force-pushed the systemd-early-load-efivarfs-module branch from 3b62eba to ca06c35 Compare October 15, 2025 20:48
Some parts of systemd, such as the systemd-gpt-auto-generator, rely on
the efivarfs kernel module being loaded. However, some kernels don't
compile it in, so we need to load it as early as possible to facilitate
things in the initrd that run early like generators
@cole-h cole-h force-pushed the systemd-early-load-efivarfs-module branch from ca06c35 to befef56 Compare October 15, 2025 21:03
Copy link
Member

@YHNdnzj YHNdnzj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, shouldn't this be loaded in mount_setup()? We mount efivarfs as part of the API vfs setup, prior to generator run, hence I don't see how the situation you're describing can happen? Can you elaborate?

@YHNdnzj YHNdnzj added pid1 needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer labels Oct 15, 2025
@poettering
Copy link
Member

let's take a step back on this. why in heaven would sombody compile a kernel without this built-in?

which distro is this?

@poettering poettering removed the please-review PR is ready for (re-)review by a maintainer label Oct 16, 2025
@arvidjaar
Copy link
Contributor

why in heaven would sombody compile a kernel without this built-in?

Because legacy systems still exist. There is life beyond EFI.

which distro is this?

SUSE

@poettering
Copy link
Member

So you penalize the common, odern case, in order to optimize the uncommon legacy case by a tiny tiny bit? Sorry, but that's not precisely good engineering.

and why does this pop up in 2025 for the first time? does suse have a new project of making the system boot slower, and creating artifical churn so they figured out they could turn this into a module?

The list is a list that would ideally not exist. I am not convinced we should add anything to it unless a very good case can be presented. I don't think this here qualifies.

@YHNdnzj
Copy link
Member

YHNdnzj commented Oct 16, 2025

@cole-h are you on NixOS? The fact that it is a module is a bit of a hassle, but everything should still work with kernel actively forking off modprobe to load the fs driver. I guess NixOS broke this, and that's something you'll need to look into.

@cole-h
Copy link
Author

cole-h commented Oct 16, 2025

TL;DR: Make sure /sbin/modprobe (or whatever CONFIG_MODPROBE_PATH is set to in your kernel config) exists in the initrd 🤦


@YHNdnzj Thanks so much for the hint, this is so embarrassing 😅

Sorry for wasting everyone's time -- the REAL issue was that I was creating a custom initrd, the default modprobe (according to cat /proc/sys/kernel/modprobe) is expected at /sbin/modprobe, but I didn't put the modprobe binary there.

I was naively trying to configure this with a sysctl.d/ file that changed the location to where it really is, but now that I think about it, this would have happened way too late for mount_setup() to be able to mount efivarfs (I don't know the exact lifecycle, but I can easily imagine that mount_setup() is called much before systemd-sysctl.service has a chance to run).

Again, sorry for the noise 🙇‍♂️

@cole-h cole-h closed this Oct 16, 2025
@cole-h cole-h deleted the systemd-early-load-efivarfs-module branch October 16, 2025 18:09
@github-actions github-actions bot removed needs-discussion 🤔 needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer labels Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.