[Bug 1850003] [NEW] /etc/grub.d/10_linux_zfs doesn't skip non-linux zpools

2019-10-26 Thread Benjamin Gentil
Public bug reported:

# 1. Symptoms: `update-grub` fails when trying to access an os-release
file

root@x250:/home/benjamin# update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
/etc/grub.d/10_linux_zfs: 338: .: Can't open 
/tmp/zfsmnt.Ejuktn/etc/os-release
done

# 2. Cause: 10_linux_zfs is trying to access /etc/os-release in all zpool, even 
when the system is not Linux based
+ machine_id=rpool/ROOT/openindiana
+ . /tmp/zfsmnt.AC9sAy/etc/os-release
/etc/grub.d/10_linux_zfs: 339: .: Can't open 
/tmp/zfsmnt.AC9sAy/etc/os-release
+ pretty_name=
+ boot_list=\n
+ boot_list=
+ on_exit
+ zpool export rpool
+ mountpoint -q /tmp/zfsmnt.AC9sAy
+ true
+ rmdir /tmp/zfsmnt.AC9sAy
+ rm -rf /tmp/zfstmp.lEMWy3
+ exit 0
done

# 3. Quick fix (for /etc/os-release)

in /etc/grub.d/10_linux_zfs:321, replace:
if [ -z  "${etc_dir}" ]; then
by:
if [ -z  "${etc_dir}" ] || [ ! -f "${etc_dir}/os-release" ]; then

then when the file is not found, the zpool is skipped
root@x250:/home/benjamin# update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Warning: Ignoring rpool/ROOT/openindiana
Warning: Ignoring rpool/ROOT/openindiana-1
Warning: Ignoring rpool/ROOT/openindiana-1@install
Warning: Ignoring rpool/ROOT/openindiana-1@2018-08-24-23:15:22
Found linux image: vmlinuz-5.0.0-32-generic in x250/ROOT/ubuntu
Found initrd image: initrd.img-5.0.0-32-generic in x250/ROOT/ubuntu
Found linux image: vmlinuz-5.3.0-19-generic in x250/ROOT/ubuntu
Found initrd image: initrd.img-5.3.0-19-generic in x250/ROOT/ubuntu
Found linux image: vmlinuz-5.0.0-32-generic in x250/ROOT/ubuntu@install
Found initrd image: initrd.img-5.0.0-32-generic in 
x250/ROOT/ubuntu@install
Found linux image: vmlinuz-5.3.0-19-generic in x250/ROOT/ubuntu@install
Found initrd image: initrd.img-5.3.0-19-generic in 
x250/ROOT/ubuntu@install
done

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: Sun Oct 27 00:30:31 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-27T00:09:53.228144

** Affects: grub2 (Ubuntu)
 Importance: Undecided
 Status: New


** Tags: amd64 apport-bug eoan

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

Title:
  /etc/grub.d/10_linux_zfs doesn't skip non-linux zpools

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1850003/+subscriptions

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

[Bug 1850002] [NEW] /etc/grub.d/10_linux_zfs fail when zpool import output to stdout

2019-10-26 Thread Benjamin Gentil
Public bug reported:

## 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.XX
+ MNTDIR=/tmp/zfsmnt.bunqET
+ mktemp -d /tmp/zfstmp.XX
+ 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

** Affects: grub2 (Ubuntu)
 Importance: Undecided
 Status: New


** Tags: amd64 apport-bug eoan

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

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1850002/+subscriptions

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