/etc/grub.d/10_linux_zfs fail when zpool import output to stdout

Bug #1850002 reported by Benjamin Gentil
16
This bug affects 3 people
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/grub.d/init-select.cfg'
 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/grub.d/init-select.cfg'
 Generating grub configuration file ...
 + set -u
 + which zfs
 +
 + imported_pools=
 + mktemp -d /tmp/zfsmnt.XXXXXX
 + MNTDIR=/tmp/zfsmnt.bunqET
 + mktemp -d /tmp/zfstmp.XXXXXX
 + ZFSTMP=/tmp/zfstmp.X21h0R
 + 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=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:spacemap_v2 (Space maps representing large segments are more efficient.)
  org.zfsonlinux:project_quota (space/object accounting based on project ID.)
 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:spacemap_v2 (Space maps representing large segments are more efficient.)
 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.d/10_linux_zfs:67, replace:
  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
ProcVersionSignature: Ubuntu 5.3.0-19.20-generic 5.3.1
Uname: Linux 5.3.0-19-generic x86_64
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair
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.conffile..etc.grub.d.10_linux_zfs: [modified]
mtime.conffile..etc.grub.d.10_linux_zfs: 2019-10-26T17:14:38.665289

Revision history for this message
Benjamin Gentil (bengentil) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in grub2 (Ubuntu):
status: New → Confirmed
Revision history for this message
Ivo Anjo (knuckles) wrote :

+1 had exactly this issue when I upgraded from an existing 18.04 setup with zfs into 19.04 and then 19.10 on the same day.

The suggested workaround worked for me.

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.