grub-installer should mount efivarfs
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grub-installer (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
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(
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/
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/
Note the failed access to /sys/firmware/
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,
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
MirroredPercent
MirrorMemoryBel
Note again the problem with Boot001. Doing the same with a Xenial 18.04 system, there is no such error:
[08:30:21] root@cbk130411:~# efibootmgr
BootCurrent: 0005
Timeout: 1 seconds
BootOrder: 0005,0006,
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@cbk130411:~# efibootmgr -v
BootCurrent: 0005
Timeout: 1 seconds
BootOrder: 0005,0006,
Boot0001 Hard Drive BBS(HD,
Boot0004* UEFI: Built-in EFI Shell VenMedia(
Boot0005* UEFI: PXE IPv4 Mellanox Network Adapter - 98:03:9B:xx:xx:xx PciRoot(
Boot0006* UEFI: PXE IPv4 Mellanox Network Adapter - 98:03:9B:xx:xx:xx PciRoot(
Boot0007* UEFI: PXE IPv6 Mellanox Network Adapter - 98:03:9B:xx:xx:xx PciRoot(
Boot0008* UEFI: PXE IPv6 Mellanox Network Adapter - 98:03:9B:xx:xx:xx PciRoot(
Boot0009* ubuntu HD(1,GPT,
The value for Boot001 is very long, longer than 1024 bytes.
I found that there is a problem with long values: https:/
When I retried (by hand) with Focal 20.04 after mounting efivarfs, things worked better:
(something like this)
~ # mount -t efivarfs efivars /target/
~ # 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,
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
MirroredPercent
MirrorMemoryBel
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.
Status changed to 'Confirmed' because the bug affects multiple users.