Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] UEFI data corruption? [FIXED-FIXED]
Date: Wed, 02 Oct 2019 09:04:52
Message-Id: CAGOe-exyTM57nmbjFCotJE=dJBNLuTjYVqq3c-f_s8r-FLJbnw@mail.gmail.com
In Reply to: Re: [gentoo-user] UEFI data corruption? [FIXED-FIXED] by Peter Humphrey
1 On Tue, 1 Oct 2019 at 22:38, Peter Humphrey <peter@××××××××××××.uk> wrote:
2 >
3 > On Tuesday, 1 October 2019 18:47:25 BST Mick wrote:
4 >
5 > > As I understand it this ID must be the ID bootctl itself reports.
6 > > However, earlier bootctl versions do not have this set-default ID
7 > > subcommand. If you run bootctl with no arguments does it show up?
8 >
9 > No, it behaves the same as 'bootctl status'.
10
11 OK, 'bootctl --help' and 'man bootctl' ought to show if the installed
12 version comes with the full list of options or not.
13
14
15 > > If you follow the UEFI spec and store one kernel per EFI/
16 > > subdirectory, the UEFI firmware will pick them up on its own and the
17 > > efibootmgr will list them.
18 > >
19 > > I would think bootctl will also pick them up and add them in its own menu.
20 >
21 > My impression is that efibootmgr only picks up what it's written itself, and
22 > what the BIOS has filled in. Bootctl does do as you say, though.
23
24 The efibootmgr is just a userspace application which interacts with
25 the UEFI firmware's API to modify the UEFI NVRAM boot manager data.
26 Unless *you* run it explicitly to change or list the UEFI boot
27 entries, it will not do anything.
28
29 The probing and listing of boot entries is not performed by the
30 efibootmgr application, but by the UEFI boot manager itself. The UEFI
31 boot manager probes the disks for an ESP and then reads and lists the
32 .efi files in the ESP, provided these were stored as per the UEFI
33 specification.
34
35 The systemd-boot/bootctl reads all /loader/entries/*.conf, and
36 populates its boot menu with these. However, /loader/entries/*.conf
37 files can be generated automagically, as long as you follow the
38 systemd boot loader specification – yes, I know, yet another
39 specification! According to this specification you can/must:
40
41 For NON-UEFI bootable images:
42
43 1. Drop in the ”$BOOT/loader/entries/ directory one or more
44 configuration snippets with the suffix “.conf one for each boot menu
45 item.
46 2. To differentiate between OS installations and a number of kernels
47 in each installation you may name each .conf file by including the
48 machine ID (/etc/machine-id or the D-Bus machine ID for OSes that lack
49 /etc/machine-id), the kernel version (as returned by uname -r) and an
50 OS identifier (The ID field of /etc/os-release). These will be used
51 to prioritise menu entries.
52
53 For UEFI bootable images:
54
55 3. Add kernels, initrds, et al. in $BOOT/EFI/Linux/ – the bootable
56 image should have an .efi suffix.
57 4. It is recommended to place these files in a vendor and OS and
58 installation specific directory.
59
60 More and better detailed information can be found in the spec:
61
62 https://systemd.io/BOOT_LOADER_SPECIFICATION.html
63
64
65 > > If you use a suitable alphanumeric nomenclature to elevate the
66 > > subdirectory of your kernel of choice, it should be selected as the
67 > > default (hopefully).
68 >
69 > Nope:
70 >
71 > # tree /boot/EFI
72 > /boot/EFI
73 > ├── BOOT
74 > │ └── BOOTX64.EFI
75 > ├── systemd
76 > │ └── systemd-bootx64.efi
77 > └── TestSys
78 > └── BOOT
79 > └── bootX64.efi
80
81 The 'BOOT' subdirectory has a specific function, as I mentioned
82 before. It is the fallback bootable image, when others fail. I
83 suppose the first BOOT subdirectory will take precedence, but having
84 two of those might confuse matters during parsing of images.
85
86
87 > # ls /boot/loader/entries
88 > 08-gentoo-4.19.66-rescue.conf 40-gentoo-4.19.66.conf
89 > 09-gentoo-4.19.66-rescue.nonet.conf 42-gentoo-4.19.66.nox.conf
90 > 30-gentoo-4.19.72.conf 44-gentoo-4.19.66.nonet.conf
91 > 32-gentoo-4.19.72.nox.conf 90-testsys-4.19.72.conf
92 > 34-gentoo-4.19.72.nonet.conf 92-testsys-4.19.72.nonet.conf
93 >
94 > Bootctl has picked the test system as its default (90-testsys-4.19.72), and
95 > the boot menu comes up with it selected; that's why I want to change bootctl's
96 > default selection. The two files bootx64.efi (modulo case) are identical
97 > kernel images except for CONFIG_LOCALVERSION="<...>".
98
99 Right, I don't know why the bootctl parses the entries .conf files in
100 this particular order. The spec suggests to use a naming convention
101 as per 2. above which *should* work with less effort.
102
103
104 > > Meanwhile, assuming you have set the systemd-boot timeout to a value
105 > > greater than 0, you could try pressing 'd' after you move the cursor
106 > > to the desired kernel image. I think it sets the selected image as a
107 > > default, but I don't have a systemd-boot available to see if it merely
108 > > boots the existing default setting.
109 >
110 > That's it! I didn't know about that - where is it documented?
111
112 Have you looked at the fine manual for 'systemd-boot'? :-)
113
114 > Thank you for your own patience, Mick. :)
115
116 Don't mention it - I'm a sucker for a challenge involving software
117 creations I care not use myself! LOL!
118 --
119 Regards,
120 Mick

Replies

Subject Author
Re: [gentoo-user] UEFI data corruption? [FIXED-FIXED] Peter Humphrey <peter@××××××××××××.uk>