Gentoo Archives: gentoo-user

From: Peter Humphrey <peter@××××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] EFI booting problem - understanding it
Date: Fri, 03 Jul 2020 14:52:54
Message-Id: 12579080.uLZWGnKmhe@peak
In Reply to: Re: [gentoo-user] EFI booting problem - understanding it by Andrew Udvare
1 On Friday, 3 July 2020 03:05:34 BST Andrew Udvare wrote:
2 > On 02/07/2020 06:56, Peter Humphrey wrote:
3 > > But then,
4 > > # bootctl set-default 30-gentoo-5.7.7.conf
5 > > Failed to update EFI variable: Invalid argument
6 >
7 > Probably the kernel is blocking write access to EFI. This is on purpose
8 > for safety as you can damage your firmware quite easily. systemd-boot
9 > and others do not have this restriction.
10
11 Is there some way for me to remove this restriction temporarily?
12
13 > You also should be careful writing to the EFI too much as the NVRAM flash may
14 > not be of high quality.
15
16 Yes, I do only write to it when I have to. I hope Asus would use decent-
17 quality components though.
18
19 > https://lwn.net/Articles/674940/
20
21 Interesting - thanks.
22
23 > You can try using `chattr -i` against the files like:
24 >
25 > chattr -i /sys/firmware/efi/efivars/Boot*
26 >
27 > Then you can try with bootctl and others, but this is not guaranteed to
28 > work.
29
30 Those files were already among the 17 that were mutable. It seems I need to find
31 which of the other 117 files I need to make mutable.
32
33 > On my ASUS motherboard I haven't been able to write to EFI variables
34 > from within Linux for a long time. I have to add my keys in the BIOS and
35 > set the default in systemd-boot.
36
37 Looks like I'm in the same boat. Except that setting the default in systemd-
38 boot is exactly what I can't do!
39
40 > The logic to write to a file in efivars is here:
41 >
42 > https://github.com/torvalds/linux/blob/master/fs/efivarfs/file.c#L15
43 >
44 > If you use strace with bootctl you'll probably see one of these errno
45 > values.
46
47 I think what I'm seeing comes from this:
48
49 if (attributes & ~(EFI_VARIABLE_MASK))
50 return -EINVAL;
51
52 Perhaps I should just stop here and revert to setting the default at the UEFI
53 boot-choice screen.
54
55 Many thanks for your help, Andrew.
56
57 --
58 Regards,
59 Peter.

Replies

Subject Author
Re: [gentoo-user] EFI booting problem - understanding it Sid Spry <sid@××××.us>