Skip to content

Use upstream units for mdadm#65376

Merged
FRidh merged 9 commits intoNixOS:stagingfrom
abbradar:mdadm-upstream
Aug 3, 2019
Merged

Use upstream units for mdadm#65376
FRidh merged 9 commits intoNixOS:stagingfrom
abbradar:mdadm-upstream

Conversation

@abbradar
Copy link
Member

@abbradar abbradar commented Jul 25, 2019

Motivation for this change

Fix RAID1 rebuild on each reboot.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

[WIP] because I still need to test it better. I don't have good ideas for automated testing for now.

@ofborg ofborg bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Jul 25, 2019
@ofborg ofborg bot requested a review from Ekleog July 25, 2019 14:02
@ofborg ofborg bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Jul 25, 2019
@abbradar
Copy link
Member Author

@GrahamcOfBorg build mdadm

@ofborg ofborg bot requested a review from edolstra July 25, 2019 19:02
@ofborg ofborg bot added 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. and removed 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Jul 25, 2019
Copy link
Member

@edolstra edolstra left a 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.

@abbradar
Copy link
Member Author

@edolstra I think so too but we already have systemd.generatorPackages. I'm all for merging them all, what do you think?

@abbradar
Copy link
Member Author

abbradar commented Jul 25, 2019

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.

@abbradar
Copy link
Member Author

This is ready with some cosmetic changes. I also removed generator-packages completely after thinking more, we should indeed just use systemd.packages everywhere.

@abbradar abbradar changed the title [WIP] Use upstream units for mdadm Use upstream units for mdadm Jul 26, 2019
@abbradar abbradar changed the base branch from master to staging July 26, 2019 09:16
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.
@abbradar
Copy link
Member Author

@Mic92 All fixed, thanks!

@GrahamcOfBorg build systemd mdadm

@FRidh FRidh merged commit 7560e2d into NixOS:staging Aug 3, 2019
@flokli flokli mentioned this pull request Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants