-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Systemd stage 1 fsck #208269
Systemd stage 1 fsck #208269
Conversation
c1ff0c2
to
c94f334
Compare
There's currently no link to the upstream PR, making it very hard to check if upstream has been poked in the meantime or not. We normally try to not increase our patch count, so please ask upstream first. |
@flokli Ah, sorry. I've updated the OP with a link to the PR, and I've asked there if it could be backported to systemd-stable |
(Note that although that PR was a followup to systemd/systemd#25710, it is not required, because NixOS currently doesn't use the cmdline for root and usrt. But |
c94f334
to
14b7758
Compare
Now that v252.5 is in staging, the new patch file that was needed has been backported and is no longer needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff looks reasonable to me, and the new fsck test passes on my system
I've been running this on my machine (only patching systemdStage1
to avoid too many rebuilds) for a few days now and have not noticed issues, but I admittedly don't have any filesystems marked neededForBoot
that need fsck
Other systemd-stage-1 tests I ran all still succeeded as well
Thank you for this work!
boot.initrd.systemd.storePaths = [initrdFstab]; | ||
boot.initrd.systemd.managerEnvironment.SYSTEMD_SYSROOT_FSTAB = initrdFstab; | ||
boot.initrd.systemd.services.initrd-parse-etc.environment.SYSTEMD_SYSROOT_FSTAB = initrdFstab; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ElvishJerricco Could you share the reason for removing /etc/fstab
from the initrd filesystem? I found that this broke one of my custom initrd units, which had a mount <mountpoint>
line. I have a workaround, but I'm curious to understand the reason for this change so that I can choose the best workaround in my config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Majiir /etc/fstab
was never the right choice; the systemd tooling wants you to use root=
and mount.usr=
on the cmdline. The service initrd-parse-etc.service
reads /sysroot/etc/fstab
, and so does the systemd-fstab-generator
, which is what we're overriding with this environment variable.
Description of changes
Until now, systemd-stage-1 has not supported fsck, which is a major problem.
Incidentally, this will also technically help with hibernation. Currently, the unit ordering isn't quite right, so you'll find
/sysroot
mounting at the same time thatsystemd-hibernate-resume
is starting, which is very dangerous. The problem is that mount units in stage 1 don't get theAfter=local-fs-pre.target
dependency, which is the sync point thatsystemd-hibernate-resume
orders itself before. Butsystemd-fsck
is ordered afterlocal-fs-pre.target
, so it works if fsck is working. Realistically, I think the lack of this ordering on the mount units should be considered a bug in systemd, and the patch to fix that bug is like one line, but I haven't opened an issue/PR about that yet.Targeting staging because the systemd patch that changes how systemd finds fsck had to be modified.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes