[Bug 1880855] Re: grub-installer should mount efivarfs
Ubuntu Foundations Team Bug Bot
1880855 at bugs.launchpad.net
Fri Jun 5 12:27:01 UTC 2020
The attachment "Mount and unmount $ROOT/sys/firmware/efi/efivars" seems
to be a patch. If it isn't, please remove the "patch" flag from the
attachment, remove the "patch" tag, and if you are a member of the
~ubuntu-reviewers, unsubscribe the team.
[This is an automated message performed by a Launchpad user owned by
~brian-murray, for any issues please contact him.]
** Tags added: patch
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grub-installer in Ubuntu.
https://bugs.launchpad.net/bugs/1880855
Title:
grub-installer should mount efivarfs
Status in grub-installer package in Ubuntu:
Confirmed
Bug description:
I am trying to install Focal 20.04 on an UEFI machine, but it fails at
the end when installing grub. Here are messages from syslog:
May 26 11:51:56 grub-installer: info: Running chroot /target grub-install --force "dummy"
May 26 11:51:56 grub-installer: Installing for x86_64-efi platform.
May 26 11:51:57 grub-installer: File descriptor 3 (pipe:[37905]) leaked on vgs invocation. Parent PID 3610: grub-install
May 26 11:51:57 grub-installer: File descriptor 4 (/dev/ttyS1) leaked on vgs invocation. Parent PID 3610: grub-install
May 26 11:51:57 grub-installer: File descriptor 5 (/dev/ttyS1) leaked on vgs invocation. Parent PID 3610: grub-install
May 26 11:51:57 grub-installer: File descriptor 6 (/dev/ttyS1) leaked on vgs invocation. Parent PID 3610: grub-install
May 26 11:51:57 grub-installer: File descriptor 8 (/dev/sdb1) leaked on vgs invocation. Parent PID 3610: grub-install
May 26 11:51:57 grub-installer: File descriptor 3 (pipe:[37905]) leaked on vgs invocation. Parent PID 3610: grub-install
May 26 11:51:57 grub-installer: File descriptor 4 (/dev/ttyS1) leaked on vgs invocation. Parent PID 3610: grub-install
May 26 11:51:57 grub-installer: File descriptor 5 (/dev/ttyS1) leaked on vgs invocation. Parent PID 3610: grub-install
May 26 11:51:57 grub-installer: File descriptor 6 (/dev/ttyS1) leaked on vgs invocation. Parent PID 3610: grub-install
May 26 11:51:57 grub-installer: File descriptor 8 (/dev/sdb1) leaked on vgs invocation. Parent PID 3610: grub-install
May 26 11:51:57 grub-installer: grub-install: warning: Cannot read EFI Boot* variables.
May 26 11:51:57 grub-installer: grub-install: warning: read_file: could not read from file: Input/output error.
May 26 11:51:57 grub-installer: grub-install: warning: vars_get_variable: read_file(/sys/firmware/efi/vars/Boot0001-8be4df61-93ca-11d2-aa0d-00e098032b8c/raw_var) failed: Input/output error.
May 26 11:51:57 grub-installer: grub-install: warning: efi_get_variable: ops->get_variable failed: Input/output error.
May 26 11:51:57 grub-installer: grub-install: error: failed to register the EFI boot entry: Input/output error.
May 26 11:51:57 grub-installer: error: Running 'grub-install --force "dummy"' failed.
May 26 11:51:57 debconf: --> SUBST grub-installer/grub-install-failed BOOTDEV dummy
May 26 11:51:57 debconf: Adding [BOOTDEV] -> [dummy]
May 26 11:51:57 debconf: <-- 0
May 26 11:51:57 debconf: --> INPUT critical grub-installer/grub-install-failed
Note the failed access to /sys/firmware/efi/vars/Boot0001-8be4df61
-93ca-11d2-aa0d-00e098032b8c/raw_var
Looking at the EFI boot-related variables also fails with efibootmgr:
~ # mount -t sysfs sys /target/sys
~ # chroot /target efibootmgr
Skipping unreadable variable "Boot0001": Input/output error
BootCurrent: 0005
Timeout: 1 seconds
BootOrder: 0005,0006,0007,0008,0004,0001
Boot0004* UEFI: Built-in EFI Shell
Boot0005* UEFI: PXE IPv4 Mellanox Network Adapter - 98:03:9B:xx:xx:xx
Boot0006* UEFI: PXE IPv4 Mellanox Network Adapter - 98:03:9B:xx:xx:xx
Boot0007* UEFI: PXE IPv6 Mellanox Network Adapter - 98:03:9B:xx:xx:xx
Boot0008* UEFI: PXE IPv6 Mellanox Network Adapter - 98:03:9B:xx:xx:xx
MirroredPercentageAbove4G: 0.00
MirrorMemoryBelow4GB: false
Note again the problem with Boot001. Doing the same with a Xenial
18.04 system, there is no such error:
[08:30:21] root at cbk130411:~# efibootmgr
BootCurrent: 0005
Timeout: 1 seconds
BootOrder: 0005,0006,0007,0008,0009
Boot0001 Hard Drive
Boot0004* UEFI: Built-in EFI Shell
Boot0005* UEFI: PXE IPv4 Mellanox Network Adapter - 98:03:9B:xx:xx:xx
Boot0006* UEFI: PXE IPv4 Mellanox Network Adapter - 98:03:9B:xx:xx:xx
Boot0007* UEFI: PXE IPv6 Mellanox Network Adapter - 98:03:9B:xx:xx:xx
Boot0008* UEFI: PXE IPv6 Mellanox Network Adapter - 98:03:9B:xx:xx:xx
Boot0009* ubuntu
[08:30:07] root at cbk130411:~# efibootmgr -v
BootCurrent: 0005
Timeout: 1 seconds
BootOrder: 0005,0006,0007,0008,0009
Boot0001 Hard Drive BBS(HD,,0x0)/VenHw(5ce8128b-2cec-40f0-8372-80640e3dc858,0200)..GO..NO..........I.N.T.E.L. .S.S.D.S.C.2.K.G.4.8.0.G.8.LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG...LOTS-OF_DATA-THAT-IS-VERY-LONG.....2.B.G.N........BO
Boot0004* UEFI: Built-in EFI Shell VenMedia(5023b95c-db26-429b-a648-bd47664c8012)..BO
Boot0005* UEFI: PXE IPv4 Mellanox Network Adapter - 98:03:9B:xx:xx:xx PciRoot(0x3)/Pci(0x2,0x0)/Pci(0x0,0x0)/MAC(9803xxxxxxxx,1)/IPv4(0.0.0.0:0<->0.0.0.0:0,0,0)..BO
Boot0006* UEFI: PXE IPv4 Mellanox Network Adapter - 98:03:9B:xx:xx:xx PciRoot(0x3)/Pci(0x2,0x0)/Pci(0x0,0x1)/MAC(9803xxxxxxxx,1)/IPv4(0.0.0.0:0<->0.0.0.0:0,0,0)..BO
Boot0007* UEFI: PXE IPv6 Mellanox Network Adapter - 98:03:9B:xx:xx:xx PciRoot(0x3)/Pci(0x2,0x0)/Pci(0x0,0x0)/MAC(9803xxxxxxxx,1)/IPv6([::]:<->[::]:,0,0)..BO
Boot0008* UEFI: PXE IPv6 Mellanox Network Adapter - 98:03:9B:xx:xx:xx PciRoot(0x3)/Pci(0x2,0x0)/Pci(0x0,0x1)/MAC(9803xxxxxxxx,1)/IPv6([::]:<->[::]:,0,0)..BO
Boot0009* ubuntu HD(1,GPT,cd9cb552-6580-4f5d-9804-76166ce0de68,0x800,0x3d0000)/File(\EFI\Ubuntu\shimx64.efi)..BO
The value for Boot001 is very long, longer than 1024 bytes.
I found that there is a problem with long values:
https://www.kernel.org/doc/Documentation/filesystems/efivarfs.txt
When I retried (by hand) with Focal 20.04 after mounting efivarfs,
things worked better:
(something like this)
~ # mount -t efivarfs efivars /target/sys/firmware/efi/efivars
~ # chroot /target grub-install --target x86_64-efi --force "dummy"
Installing for x86_64-efi platform.
File descriptor 4 (/dev/sdb1) leaked on vgs invocation. Parent PID 9684: grub-install
File descriptor 4 (/dev/sdb1) leaked on vgs invocation. Parent PID 9684: grub-install
Installation finished. No error reported.
~ # chroot /target efibootmgr
BootCurrent: 0005
Timeout: 1 seconds
BootOrder: 0000,0005,0006,0007,0008,0004,000A
Boot0000* ubuntu
Boot0004* UEFI: Built-in EFI Shell
Boot0005* UEFI: PXE IPv4 Mellanox Network Adapter - 98:03:9B:xx:xx:xx
Boot0006* UEFI: PXE IPv4 Mellanox Network Adapter - 98:03:9B:xx:xx:xx
Boot0007* UEFI: PXE IPv6 Mellanox Network Adapter - 98:03:9B:xx:xx:xx
Boot0008* UEFI: PXE IPv6 Mellanox Network Adapter - 98:03:9B:xx:xx:xx
Boot000A Hard Drive
MirroredPercentageAbove4G: 0.00
MirrorMemoryBelow4GB: false
The grub-installer takes care to mount /sys into /target (without that you get even more errors about accessing EFI variables, as I discovered), but it should also mount efivarsfs.
if [ "$(udpkg --print-os)" = linux ] && [ -z "$(ls $ROOT/sys)" ]; then
mount -t sysfs sysfs $ROOT/sys && umount_on_exit /sys
fi
This is especially important since so fat I have found no way to get
this done from the preseed file.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub-installer/+bug/1880855/+subscriptions
More information about the foundations-bugs
mailing list