nixos/filesystems: add systemd dependencies for depends#273642
nixos/filesystems: add systemd dependencies for depends#273642lheckemann wants to merge 1 commit intoNixOS:masterfrom
Conversation
Without this, overlay filesystems lack the dependency metadata required for the systemd-based stage-1 to mount them. This works in the scripted stage-1 since it mounts the filesystems sequentially, and the fstab entries are toposorted taking `depends` into account. This replicates that logic for systemd.
|
@lheckemann duplicate of #233707? |
|
@lheckemann Friendly ping on ^ (I'm triaging my notifications.) |
|
Kind of; I'm not sure the sysroot logic really makes sense, because the mount unit generated in the final system isn't correct in that case. See also #270611 for more discussion of the problem (and a potential solution). |
|
@lheckemann The idea of putting things in This is an extremely frustrating problem, and honestly I think the answer is a systemd feature. I think we want "chroot mount units" or something. I've tried to hack this together manually with |
|
Yeah, I like the idea of chrooting the mount in principle, but it's complicated significantly by mount helpers which need to be exec'd (how do you ensure that they're there? how do you find them (especially in our non-FHS case)? and what if you want to use the helpers from the initrd?). I've spent some time thinking about the problem and the only real conclusion I've drawn so far is that the design of mounts and mount namespaces just kind of sucks for what we want to do :( |
Description of changes
Without this, overlay filesystems lack the dependency metadata required for the systemd-based stage-1 to mount them. This works in the scripted stage-1 since it mounts the filesystems sequentially, and the fstab entries are toposorted taking
dependsinto account. This replicates that logic for systemd.This isn't a very pretty approach, and I'm open to suggestions on how this could be done more elegantly.
Note also that this isn't all we need to make mounting overlay filesystems from systemd stage-1 work correctly; the mount will fail since the upper/lower/work paths would need to be prefixed with
/sysroot-- but just doing that isn't appropriate, since it breaks mounting the filesystem from stage-2. This problem also exists with scripted stage-1.I suspect we might need to introduce special handling for overlayfs, which generates distinct systemd mount units for stage-1 and stage-2, and warn when users define overlay filesystems using
fileSystems.That said, this PR already improves on what we had before IMHO, so I think we can merge it without yet solving the whole problem.
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.