Skip to content
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

Merged
merged 9 commits into from Aug 3, 2019
Merged

Use upstream units for mdadm #65376

merged 9 commits into from Aug 3, 2019

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.

@abbradar
Copy link
Member Author

@GrahamcOfBorg build mdadm

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.

pkgs/os-specific/linux/systemd/default.nix Outdated Show resolved Hide resolved
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants