Luks continues to boot despite failure

On nixos luks no longer prompts me to re-enter my password if i get it wrong and tries to boot, which leads to a failed boot because my home partition is luks encrypted, and it just drops me in an emergency shell, while my root isnt, how do i fix this?

By fix I mean I want the old behavior where it would say i failed to enter my LUKS password correctly and let me re-enter it.

1 Like

Unfortunately, I believe this is caused by a couple of upstream systemd issues:

Each of this issues is a different bug that reduces the number of attempts you’re given by one. It’s supposed to be 3. So in the end you’re likely to only get one try. Unfortunately the simplest workaround is to just set tries=5 or something for crypttab

3 Likes

Recently some of these changes has been merged, do you have any idea when they would land in nixpkgs or if they already landed in nixpkgs? Like the PR numbers

You’ll have to wait for the commits to be included in a systemd release. Depending on whether they are backported (these are bugs, so that’s not impossible) it might then take anywhere from a few weeks to 6 months for this to hit stable.

It’ll probably be at least a few weeks until a PR becomes available even if the fix is backported, and likely a month+ before you can use it.

You can either be patient or apply the patch downstream by overriding the systemd package.

I recommend patience, an override will cause a lot of rebuilding, and the workaround is pretty good. Just add a # TODO(26.11): Remove this if the systemd bugs were fixed to your config where you add the workaround and remember to search for 26.11 during your next NixOS upgrade.

I think boot.initrd.systemd.package can be set to the overridden package with patches applied. That way, there isn’t as much rebuilding. Not sure if systemd.package should be set too

1 Like

That’s what I meant, you need to use .overrideAttrs to apply those patches to pkgs.systemd and put the resulting package in all the right places.

Still have to rebuild systemd for something for which a perfectly rebuild-free workaround exists.

2 Likes