NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.29k stars 13.54k forks source link

zfs passphrase caching between zpools #309823

Open surfaceflinger opened 4 months ago

surfaceflinger commented 4 months ago

Right now, encrypted pools in boot.zfs.extraPools all have separate prompts for passphrase even if all of them use the same passphrase.

Expected behavior

If all zpools have the same passphrase then it should be enough to enter it just once during boot.

Additional context

zfs load-key -a already does that. systemd-ask-password has password caching between multiple executions, I guess this would be the preferred choice.

As a workaround in old NixOS stage1, I've been doing

zpool import -a
zfs load-key -a

in postBootCommands.

I've noticed this but I think it runs between imports so it's aware of only one encrypted pool per run.

Notify maintainers

@raitobezarius @ElvishJerricco

Add a :+1: reaction to issues you find important.

ElvishJerricco commented 3 months ago

We could use the --keyname argument in our systemd-ask-password call. That's how LUKS passwords are shared in systemd stage 1.

surfaceflinger commented 1 month ago

https://github.com/NixOS/nixpkgs/pull/324918