In the context of a automatic preseed / subiquity installation usage of the efitools fails inside the target chroot provided by the curtin tool. curtin does setup the sys and efivarfs filesystems correctly:
curtin in-target --target=/target -- efi-readvar
No efivarfs filesystem is mounted
efitools is using the mount util while searching for the efivarfs. It's parsing the output of "mount -l". This error is not triggered by the successfully mounted efivarfs but by parsing the mount list while searching for the efivarfs. The subiquity system provides one relative unusual mount entry which let the parser of efitools stop working even if the efivarfs is mounted:
curtin in-target --target=/target -- mount -l
...
/ubuntu-21.10-live-server-amd64.iso (deleted) on /cdrom type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048) [Ubuntu-Server 21.10 amd64]
...
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
...
On the Ubuntu ISO line the keyword "(deleted)" is unsupported by the parser of efitools in efitools/lib/kernel_efivars.c
I'm not really sure if this is maybe a bug of the mount util, but anyway it is probably better to skip lines which can not be parsed successfully instead of stopping work completely.
Attached is a simple and maybe suboptimal patch to skip lines which doesn't return the expected number of found arguments, which in turn skips all unexpected lines, so that finally the efivarfs can be found the the tools like efi-readvar and efi-updatevar are working.
In the context of a automatic preseed / subiquity installation usage of the efitools fails inside the target chroot provided by the curtin tool. curtin does setup the sys and efivarfs filesystems correctly:
curtin in-target --target=/target -- efi-readvar
No efivarfs filesystem is mounted
efitools is using the mount util while searching for the efivarfs. It's parsing the output of "mount -l". This error is not triggered by the successfully mounted efivarfs but by parsing the mount list while searching for the efivarfs. The subiquity system provides one relative unusual mount entry which let the parser of efitools stop working even if the efivarfs is mounted:
curtin in-target --target=/target -- mount -l 21.10-live- server- amd64.iso (deleted) on /cdrom type iso9660 (ro,relatime, nojoliet, check=s, map=n,blocksize =2048) [Ubuntu-Server 21.10 amd64] efi/efivars type efivarfs (rw,nosuid, nodev,noexec, relatime)
...
/ubuntu-
...
efivarfs on /sys/firmware/
...
On the Ubuntu ISO line the keyword "(deleted)" is unsupported by the parser of efitools in efitools/ lib/kernel_ efivars. c
I'm not really sure if this is maybe a bug of the mount util, but anyway it is probably better to skip lines which can not be parsed successfully instead of stopping work completely.
Attached is a simple and maybe suboptimal patch to skip lines which doesn't return the expected number of found arguments, which in turn skips all unexpected lines, so that finally the efivarfs can be found the the tools like efi-readvar and efi-updatevar are working.