Various systemd fixes and cleanups#121371
Closed
arianvp wants to merge 4 commits intoNixOS:stagingfrom
Closed
Conversation
kmod in NixOS loads from three locations:
/lib/modules (Used in stage-1)
/run/{current-system,booted-system}/kernel-modules/lib/modules (stage 2)
I am working on systemd-initrd; and because we do not set up the
/run symlinks in stage-1 currently; this caused
kmod-static-nodes.service
to not execute.
Now the paths with this unit and the kmod package are aligned
It was originally moved because of nixops autoLuks feature which has been unsupported for a while. See: * NixOS#62211 * NixOS/nixops#1156 (comment) systemd-tmpfiles-setup-dev.service needs to run very early (even before udev runs) because udev rules assume static device nodes already exist even before udev is started. If these static device nodes do not exist; systemd might have trouble mounting filesystems that require static device nodes (like loopfs and btrfs).
…rget Since https://github.com/NixOS/nixpkgs/pull/56184/files local-fs.target is already pulled in by sysinit.target swap.target has always already been pulled in by sysinit.target
There is no real harm having them there; but it means these units really only become active if there is a service providing the underlying functionality. nss-lookup.target should not be pulled in unconditionally. It should be pulled in by providers of DNS lookups. E.g. systemd-resolved.service has a Wants=nss-lookup.target, Before=nss-lookup.target. So once systemd-resolved.service has finished starting up; other units that rely on DNS can be started; but if systemd-resolved is not enabled; those units can start up immediately. Same story goes for nss-user-lookup.target and daemons like sssd. From https://systemd.io/UIDS-GIDS/: Note that nss-user-lookup.target is a passive unit: in order to minimize synchronization points on systems that don’t need it the unit is pulled into the initial transaction only if there’s at least one service that really needs it, and that means only if there’s a service providing the local user database somehow through IPC or suchlike.
arianvp
commented
May 1, 2021
| Before=sysinit.target systemd-tmpfiles-setup-dev.service | ||
| ConditionCapability=CAP_SYS_MODULE | ||
| -ConditionFileNotEmpty=/lib/modules/%v/modules.devname | ||
| +ConditionFileNotEmpty=/run/booted-system/kernel-modules/lib/modules/%v/modules.devname |
Member
Author
There was a problem hiding this comment.
Jeesh gihub is bad at visualizing patches of patches :)
Member
|
@arianvp can you either finish this up, or split the individual fixes into ready-for-review PRs? |
12 tasks
|
I marked this as stale due to inactivity. → More info |
Member
|
@arianvp can you break this into individual PRs and rebase against latest staging? |
13 tasks
Member
|
Closing in favor of #149153. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation for this change
I am working on a systemd based initrd and I needed the fixes for
kmod-static-nodes.serviceandsystemd-tmpfiles-setup-dev.servicewhich in conjunction makes sure that any static devices nodes are set up in very early boot so that udev functions properly. Without it I had trouble mounting for example btrfs as it requires the presence of/dev/btrfs-controlbefore udev even runs for the btrfs rules to work properly.I also took the liberty to cleanup some other units that were left from the
autoLuksdeprecation in20.03Things done
sandboxinnix.confon non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"./result/bin/)nix path-info -Sbefore and after)