Add efi variable to augment /proc/cmdline#13246
Conversation
6c4f40a to
1ab24a5
Compare
|
It seems that the first patch for cg_unified_flush()/cg_unified_update() is wrong. |
1ab24a5 to
8a0d887
Compare
|
I reworked the first patch. It passes on its own, so the rest should now pass too. |
|
Regarding |
src/basic/efivars.c
Outdated
| return 0; | ||
| } | ||
|
|
||
| r = efi_get_variable_string(EFI_VENDOR_LOADER, "SystemdOptions", line); |
There was a problem hiding this comment.
hmm, shouldn't this maybe something the loader appends, not userspace?
i mean, in particular as you put this in the loader UEFI UUID namespace?
The capitalization of "SystemdOptions" is a bit weird...
Shouldn't this be KernelCommandLineAppend or so, and then simply be appended by the boot loader or the EFI stub? I mean, otherwise people would try to add "audit=0 selinux=0" and then be very annoyed and surprised if it doesn't work.
Also, I am pretty sure this should also come in a oneshot flavour, so that you can append "fsck.mode=force" for the next boot only.
There was a problem hiding this comment.
hmm, shouldn't this maybe something the loader appends, not userspace?
I wanted this to work independently of the loader. In particular, I'm thinking about providing an alternative way to say 'systemd.uniified-cgroup-hierarchy=no' in F31 after we switch the default. For the loader, we already have a well-established way to set options. I guess it'd make sense to add something like this too sd-boot too, but for me that's an independent issue.
as you put this in the loader UEFI UUID namespace?
Good point. I'll move it to a different namespace.
The capitalization of "SystemdOptions" is a bit weird...
Suggestions?
KernelCommandLineAppend
As you say, this would then confuse people because it's only about systemd in this patch. I think KernelCommandLineAppend (or Prepend?) could be used for the sd-boot option.
onshot flavour
OK, will add.
There was a problem hiding this comment.
Actually, what does EFI_VENDOR_LOADER and EFI_VENDOR_GLOBAL mean? What namespace would be reasonable for "systemd options"?
There was a problem hiding this comment.
introduce a new namespace for that. It's just a uuid you can make up.
I am not sure doing a new efi var that feels like a kernel cmdline string but also totally isnt is the best way forward.
I see two options:
-
This could be an option read by the EFI loader stub, and not the EFI boot menu, and is added implicitly to the kernel cmdline.
-
Instead of adding a string formatted option, instead add explicitly settings, i.e. EFI_VENDOR_SYSTEMD:DefaultUnit= for systemd.unit= EFI_VENDOR_SYSTEMD:FileSystemCheck= for systemd.fsck= and so on. i.e. make them high-level variables, and only expose the ones that have the strong usecase. In this case they feel distinct enough not to be confused with a kernel cmdline option.
There was a problem hiding this comment.
ntroduce a new namespace for that. It's just a uuid you can make up.
That's what I did.
This could be an option read by the EFI loader stub, and not the EFI boot menu, and is added implicitly to the kernel cmdline.
This doesn't really solve the goal: I want to have to have a way to amend systemd options independently of the boot loader used. And I want this to work "now", i.e. when we are pushing cgroups v2 in Fedora. Some future solution that requires discussion and changes in other projects doesn't really help.
Instead of adding a string formatted option, instead add explicitly settings, i.e. EFI_VENDOR_SYSTEMD:DefaultUnit= for systemd.unit= EFI_VENDOR_SYSTEMD:FileSystemCheck= for systemd.fsck=
We already expose only specific settings for overriding on the kernel command line, so I think the list that is overridable through EFI should be the same. Otherwise things would be confusing and harder to maintain for no good reason.
OK, I'll try to amend the patch like this.
8a0d887 to
1bacc72
Compare
|
Updated:
|
1bacc72 to
3f7b219
Compare
|
Rebased and updated (slightly):
@poettering wrote:
I tried that, but this much more annoying (to implement and to use). The biggest issue is that I think we should simply allow all variables that are parsed on the kernel command line to be parsed in this manner. If we start with some that "have a strong use case", then inevitably people will ask for additional ones. We'll be playing whack-a-mole, and there will no clear way to figure out if a given systemd version supports a given variable or not. I think that if we decided to implement command-line parsing for a given variable, than that's a strong-enough use case to also support overriding it through the EFI variable. But once we accept that we allow multiple variables, making a separate EFI variable for each and every one is ugly. In particular, there are variables which modify the same setting, e.g. |
3f7b219 to
71108a9
Compare
…rarchy This avoid the use of the global variable. Also rename cgroup_unified_update() to cgroup_unified_cached() and cgroup_unified_flush() to cgroup_unified() to better reflect their new roles.
…-setup This way less stuff needs to be in basic. Initially, I wanted to move all the parts of cgroup-utils.[ch] that depend on efivars.[ch] to shared, because efivars.[ch] is in shared/. Later on, I decide to split efivars.[ch], so the move done in this patch is not necessary anymore. Nevertheless, it is still valid on its own. If at some point we want to expose libbasic, it is better to to not have stuff that belong in libshared there.
It if of course related to /proc/cmdline parsing, but is higher-level functionality built on top of it. It should be in shared/ because it is something to be used by pid1 and related utilities, not something for level-level libraries.
It's just a small function, but it is higher-level functionality. I don't see a good place for it, reboot-util.[ch] seems least bad
I want to use efivars.[ch] in proc-cmdline.c, but most of the efivars stuff is not needed in basic/. Move the file from shared/ to basic/, but then move back most of the higher-level functions to the new shared/efi-loader.c file.
In various circumstances, overriding the kernel commandline can be inconvenient. People have different bootloaders, and e.g. the grub config can be pretty scary. grubby helps, but it isn't always available. This option adds an alternative mechanism that can quite convenient on EFI systems. cmdline settings have higher priority, because they can be (usually) changed on the bootloader prompt. $SYSTEMD_EFI_OPTIONS can be used to override, same as $SYSTEMD_PROC_CMDLINE.
71108a9 to
4e5aa79
Compare
|
This was reviewed a few times, and although there were questions about the user interface, and I think they have been answered. I'm happy with how this works. If nobody objects, I'll merge this. |
No description provided.