grub-common: 10_linux_zfs imported_tools is incorrectly set when no ZFS pools exist

Bug #1852434 reported by Colin Ian King
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
New
High
Didier Roche-Tolomelli
Eoan
New
Undecided
Unassigned
Focal
New
High
Didier Roche-Tolomelli

Bug Description

Script /etc/grub.d/10_linux_zfs in the grub-common package emits the error "cannot open 'This': no such pool" when no ZFS pools are available, e.g.:

sudo update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-5-generic
Found initrd image: /boot/initrd.img-5.4.0-5-generic
Found linux image: /boot/vmlinuz-5.3.0-21-generic
Found initrd image: /boot/initrd.img-5.3.0-21-generic
Found linux image: /boot/vmlinuz-5.3.0-12-generic
Found initrd image: /boot/initrd.img-5.3.0-12-generic
Found linux image: /boot/vmlinuz-5.3.0-10-lowlatency
Found initrd image: /boot/initrd.img-5.3.0-10-lowlatency
Found linux image: /boot/vmlinuz-5.3.0-5-generic
Found initrd image: /boot/initrd.img-5.3.0-5-generic
Found linux image: /boot/vmlinuz-5.2.0-10-lowlatency
Found initrd image: /boot/initrd.img-5.2.0-10-lowlatency
cannot open 'This': no such pool

Adding "set -x" on the script shows the error:

+ prefix=/usr
+ datarootdir=/usr/share
+ ubuntu_recovery=1
+ quiet_boot=1
+ quick_boot=1
+ gfxpayload_dynamic=1
+ vt_handoff=1
+ . /usr/share/grub/grub-mkconfig_lib
+ prefix=/usr
+ exec_prefix=/usr
+ datarootdir=/usr/share
+ datadir=/usr/share
+ bindir=/usr/bin
+ sbindir=/usr/sbin
+ [ x/usr/share/grub = x ]
+ test x = x
+ grub_probe=/usr/sbin/grub-probe
+ test x = x
+ grub_file=/usr/bin/grub-file
+ test x = x
+ grub_mkrelpath=/usr/bin/grub-mkrelpath
+ which gettext
+ :
+ grub_tab=
+ export TEXTDOMAIN=grub
+ export TEXTDOMAINDIR=/usr/share/locale
+ set -u
+ which zfs
+
+ imported_pools=
+ mktemp -d /tmp/zfsmnt.XXXXXX
+ MNTDIR=/tmp/zfsmnt.xDDUj0
+ mktemp -d /tmp/zfstmp.XXXXXX
+ ZFSTMP=/tmp/zfstmp.yEeU2G
+ RC=0
+ trap on_exit EXIT INT QUIT ABRT PIPE TERM
+ GRUB_LINUX_ZFS_TEST=
+ import_pools
+ zpool list
+ awk {if (NR>1) print $1}
+ local initial_pools=
+ local all_pools=
+ local imported_pools=
+ zpool import -f -a -o cachefile=none -N
+ imported_pools=This pool uses the following feature(s) not supported by this system:
 org.zfsonlinux:userobj_accounting (User/Group object accounting.)
All unsupported features are only required for writing to the pool.
The pool can be imported using '-o readonly=on'.
+ on_exit
+ zpool export This
cannot open 'This': no such pool

This shows it is assuming that ZFS pools exist, which don't on my particular machine when I ran update-grub on Ubuntu focal.

Revision history for this message
Colin Ian King (colin-king) wrote :

Issue is in debian/patches/ubuntu-zfs-enhance-support.patch, in function import_pools:

Changed in grub2 (Ubuntu):
importance: Undecided → High
Changed in grub2 (Ubuntu):
assignee: nobody → Didier Roche (didrocks)
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

This is a dup, and interestingly, we just fixed this (but adding tests before pushing the SRU or to focal :)).

However, thanks to your backlog, we finally know where the "This" is coming from and can fix it, thanks! :)

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.