efivar fails to read variables
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
efivar (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
linux-meta-riscv (Ubuntu) |
In Progress
|
High
|
Unassigned |
Bug Description
On riscv64 StarFive VisionFive 2 with U-Boot v2023.10-rc4 and kernel 6.5.0-2-generic we see this output:
root@ubuntu-
AuditMode-
DeployedMode-
OsIndicationsSu
PlatformLang-
PlatformLangCod
SecureBoot-
SetupMode-
VendorKeys-
root@ubuntu-
efivar: error listing variables: Function not implemented
root@ubuntu-
EFI variables are not supported on this system.
Expected behavior would be to display the variables.
tags: | added: foundations-todo |
tags: | added: fr-5276 |
tags: | added: patch |
The problem is due to the kernel not supporting the deprecated statfs() call on the efivarfs file system.
To demonstrate this I have created the following program (statfs.c):
#include <sys/vfs.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
struct statfs s;
int ret;
if (argc < 2) {
printf( "usage: %s <dirpath>\n", argv[0]);
return 1;
}
ret = statfs(argv[1], &s);
perror( "statfs" );
return 1;
printf( "%s type: 0x%llx\n", argv[1],
(unsigned long long)s.f_type);
if (ret == -1) {
} else {
}
return 0;
}
When I run it I get the following output:
$ ./statfs /sys/firmware/efi efi/efivars/ efi/efivars type efivarfs (ro,nosuid, nodev,noexec, relatime)
/sys/firmware/efi type: 0x62656572
$ ./statfs /sys/firmware/
statfs: Invalid argument
$ mount | grep efivarfs
efivarfs on /sys/firmware/
Though efivarfs is mounted on /sys/firmware/ efi/efivars the statfs call fails.