/etc/grub.d/10_linux_zfs fail when zpool import output to stdout
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grub2 (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
## 1. Symptoms, `update-grub` fails with "no such pool"
### output
benjamin@x250:~$ sudo update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/
Generating grub configuration file ...
cannot open 'This': no such pool
### debug output
benjamin@x250:~$ sudo update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/
Generating grub configuration file ...
+ set -u
+ which zfs
+
+ imported_pools=
+ mktemp -d /tmp/zfsmnt.XXXXXX
+ MNTDIR=
+ mktemp -d /tmp/zfstmp.XXXXXX
+ ZFSTMP=
+ RC=0
+ trap on_exit EXIT INT QUIT ABRT PIPE TERM
+ GRUB_LINUX_
+ import_pools
+ zpool list
+ awk {if (NR>1) print $1}
+ local initial_pools=x250
+ 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:
com.delphix:
org.zfsonlinu
All unsupported features are only required for writing to the pool.
The pool can be imported using '-o readonly=on'.
This pool uses the following feature(s) not supported by this system:
com.delphix:
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
## 2. Cause
Only the stderr of `zpool import -f -a -o cachefile=none -N` is sent to /dev/null so when the
command outputs on stdout everything ends up in the `imported_pools` variable
## 3. Quick fix
in /etc/grub.
zpool import -f -a -o cachefile=none -N 2>/dev/null
by
zpool import -f -a -o cachefile=none -N >/dev/null 2>&1
ProblemType: Bug
DistroRelease: Ubuntu 19.10
Package: grub-common 2.04-1ubuntu12
ProcVersionSign
Uname: Linux 5.3.0-19-generic x86_64
NonfreeKernelMo
ApportVersion: 2.20.11-0ubuntu8
Architecture: amd64
CurrentDesktop: XFCE
Date: Sat Oct 26 17:17:20 2019
SourcePackage: grub2
UpgradeStatus: Upgraded to eoan on 2019-10-26 (0 days ago)
modified.
mtime.conffile.
Status changed to 'Confirmed' because the bug affects multiple users.