From: "Sid Spry" <sid@aeam.us>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] EFI booting problem - understanding it
Date: Fri, 03 Jul 2020 15:57:37 -0500 [thread overview]
Message-ID: <ad63ee1b-6284-443b-ad6c-29fd36e29035@www.fastmail.com> (raw)
In-Reply-To: <12579080.uLZWGnKmhe@peak>
On Fri, Jul 3, 2020, at 9:52 AM, Peter Humphrey wrote:
> On Friday, 3 July 2020 03:05:34 BST Andrew Udvare wrote:
> > On 02/07/2020 06:56, Peter Humphrey wrote:
> > > But then,
> > > # bootctl set-default 30-gentoo-5.7.7.conf
> > > Failed to update EFI variable: Invalid argument
> >
> > Probably the kernel is blocking write access to EFI. This is on purpose
> > for safety as you can damage your firmware quite easily. systemd-boot
> > and others do not have this restriction.
>
> Is there some way for me to remove this restriction temporarily?
>
> > You also should be careful writing to the EFI too much as the NVRAM flash may
> > not be of high quality.
>
> Yes, I do only write to it when I have to. I hope Asus would use decent-
> quality components though.
>
They may not have a choice. The flash memory made for "embedded" applications can be very low quality.
Typically I see write capability maxing out at 100k. Some devices only offer 10k due to inappropriate cost optimization. These numbers can be particularly visible if there is no wear levelling, which there usually isn't.
Anything higher seems to be only available for storage applications.
> > https://lwn.net/Articles/674940/
>
> Interesting - thanks.
>
> > You can try using `chattr -i` against the files like:
> >
> > chattr -i /sys/firmware/efi/efivars/Boot*
> >
> > Then you can try with bootctl and others, but this is not guaranteed to
> > work.
>
> Those files were already among the 17 that were mutable. It seems I
> need to find
> which of the other 117 files I need to make mutable.
>
> > On my ASUS motherboard I haven't been able to write to EFI variables
> > from within Linux for a long time. I have to add my keys in the BIOS and
> > set the default in systemd-boot.
>
> Looks like I'm in the same boat. Except that setting the default in systemd-
> boot is exactly what I can't do!
>
> > The logic to write to a file in efivars is here:
> >
> > https://github.com/torvalds/linux/blob/master/fs/efivarfs/file.c#L15
> >
> > If you use strace with bootctl you'll probably see one of these errno
> > values.
>
> I think what I'm seeing comes from this:
>
> if (attributes & ~(EFI_VARIABLE_MASK))
> return -EINVAL;
>
> Perhaps I should just stop here and revert to setting the default at the UEFI
> boot-choice screen.
>
> Many thanks for your help, Andrew.
>
> --
> Regards,
> Peter.
>
>
>
>
>
prev parent reply other threads:[~2020-07-03 20:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-02 10:56 [gentoo-user] EFI booting problem - understanding it Peter Humphrey
2020-07-03 2:05 ` Andrew Udvare
2020-07-03 8:36 ` Michael
2020-07-03 14:52 ` Peter Humphrey
2020-07-03 20:57 ` Sid Spry [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ad63ee1b-6284-443b-ad6c-29fd36e29035@www.fastmail.com \
--to=sid@aeam.us \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox