I tried to prove whether or not this is a firmware issue or, perhaps, a bug in efibootmgr or curtin's calling of it. I deployed an affected system w/ MAAS w/ init=/bin/bash on the cmdline, and was surprised to see that efibootmgr showed the full expected set of Boot variables. However, if I ssh'd in while MAAS was deploying, efibootmgr was missing some. Turns out this depends on which virtual file system efibootmgr is using.
efivarfs is commonly mounted under /sys/firmware/efi/efivars, and is what efibootmgr prefers:
I tried to prove whether or not this is a firmware issue or, perhaps, a bug in efibootmgr or curtin's calling of it. I deployed an affected system w/ MAAS w/ init=/bin/bash on the cmdline, and was surprised to see that efibootmgr showed the full expected set of Boot variables. However, if I ssh'd in while MAAS was deploying, efibootmgr was missing some. Turns out this depends on which virtual file system efibootmgr is using.
efivarfs is commonly mounted under /sys/firmware/ efi/efivars, and is what efibootmgr prefers:
$ ls /sys/firmware/ efi/efivars | grep ^Boot efi/efivars' : Input/output error 7683c190- 9523-4402- 81ff-a11e93dc38 9c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c rt-8be4df61- 93ca-11d2- aa0d-00e098032b 8c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c
ls: reading directory '/sys/firmware/
Boot mode select-
Boot0000-
BootCurrent-
BootOptionSuppo
BootOrder-
If /sys/firmware/ efi/efivars is not there, efibootmgr appears to fallback to /sys/firmware/ efi/vars which the kernel always exposes:
$ ls /sys/firmware/ efi/vars | grep ^Boot 7683c190- 9523-4402- 81ff-a11e93dc38 9c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c rt-8be4df61- 93ca-11d2- aa0d-00e098032b 8c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c
Boot mode select-
Boot0000-
Boot0001-
Boot0003-
Boot0004-
Boot0005-
Boot0006-
BootCurrent-
BootOptionSuppo
BootOrder-
With init=/bin/bash, efivarfs is not yet mounted, which is why I see the full set at that point.
So why are these variables not visible in efivarfs? And does the "Input/output error" ls reports have something to do with it?
strace shows that the -EIO is coming from a getdents64() call:
openat(AT_FDCWD, "/sys/firmware/ efi/efivars/ ", O_RDONLY| O_NONBLOCK| O_CLOEXEC| O_DIRECTORY) = 3 S_IFDIR| 0755, st_size=0, ...}) = 0
fstat(3, {st_mode=
getdents64(3, /* 65 entries */, 32768) = 4800
getdents64(3, 0x5625e2d36510, 32768) = -1 EIO (Input/output error)
I built a 5.10-rc1+ kernel to see if this is maybe a kernel but that was already fixed upstream.
Turns out, the issue goes away there:
$ ls /sys/firmware/ efi/efivars | grep ^Boot 7683c190- 9523-4402- 81ff-a11e93dc38 9c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c rt-8be4df61- 93ca-11d2- aa0d-00e098032b 8c 8be4df61- 93ca-11d2- aa0d-00e098032b 8c
Boot mode select-
Boot0000-
Boot0001-
Boot0003-
Boot0004-
Boot0005-
Boot0006-
BootCurrent-
BootOptionSuppo
BootOrder-
I'm now trying to determine what changed in the kernel.