After upgrading from FreeBSD 14.4-RELEASE to 15.1-RELEASE, my system hung at boot waiting for a passphrase. The cause was the rc.d/zfskeys script now prompting interactively for every dataset with keylocation=prompt. On 14.x these datasets were silently skipped. In my case the affected datasets are encrypted ZFS backups received via raw send (`zfs send -w`). Raw-received datasets always have keylocation=prompt by default (ZFS cannot preserve the source key path). The backup pool was in zpool.cache, so zfskeys iterated over it at boot and blocked on each encryption root. This likely affects anyone using zero-knowledge encrypted backup workflows (zfs-autobackup, syncoid, manual raw sends). Rresumably caused by commit 408087f128fe745dbfb2b8423f0afd9e0ce2d11a (D36081), which added an explicit `keylocation=prompt` branch that reads from /dev/tty unconditionally. Previously these datasets fell through to the key-file check, which failed harmlessly and skipped them. This behavioral change is not mentioned in the errata for 15.0-RELEASE or 15.1-RELEASE. At a minimum it should be added as an errata entry for both releases so administrators upgrading from 14.x are warned before rebooting. Affected versions: 15.0-RELEASE, 15.1-RELEASE (14.x not affected). Workaround: `zpool set cachefile=none <backuppool>` so the pool is not auto-imported at boot, or `zpool export <backuppool>` to remove it from the system entirely until needed. Related: Phabricator D36081, commit 408087f128fe745dbfb2b8423f0afd9e0ce2d11a.
Kyle, what is your opinion on this?
(In reply to johannes.kunde from comment #0) Thinking from a UX perspective, what *would* you want to do with these? My first instinct upon reading this report was that I wonder if we should add a `zfskeys_prompt` that one can set to =NO to avoid these specifically, but then there's another branch in the decision tree: would you want the flexibility to run zfskeys manually and get this behavior (thus, just avoid prompting on boot), or would you generally want to run `zfs load-key` yourself?
We have a zfskeys_enable="YES", we could add a zfskeys_prompt_enable="YES" to control prompting for a password. When I didn't have prompting working, then it would fail to mount the needed file system and drop into single user mode. Then I had to manually run the zfs commands to enter the password so it would boot.
My primary intention with this report was to ensure this behavioral change gets mentioned in the errata so administrators upgrading from 14.x aren't caught off guard by broken boot sequences. However, looking at this from a UX perspective, that is a great question. Reading D36081, the consensus was clearly to make the console prompt explicit. Unfortunately, for headless servers and automated workflows, this breaks the principle of least surprise. A global rc.conf toggle like zfskeys_prompt="NO" makes perfect sense as a way to opt-in or opt-out of the default behavior. Taking the UX discussion a step further, I think a clean and robust approach would be to handle this via a ZFS user property. Something like this: zfs set org.freebsd:zfskeys=skip backuppool In my specific use case (a zero-knowledge backup pool receiving raw streams via zfs send -w), the receiving datasets naturally inherit keylocation=prompt. These datasets are never meant to be mounted or unlocked on this machine. Prompting for a key here is functionally useless and breaks unattended reboots. A global toggle in rc.conf is a good failsafe, but a user property would allow administrators to granularly skip datasets that shouldn't block the boot sequence, while still allowing the system to prompt for local encrypted pools that do need unlocking at the console. I'm not sure, however, how this fits into the bigger picture and if similar approaches are implemented elsewhere.
> My primary intention with this report was to ensure this behavioral change gets mentioned in the errata so administrators upgrading from 14.x aren't caught off guard by broken boot sequences. Right, I agree completely- it's worth a release note at least, even if we can't "fix" it. OTOH, I was chatting with Allan and he pointed out that this is kind of the intention of the 10 second timeout that already exists for the other load-key usage, it just didn't get applied for this one. I think one could argue that *that* is a bug one could convince secteam@ to accept an errata notice for.
Technically, the 10-second timeout prevents a permanent hang, but it would still cause severe boot delays in most scenarios. Since pools often contain dozens of datasets, a 10-second timeout per dataset quickly accumulates into minutes of delay. This by itself could lead to the system failing to come up in time or triggering watchdog timeouts.
(In reply to johannes.kunde from comment #6) This is a fair point
I added this as an open issue in the 15.1/errata, but I am leaving this open as it seems like we may want to take additional action. Thank you for the report!
I meant to finish the src patch this week, but time slipped away from me. Should be able to next week.
I can put this up for review diff --git a/libexec/rc/rc.d/zfskeys b/libexec/rc/rc.d/zfskeys index aff0224d5c9d..35f32b3baeb4 100755 --- a/libexec/rc/rc.d/zfskeys +++ b/libexec/rc/rc.d/zfskeys @@ -45,13 +45,14 @@ unlock_fs() local kl="$2" local k="${kl##file://}" - if [ "$kl" == "prompt" ] - then - echo "Key prompt for $fs." - if zfs load-key -L "$kl" "$fs" < /dev/tty > /dev/tty 2>/dev/tty ; then - echo "Key loaded for $fs." - else - echo "Key failed to load for $fs." + if [ "$kl" == "prompt" ]; then + if checkyesno zfskeys_prompt_enable ; then + echo "Key prompt for $fs." + if zfs load-key -L "$kl" "$fs" < /dev/tty > /dev/tty 2>/dev/tty ; then + echo "Key loaded for $fs." + else + echo "Key failed to load for $fs." + fi fi elif [ "$k" ] && [ -f "$k" ] && [ -s "$k" ] && [ -r "$k" ]; then if [ "$(zfs get -Ho value keystatus "$fs")" = 'available' ]; then I tested it with zfs_enable="YES" zfskeys_enable="YES" zfskeys_prompt_enable="YES" /etc/rc.conf that worked for my case. Without zfskeys_prompt_enable="YES" it dropped into single user mode since it couldn't mount the needed file systems for my boot. Unless someone has zfskeys_prompt_enable="YES" then nothing should change.
(In reply to Doug Ambrisko from comment #10) This is effectively what I had locally, but I also did: @@@ -20,6 -20,6 +20,7 @@@ required_modules="zfs : ${zfskeys_datasets:=''} : ${zfskeys_timeout:=10} : ${zfskeys_unload_force:='NO'} ++: ${zfskeys_prompt_enable:='YES'} encode_args() { and I also prefixed the prompt zfs load-key with `timeout $zfskeys_timeout` as it's done in in the third invocation in the file. If we don't add some timeout (maybe adding a higher zfskeys_prompt_timeout would be better), I'd prefer that we default zfskeys_prompt_enable=NO so that we just add latency for systems that aren't expecting it rather than completely blocking.
I'd recommend : ${zfskeys_prompt_enable:='NO'} Then if prompts are wanted, they can be enabled. We should update defaults to be diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index 27e8c8456b6f..6e70baccac98 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -77,6 +77,7 @@ rc_conf_files="/etc/rc.conf /etc/rc.conf.local" # ZFS support zfs_enable="NO" # Set to YES to automatically mount ZFS file systems zfskeys_enable="NO" # Set YES to autoload ZFS encryption keys +zfskeys_prompt_enable="NO" # Set YES to prompt during booting zfs_bootonce_activate="NO" # Set YES to make successful bootonce BE permanent zpool_reguid="" # Set to zpools for which the GUID should be replaced # upon first boot. I didn't want to get to wordy. I'm not keen on the timeout for me since if I'm not there/busy during boot then it will error into single user. I'm not sure if Ubuntu times out during unlock via keyboard. I have a 2nd laptop to test things before installing it on my main system. BTW, in -current a while back I had to add locally: @@ -12,7 +12,6 @@ desc="Import ZPOOLs" rcvar="zfs_enable" start_cmd="zpool_start" -start_postcmd="zpool_poststart" required_modules="zfs" zpool_start() @@ -33,13 +32,6 @@ done } -zpool_poststart() -{ - if checkyesno zfskeys_enable; then - /etc/rc.d/zfskeys start - fi -} - load_rc_config $name # doesn't make sense to run in a svcj Otherwise it would fail to mount my file systems and drop into single user mode until I manually ran /etc/rc.d/zfskeys to unlock it.
(In reply to Doug Ambrisko from comment #12) Sure, that works for me; feel free to add my reviewed-by with it defaulted to 'no'. re: zpool modification, hmm. I think that's fine, but we probably want to add the `nostart` keyword to the zfskeys script. Why exactly did it fail to mount them and fallback, though? Presumably the problem is that we don't have a way to specify that zfskeys should come immediately after zpool, so rcorder(8) ends up placing things in between the two- my assumption was that something in the middle then required an encrypted dataset, but your description sounds like it might have been a different scenario? CC'ing bapt@ in case rcd doesn't have a way to express that strict of an ordering, because that'd probably be useful for cases like this.
I created https://reviews.freebsd.org/D57750 and added you as a reviewer. The other issue I ran into can be tracked separately.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=276a3dacdb60b65d65301aced5d8443cc5d27ea2 commit 276a3dacdb60b65d65301aced5d8443cc5d27ea2 Author: Doug Ambrisko <ambrisko@FreeBSD.org> AuthorDate: 2026-06-22 18:45:42 +0000 Commit: Doug Ambrisko <ambrisko@FreeBSD.org> CommitDate: 2026-06-23 15:12:43 +0000 zfskeys - only prompt if zfskeys and zfskeys_prompt are enabled By default don't block booting with a prompt if a zpool needs a keyboard password to unlock it. To enable prompting for keyboard password during boot require: zfskeys_enable="YES" zfskeys_prompt_enable="YES" to both be enabled. This returns to POLA of prior behaviour. PR: 296130 Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D57750 libexec/rc/rc.conf | 1 + libexec/rc/rc.d/zfskeys | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-)
Solved? can I close it?
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3f73758036c7be2572d73bb72914801db06f5f4f commit 3f73758036c7be2572d73bb72914801db06f5f4f Author: Doug Ambrisko <ambrisko@FreeBSD.org> AuthorDate: 2026-06-22 18:45:42 +0000 Commit: Doug Ambrisko <ambrisko@FreeBSD.org> CommitDate: 2026-08-24 18:48:45 +0000 zfskeys - only prompt if zfskeys and zfskeys_prompt are enabled By default don't block booting with a prompt if a zpool needs a keyboard password to unlock it. To enable prompting for keyboard password during boot require: zfskeys_enable="YES" zfskeys_prompt_enable="YES" to both be enabled. This returns to POLA of prior behaviour. PR: 296130 Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D57750 (cherry picked from commit 276a3dacdb60b65d65301aced5d8443cc5d27ea2) libexec/rc/rc.conf | 1 + libexec/rc/rc.d/zfskeys | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-)