Skip to content

nixos/udev: enable initrd-udevadm-cleanup-db.service in systemd stage 1#185116

Merged
ElvishJerricco merged 2 commits intoNixOS:masterfrom
NickCao:udev
Nov 21, 2022
Merged

nixos/udev: enable initrd-udevadm-cleanup-db.service in systemd stage 1#185116
ElvishJerricco merged 2 commits intoNixOS:masterfrom
NickCao:udev

Conversation

@NickCao
Copy link
Copy Markdown
Member

@NickCao NickCao commented Aug 4, 2022

Description of changes

Fixes #178345

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@github-actions github-actions 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 Aug 4, 2022
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Aug 4, 2022
Copy link
Copy Markdown
Member

@ncfavier ncfavier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the issue for me, thanks!

@bobby285271 bobby285271 added the 12.approvals: 1 This PR was reviewed and approved by one person. label Aug 4, 2022
Copy link
Copy Markdown
Contributor

@K900 K900 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@mweinelt mweinelt added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Aug 4, 2022
@ElvishJerricco
Copy link
Copy Markdown
Contributor

@NickCao have you confirmed this doesn't break LUKS? I believe that's the reason we had to disable that previously; it was causing LUKS devices to disappear between stage 1 and stage 2. In particular, this affects file systems that aren't mounted in stage 1, but are LUKS devices decrypted in stage 1.

@NickCao
Copy link
Copy Markdown
Member Author

NickCao commented Aug 18, 2022

The upstream issue is fixed and shipped, not sure about the luks part, is there a nixos test for that? (I'm a bit occupied these days and cannot test it myself)

@ElvishJerricco
Copy link
Copy Markdown
Contributor

@NickCao Ok, the issue that I remember having still persists. I thought that systemd issue was related to it, but I suppose it wasn't if they think that systemd issue is fixed.

Essentially, if you define a LUKS device with boot.initrd.luks.devices, but you don't have any stage 1 file systems on it, then enabling this service in stage 1 will cause udev to remove its SYSTEMD_READY tag, and it won't get picked up again in stage 2. The result is that the file system being mounted in stage 2 cannot find the device and fails.

Copy link
Copy Markdown
Contributor

@ElvishJerricco ElvishJerricco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we have to find a way to avoid LUKS devices of that nature being broken before we can enable this.

@ElvishJerricco
Copy link
Copy Markdown
Contributor

@dasJ Do you remember what specific issue you ran up against with this service? IIRC it was different than mine.

@dasJ
Copy link
Copy Markdown
Member

dasJ commented Aug 18, 2022

LVM devices on cryptsetup utterly broken and udev not finding them iirc

@NickCao
Copy link
Copy Markdown
Member Author

NickCao commented Nov 13, 2022

Despite still not knowing how to fix the LUKS issue, I've make a nixos test to reproduce it: https://gist.github.com/NickCao/4fa2f532a3ec71ba9a8ff9e3ef9ef1e4

Looks like the device mapper devices are not missing, just udev deciding that they are not ready for prime time, which should have been fixed at the end of systemd/systemd#12953, which has landed in systemd 251.7, but the issue still persists.

@NickCao
Copy link
Copy Markdown
Member Author

NickCao commented Nov 13, 2022

I've found the fix to the problem: https://git.kernel.org/pub/scm/boot/dracut/dracut.git/tree/modules.d/90dm/11-dm.rules
dracut has been shipping this custom udev rule marking dm devices as db_persist, so that they survive the db cleanup.

Copy link
Copy Markdown
Contributor

@K900 K900 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still LGTM, but I don't have a setup to actually test this on.

@NickCao
Copy link
Copy Markdown
Member Author

NickCao commented Nov 21, 2022

@ElvishJerricco @dasJ are you two still interested in this?

@ElvishJerricco
Copy link
Copy Markdown
Contributor

Do we have a nixos test that covers this?

@NickCao
Copy link
Copy Markdown
Member Author

NickCao commented Nov 21, 2022

Despite still not knowing how to fix the LUKS issue, I've make a nixos test to reproduce it: https://gist.github.com/NickCao/4fa2f532a3ec71ba9a8ff9e3ef9ef1e4

I could adapt this to a nixos test if wanted.

@ElvishJerricco
Copy link
Copy Markdown
Contributor

That would be good to have, yea.

@ElvishJerricco
Copy link
Copy Markdown
Contributor

@ofborg test systemd-initrd-luks-password

@NickCao
Copy link
Copy Markdown
Member Author

NickCao commented Nov 21, 2022

The failure on aarch64 seems unrelated?

@ElvishJerricco
Copy link
Copy Markdown
Contributor

Yea, looks like it's had the same failure on hydra for a while now.

Copy link
Copy Markdown
Contributor

@ElvishJerricco ElvishJerricco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ElvishJerricco
Copy link
Copy Markdown
Contributor

@ofborg test installer.luksroot

Just want to run this to make sure that udev rule isn't negatively messing with the regular initrd.

@ElvishJerricco ElvishJerricco merged commit 551296c into NixOS:master Nov 21, 2022
@NickCao NickCao deleted the udev branch November 21, 2022 07:50
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: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 2 This PR was reviewed and approved by two persons.

Projects

Development

Successfully merging this pull request may close these issues.

systemd initrd doesn't restore backlight levels

7 participants