Zfsutils-Linux: "zvol_wait" script shows error with encrypted volumes

Bug #1973065 reported by Fabian Lichtenegger-Lukas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zfs-linux (Ubuntu)
New
Undecided
Unassigned

Bug Description

We are currently encounter an issue in the zfsutils-package with encrypted zvols.

The service zfs-volume-wait throws the following error message:
"Apr 22 13:08:19 test1 zvol_wait[806]: cannot open 'rpool/export/vault/block': dataset does not exist"

How to reproduce the error:
1. zpool create main /dev/sdb
2. zfs create -o encryption=on -o keylocation=prompt -o keyformat=passphrase -V 500M main/test
3. reboot
4. systemctl status zfs-volume-wait
● zfs-volume-wait.service - Wait for ZFS Volume (zvol) links in /dev
Loaded: loaded (/lib/systemd/system/zfs-volume-wait.service; enabled; vendor preset: enabled)
Active: active (exited) since Fri 2022-04-22 13:08:19 UTC; 58s ago
Process: 758 ExecStart=/sbin/zvol_wait (code=exited, status=0/SUCCESS)
Main PID: 758 (code=exited, status=0/SUCCESS)

Apr 22 13:08:19 test1 systemd[1]: Starting Wait for ZFS Volume (zvol) links in /dev...
Apr 22 13:08:19 test1 zvol_wait[758]: Testing 1 zvol links
Apr 22 13:08:19 test1 zvol_wait[806]: cannot open 'rpool/export/vault/block': dataset does not exist
Apr 22 13:08:19 test1 zvol_wait[758]: All zvol links are now present.
Apr 22 13:08:19 test1 systemd[1]: Finished Wait for ZFS Volume (zvol) links in /dev.

zfs-volume-wait service calls /sbin/zvol_wait which is part of the package "zfsutils-linux".
Line 29, in script "zvol_wait" seems to be causing this error:
27 filter_out_locked_zvols() {
28 while read -r zvol; do
29 if ! [ "$(zfs list -H -o keystatus rpool/export/vault/block "$zvol")" = "unavailable" ]; then
30 echo "$zvol"
31 fi
32 done
33 }

It seems that this command does not respect the "zfs list" syntax, which should be
"zfs list [-r|-d depth] [-H] [-o property[,...]] [ -t type[,...]] [ -s property ] ... [ -S property ] ... [filesystem|volume|snapshot] ..." (https://linux.die.net/man/8/zfs)

Bug was already reported here:
# https://bugs.launchpad.net/ubuntu/+source/zfs-linux/+bug/1969457
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=997980

This fix is causing the issue:
# https://bugs.launchpad.net/ubuntu/+source/zfs-linux/+bug/1888405

I created an git patch which fixes the issue:
--- zvol_wait 2022-04-21 19:09:21.572000000 +0000
+++ zvol_wait_new 2022-04-22 13:25:26.989422811 +0000
@@ -26,7 +26,7 @@

filter_out_locked_zvols() {
while read -r zvol; do
- if ! [ "$(zfs list -H -o keystatus rpool/export/vault/block "$zvol")" = "unavailable" ]; then
+ if ! [ "$(zfs list -H -o keystatus "$zvol")" = "unavailable" ]; then
echo "$zvol"
fi
done

After the patch was applied the command works fine:
root@test1:/sbin# zvol_wait_new
Testing 1 zvol links
All zvol links are now present.

Did i miss anything or is this really a bug?

Thank you for your help

Further information:
Description: Ubuntu 20.04.4 LTS
Release: 20.04

Package: zfsutils-linux
Version: 0.8.3-1ubuntu12.13
Priority: extra
Section: admin
Source: zfs-linux
Origin: Ubuntu
Maintainer: Ubuntu Developers <email address hidden>
Original-Maintainer: Debian ZFS on Linux maintainers <email address hidden>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 1,297 kB
Provides: zfsutils
Depends: libnvpair1linux (= 0.8.3-1ubuntu12.13), libuutil1linux (= 0.8.3-1ubuntu12.13), libzfs2linux (= 0.8.3-1ubuntu12.13), libzpool2linux (= 0.8.3-1ubuntu12.13), python3, libblkid1 (>= 2.16), libc6 (>= 2.17), libuuid1 (>= 2.16)
Recommends: lsb-base, zfs-zed
Suggests: nfs-kernel-server, samba-common-bin (>= 3.0.23), zfs-initramfs | zfs-dracut
Conflicts: zfs, zfs-fuse
Breaks: openrc, spl (<< 0.7.9-2), spl-dkms (<< 0.8.0~rc1), zfs-dkms (<< 0.7.9-2)
Replaces: spl (<< 0.7.9-2), spl-dkms
Homepage: https://zfsonlinux.org/
Task: ubuntu-live, xubuntu-live, ubuntustudio-dvd-live, ubuntukylin-live, ubuntu-mate-live, ubuntu-budgie-live
Phased-Update-Percentage: 30
Download-Size: 354 kB
APT-Manual-Installed: yes
APT-Sources: http://landscape.test.local/repository/standalone/ubuntu focal-updates/main amd64 Packages

Revision history for this message
Fabian Lichtenegger-Lukas (flichtenegger-lukas) wrote :

Hi,

any updates on this?

thx

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

i think it is redudant red herring, as since that patch was applied in debian/ubuntu different upstream solution was already merged that filters out locked zvolumes.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.