-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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 initrd decryption prompt times out after 90 seconds #250003
Comments
|
So this is a tricky problem. For non-ZFS, systemd is supposed to handle this. I've simulated the
So what's happening here is that the file system Now, for those having this problem in the non-ZFS case: This means you should set your file system device to As for ZFS, the problem is analogous. The import service is not depending on the device that it needs to import, so it's starting too early and assuming the device has failed to appear. In an ideal world, ZFS would have udev rules that makes a device indicative of the pool name only appear once the pool's drives are all available, so that we could order the import service after said device. For now, the best alternative is probably to order the import service after |
systemd-cryptsetup-generator automatically applies an infinite timeout to crypto devices, but only if they are referenced as /dev/mapper/<name>. See: NixOS/nixpkgs#250003 (comment)
Thank you for looking into this; I can confirm that this fixes the non-ZFS case. Quickly looking at the code, it seems like it would be relatively simple for systemd to apply the drop in to the |
I've also implemented https://github.com/lopsided98/nixos-config/blob/master/machines/HP-Z420/default.nix#L121-L134 which I think we should be able to auto generate. If it is not generic solvable, then at least behind an option which may be by default on. Also we should treat this issue with a bit of priority because I ended up several times in emergency mode when the unlocking failed even after already entering the normal system. |
@SuperSandro2000 Don't create custom There isn't an option that could be turned on by default, because the disks required differ from system to system. The only common thing that could be done by default is ordering after |
You mean like? boot.initrd.systemd.services."zfs-import-root" = let
zfsPools = [
"dev-mapper-machine\\x2deins.device"
"dev-mapper-machine\\x2dzwei.device"
];
in {
wants = zfsPools;
after = zfsPools;
}; |
Yep. That way you don't need the custom timeout in the |
Thank you very much for looking into this issue. However, even with your recommended fix the password prompt times out after 90 seconds (the result being the emergency mode). It seems that mounting the Do you have any pointers/ideas on how to further debug this or even a solution at hand? |
@preisi Sorry for taking a while to get back to you.
The |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/unlocking-multiple-luks-devices-with-same-passphrase/45856/4 |
Will this make it into 24.11? |
@devurandom What do you mean by "this"? systemd initrd is already available, it's just not enabled by default. We don't have a solution for this issue yet; though I think what we're likely to do is just disable the timeouts altogether by default. |
I had read #344920 (comment) and indeed meant "disable the timeouts altogether by default" when I wrote "this". Thanks! |
Describe the bug
With systemd initrd and an encrypted rootfs, the system enters emergency mode if the decryption password is not entered within 90 seconds. This occurs because systemd device units time out by default after 90 seconds. Additionally, ZFS on LUKS (I haven't tested native ZFS encryption) times out after 60 seconds because of a hardcoded timeout in
zfs-import-${pool}.service
.To work around the first issue, I added
x-systemd.device-timeout=0
to the root filesystem options. To fix ZFS, I added the decrypted rootfs device unit as a dependency ofzfs-import-root.service
, so the 60 second timeout doesn't start until the device is decrypted. I also setJobTimeoutSec=infinity
on the device unit (see here).I don't see an obvious way to turn these workarounds into something that can be automatically configured in nixpkgs, but I think we should find some solution, because the current behavior is unexpected and annoying.
Notify maintainers
@ElvishJerricco
The text was updated successfully, but these errors were encountered: