Public bug reported:

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 <ubuntu-devel-disc...@lists.ubuntu.com>
Original-Maintainer: Debian ZFS on Linux maintainers 
<pkg-zfsonlinux-de...@alioth-lists.debian.net>
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

** Affects: zfs-linux (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: zfs zfsutils-linux

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1973065

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/zfs-linux/+bug/1973065/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to