update-grub fails when having multiple encrypted zfs root datasets

Bug #1938635 reported by Ubuntu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Triaged
Undecided
Unassigned

Bug Description

== Test Case ==
1. Have a multi-boot linux setup installed on zfs
2. Use external boot partition
3. Use encryption (using diffent keys) for each zfs root dataset
4. Boot into one environment without loading key of other dataset
5. Run update-grub

In our case we have 2 root datasets. We're booted into /legion/work/root
/legion/personal/root
/legion/work/root

* Expected Result *
update-grub succeeds updating grub config file with (at least) currently booted environment in configuration file.

* Actual Result *
update-grub fails, effectively updating config file removing currently booted environment from grub config.

update-grub output:

$ sudo update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
filesystem 'legion/personal/root' can not be mounted: Permission denied
Adding boot menu entry for UEFI Firmware Settings
done

* Workaround / Fix *
A nice fix would be to add flag to either ignore datasets without loaded key. As I'm not interested in having personal root dataset listed in grub I added a workaround in "/etc/grub.d/10_linux_zfs" modifying function "get_root_datasets()".

Original expression: zfs list -H -o name,canmount,mountpoint -t filesystem | grep -E '^'"${p}"'(\s|/[[:print:]]*\s)(on|noauto)\s'"${rel_pool_root}"'$' | awk '{print $1}'

Modified expression: zfs list -H -o name,canmount,mountpoint,keystatus -t filesystem | grep -E '^'"${p}"'(\s|/[[:print:]]*\s)(on|noauto)\s'"${rel_pool_root}"'\savailable$' | awk '{print $1}'
---
ProblemType: Bug
ApportVersion: 2.20.11-0ubuntu27.18
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: KDE
DistroRelease: Ubuntu 20.04
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair nvidia_modeset nvidia
Package: grub2 (not installed)
ProcVersionSignature: Ubuntu 5.4.0-80.90-generic 5.4.124
Tags: focal
Uname: Linux 5.4.0-80-generic x86_64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip libvirt lpadmin plugdev sudo
_MarkForUpload: True
---
ProblemType: Bug
ApportVersion: 2.20.11-0ubuntu27.18
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: KDE
DistroRelease: Ubuntu 20.04
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair nvidia_modeset nvidia
Package: grub2 (not installed)
ProcVersionSignature: Ubuntu 5.4.0-80.90-generic 5.4.124
Tags: focal
Uname: Linux 5.4.0-80-generic x86_64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip libvirt lpadmin plugdev sudo
_MarkForUpload: True

Revision history for this message
Chris Guiver (guiverc) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Please execute the following command only once, as it will automatically gather debugging information, in a terminal:

apport-collect 1938635

When reporting bugs in the future please use apport by using 'ubuntu-bug' and the name of the package affected. You can learn more about this functionality at https://wiki.ubuntu.com/ReportingBugs.

(no release, grub2 package details etc details were provided)

Revision history for this message
Ubuntu (xinubuntu) wrote : ProcCpuinfoMinimal.txt

apport information

tags: added: apport-collected focal
description: updated
Revision history for this message
Ubuntu (xinubuntu) wrote : ProcEnviron.txt

apport information

description: updated
Revision history for this message
Ubuntu (xinubuntu) wrote : ProcCpuinfoMinimal.txt
Revision history for this message
Ubuntu (xinubuntu) wrote : ProcEnviron.txt
Revision history for this message
Ubuntu (xinubuntu) wrote :

I hope all went well submitting the additional info. Added grub-mkconfig version below

$ update-grub --version
grub-mkconfig (GRUB) 2.04-1ubuntu26.12

Changed in grub2 (Ubuntu):
status: New → Triaged
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.