-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
Use upstream units for mdadm #65376
Use upstream units for mdadm #65376
Conversation
@GrahamcOfBorg build mdadm |
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.
Looks good, though I'm not sure if we need a separate systemd.shutdownPackages
option. We could also just use any shutdown programs in systemd.packages
.
@edolstra I think so too but we already have |
Tested on Intel MSM array, before the patch a reboot was practically guaranteed to start a resync. After the patch and four reboots no more resyncs. I think this is ready. |
This is ready with some cosmetic changes. I also removed |
Shutdown hooks are executed right before the shutdown, which is useful for some applications. Among other things this is needed for mdadm hook to run.
We also correct paths in udev rules. This is cleaner and allows for less unexpected behaviour. We still check for self-references, however we do it manually now and only for binaries as udev rules can have them. Rather, we patch them out during initrd generation now.
We don't patch basename and readlink now too as they were added for mdadm in 8ecd3a5.
This fixes a serious bug on NixOS with swraid where mdadm arrays weren't properly stopped on shutdown. Rather than fixing the unit by adding `Before=final.target` we completely move to upstream units, which uses systemd shutdown hooks instead. This also drives down maintenance costs for us.
Use systemd.packages instead, it's less error prone and more in line with what's expected.
@Mic92 All fixed, thanks! @GrahamcOfBorg build systemd mdadm |
Motivation for this change
Fix RAID1 rebuild on each reboot.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)[WIP] because I still need to test it better. I don't have good ideas for automated testing for now.