Re: [gentoo-user] EFI booting problem - understanding it

2020-07-02 Thread Andrew Udvare
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. You also should be careful
writing to the EFI too much as the NVRAM flash may not be of high quality.

https://lwn.net/Articles/674940/

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.

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.

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.

Andrew



signature.asc
Description: OpenPGP digital signature


Re: [gentoo-user] old kernel on Gentoo

2020-07-02 Thread james

On 6/21/20 6:31 AM, Raffaele BELARDI wrote:

-Original Message-
From: james 
Sent: Thursday, June 18, 2020 21:36
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] old kernel on Gentoo

On 6/17/20 12:52 PM, Raffaele BELARDI wrote:

Hello,

I might need to build and run an old 3.x kernel on a Desktop PC for
some very specific tests. Would Gentoo be a good solution?

I see that currently gentoo-sources only includes 4.x and 5.x sources.

Thanks,

raffaele



I use a 3.18.40 kernel, currently, on one of my AMD systems. It has
thousands of source build packages, not only from portage but many others.



What about the rest of the system, in particular GCC and the C libraries? Do 
you manage to build the 3.x kernel with up to date system or do you need to 
''freeze'' some packages?

Thanks,

raffaele




Sorry I missed this.

YES every thing else is up to date; sometimes I have to 'hack' at 
updates a few days, but most is current. Most of the old codes, are 
one's where I put the code and the ebuild together, for consistency.


Ask me anything and I'll reply with the version number. In fact, many of 
the codes are ~ so they are the latest versions. The one caveat: 
python-2.7 is a mess and I have some codes using python 3.8 and are 
asking for 3.9


dev-lang/python
 Available versions:
 (2.7)  2.7.17-r2 2.7.18
 (3.6)  3.6.10-r1(3.6/3.6m)^t 3.6.10-r2(3.6/3.6m)^t
 (3.7)  3.7.7-r1(3.7/3.7m)^t 3.7.7-r2(3.7/3.7m)^t ~3.7.8(3.7/3.7m)^t
 (3.8)  3.8.2-r1^t 3.8.2-r2^t ~3.8.3^t
 (3.9)  ~3.9.0_alpha6^t ~3.9.0_beta1^t ~3.9.0_beta2^t ~3.9.0_beta3^t



Sorry for the delayed response.

hth,
James



[gentoo-user] EFI booting problem - understanding it

2020-07-02 Thread Peter Humphrey
Morning all,

I'm trying to set the default boot entry via bootctl or efibootmgr. I know I
can set it directly by pressing D at the boot selection screen, and the system
does boot properly; I just want to understand the setup a bit better. I don't
have the rest of systemd: this is an openrc box.

# tree -L 3 /boot
/boot
├── config-5.4.48-gentoo
├── config-5.4.48-gentoo-rescue
├── config-5.7.6-gentoo
├── config-5.7.7-gentoo
├── early_ucode.cpio
├── EFI
│   ├── Boot
│   │   └── bootx64.efi
│   ├── Linux
│   ├── Microsoft
│   │   ├── Boot
│   │   └── Recovery
│   └── systemd
│   └── systemd-bootx64.efi
├── intel-uc.img
├── loader
│   ├── entries
│   │   ├── 08-gentoo-5.4.48-rescue.conf
│   │   ├── 09-gentoo-5.4.48-rescue.nonet.conf
│   │   ├── 30-gentoo-5.7.7.conf
│   │   ├── 32-gentoo-5.7.7.nox.conf
│   │   ├── 34-gentoo-5.7.7.nonet.conf
│   │   ├── 40-gentoo-5.4.48.conf
│   │   ├── 42-gentoo-5.4.48.nox.conf
│   │   └── 44-gentoo-5.4.48.nonet.conf
│   ├── loader.conf
│   └── random-seed
├── System.map-5.4.48-gentoo
├── System.map-5.4.48-gentoo-rescue
├── System.map-5.7.6-gentoo
├── System.map-5.7.7-gentoo
├── vmlinuz-5.4.48-gentoo
├── vmlinuz-5.4.48-gentoo-rescue
├── vmlinuz-5.7.6-gentoo
└── vmlinuz-5.7.7-gentoo

# bootctl status
--->8
Default Boot Loader Entry:
title: Gentoo 5.4.48 (No network)
   id: 44-gentoo-5.4.48.nonet.conf
--->8

44-gentoo-5.4.48.nonet.conf is the last entry in /boot/loader/entries.

Man bootctl says:
set-default ID, set-oneshot ID
 Sets the default boot loader entry. Takes a single boot loader entry ID
 string as argument...

But then,
# bootctl set-default 30-gentoo-5.7.7.conf
Failed to update EFI variable: Invalid argument

...in spite of this:
# cat /boot/loader/entries/30-gentoo-5.7.7.conf
title Gentoo 5.7.7
version 5.7.7-gentoo
linux vmlinuz-5.7.7-gentoo
initrd=intel-uc.img
options root=/dev/nvme0n1p4 net.ifnames=0 raid=noautodetect

...and this:
# mount | grep efi
efivarfs on /sys/firmware/efi/efivars type efivarfs 
(rw,nosuid,nodev,noexec,relatime)

I've also tried telling efibootmgr to set the default.

# efibootmgr
BootNext: 0007
BootCurrent: 0007
Timeout: 2 seconds
BootOrder: 000B,0007,0006,,000C,000D
Boot* Windows Boot Manager
Boot0006* UEFI OS
Boot0007* Linux Boot Manager
Boot000B* CD/DVD Drive 
Boot000C* Hard Drive 
Boot000D* Removable Drive 

Efibootmgr -n 7 seems to make no difference, as expected, but:
# efibootmgr -N 7
Boot entry 0001 does not exist
# cat /boot/loader/loader.conf
default 30-gentoo-5.7.7