1 |
On Tuesday, 25 May 2021 16:23:01 BST Peter Humphrey wrote: |
2 |
|
3 |
> Thanks for the offer, Michael, but let me clear a few things up first. |
4 |
> |
5 |
> 1. I don't use symlinks in /boot. |
6 |
|
7 |
This allows a simpler single boot partition (ESP) & filesystem set up (VFAT). |
8 |
|
9 |
|
10 |
> 2. I don't use grub, nor any other boot manager. |
11 |
|
12 |
From what you've written below you have installed and now use systemd-boot. |
13 |
|
14 |
|
15 |
> 3. ...unless you count bootctl, from sys-boot/systemd-boot. |
16 |
|
17 |
OK, bootctl is a command interfacing with the UEFI firmware API, while |
18 |
systemd-boot, once you install it, is a 3rd party boot manager as I've |
19 |
mentioned in my previous message. |
20 |
|
21 |
Disambiguation: |
22 |
|
23 |
a) UEFI boot manager - the 'native' EEPROM based UEFI boot loader/manager. It |
24 |
scans all .efi executables, inc. Linux et al OS kernel images stored on the |
25 |
ESP; updates and stores a list of .efi executables in its database and; |
26 |
presents them in the UEFI boot menu as manually selectable boot options. |
27 |
Unless the user enters the UEFI boot menu at start up, by pressing a key like |
28 |
F2, the first .efi executable on the list will be loaded and run. The list of |
29 |
executables can be manipulated using the efibootmgr command, or the UEFI menu |
30 |
interface itself. |
31 |
|
32 |
b) efibootmgr - a userspace command interfacing with the UEFI firmware API, |
33 |
used to manipulated the UEFI executable applications listed in the UEFI |
34 |
database. |
35 |
|
36 |
c) bootctl - a userspace command interfacing with the UEFI firmware API like |
37 |
efibootmgr and also with the systemd-boot boot manager (if installed). |
38 |
|
39 |
d) systemd-boot - a 3rd party boot manager (like GRUB, rEFInd, syslinux, |
40 |
etc.). |
41 |
|
42 |
|
43 |
> 4. I have the existing ESP mounted on /boot. It belongs to Windows and |
44 |
> cannot be enlarged beyond 100MB. |
45 |
|
46 |
This should not be a problem per se, unless bootctl & systemd-boot, with its |
47 |
own Boot Loader specification limitations, *must* be used as their developers |
48 |
intended (more below). For example, on this box I have: |
49 |
|
50 |
# du -s -h /boot/*/* |
51 |
3.1M /boot/BOOT/boot.sdi |
52 |
1.6M /boot/EFI/Boot |
53 |
27M /boot/EFI/Gentoo |
54 |
25M /boot/EFI/Microsoft |
55 |
|
56 |
My ESP is 273MB, but the MSWindows boot files plus Gentoo with two kernels (no |
57 |
initrd.gz) take up only 56.7M. I could add two more kernels in there and |
58 |
still receive change from 100M - mind you some kernels are more frugally |
59 |
configured than others. |
60 |
|
61 |
I notice you have /dev/nvme1n1p1 named as "boot". Is this a secondary boot |
62 |
partition? What is its mountpoint? What does it contain? |
63 |
|
64 |
|
65 |
> 5. I have a small second system on the Gentoo disk called Rescue, so I have |
66 |
> a multiple-boot system. |
67 |
> |
68 |
> # tree -L 3 /boot |
69 |
> /boot |
70 |
> ├── EFI |
71 |
> │ ├── Boot |
72 |
> │ │ └── bootx64.efi |
73 |
> │ ├── Linux |
74 |
> │ ├── Microsoft |
75 |
> │ │ ├── Boot |
76 |
> │ │ └── Recovery |
77 |
> │ └── systemd |
78 |
> │ └── systemd-bootx64.efi |
79 |
> ├── System.map-5.10.27-gentoo |
80 |
> ├── System.map-5.10.27-gentoo-rescue |
81 |
> ├── amd-uc.img |
82 |
> ├── config-5.10.27-gentoo |
83 |
> ├── config-5.10.27-gentoo-rescue |
84 |
> ├── loader |
85 |
> │ ├── entries |
86 |
> │ │ ├── 08-gentoo-rescue-5.10.27.conf |
87 |
> │ │ ├── 09-gentoo-rescue-5.10.27.nonet.conf |
88 |
> │ │ ├── 30-gentoo-5.10.27.conf |
89 |
> │ │ ├── 32-gentoo-5.10.27.nox.conf |
90 |
> │ │ └── 34-gentoo-5.10.27.nonet.conf |
91 |
> │ ├── loader.conf |
92 |
> │ └── random-seed |
93 |
> ├── vmlinuz-5.10.27-gentoo |
94 |
> └── vmlinuz-5.10.27-gentoo-rescue |
95 |
> |
96 |
> # parted -l |
97 |
> [...] |
98 |
> Model: Samsung SSD 970 EVO Plus 250GB (nvme) |
99 |
> Disk /dev/nvme0n1: 250GB |
100 |
> Sector size (logical/physical): 512B/512B |
101 |
> Partition Table: gpt |
102 |
> Disk Flags: |
103 |
> |
104 |
> Number Start End Size File system Name Flags |
105 |
> 1 1049kB 106MB 105MB fat32 EFI system partition boot, esp |
106 |
> 2 106MB 123MB 16.8MB Microsoft reserved partition |
107 |
> msftres |
108 |
> 3 123MB 249GB 249GB ntfs Basic data partition msftdata |
109 |
> 4 249GB 250GB 580MB ntfs Basic data partition hidden, |
110 |
> diag |
111 |
> |
112 |
> Model: Samsung SSD 970 EVO Plus 250GB (nvme) |
113 |
> Disk /dev/nvme1n1: 250GB |
114 |
> Sector size (logical/physical): 512B/512B |
115 |
> Partition Table: gpt |
116 |
> Disk Flags: |
117 |
> |
118 |
> Number Start End Size File system Name Flags |
119 |
> 1 1049kB 269MB 268MB ext4 boot |
120 |
> 2 269MB 34.6GB 34.4GB linux-swap(v1) swap-1 swap |
121 |
> 3 34.6GB 51.8GB 17.2GB ext4 rescue |
122 |
> 4 51.8GB 86.2GB 34.4GB ext4 root |
123 |
> 5 86.2GB 90.5GB 4295MB ext4 local |
124 |
> 6 90.5GB 103GB 12.9GB ext4 home |
125 |
> 7 103GB 129GB 25.8GB ext4 common |
126 |
> [...] |
127 |
> |
128 |
> I followed the installation handbook, boot-loader section, to create a UEFI |
129 |
> boot entry. I followed the syntax precisely, with several variations at |
130 |
> various attempts. In every case, the UEFI BIOS listed the new entry but |
131 |
> couldn't execute it. |
132 |
|
133 |
This should work to launch your systemd-boot: |
134 |
|
135 |
efibootmgr --create --disk /dev/nvme0n1 --part 1 --label "systemd-boot" -- |
136 |
loader "\EFI\Boot\bootx64.efi" |
137 |
|
138 |
This would also work, if vmlinuz-5.10.27-gentoo, config-5.10.27-gentoo, and |
139 |
System.map-5.10.27-gentoo are stored on the ESP under the EFI/ directory, e.g. |
140 |
in EFI/Linux/, to launch your current kernel directly: |
141 |
|
142 |
efibootmgr --create --disk /dev/nvme0n1 --part 1 --label "Gentoo-5.10.27" -- |
143 |
loader "\EFI\Linux\vmlinuz-5.10.27-gentoo" |
144 |
|
145 |
NOTE: According to its specification, the systemd-boot requires a boot |
146 |
partition "... large enough (let’s say 250MB) ...". If it is smaller, "... a |
147 |
new suitably sized (let’s say 500MB) XBOOTLDR partition ..." is meant to be |
148 |
created to be used as $BOOT. I suppose this is to allow enough space for the |
149 |
devs of various Linux distributions to auto-drop their kernels in there |
150 |
without running out of space. |
151 |
|
152 |
Other 3rd party boot managers are not as demanding. |
153 |
|
154 |
|
155 |
> I want to be shown a list of systems to boot immediately after the POST, |
156 |
> which I'm sure efibootmgr can't do, |
157 |
|
158 |
Right, efibootmgr can be run in a console/terminal on an already up and |
159 |
running Linux OS. Just like bootctl. Neither of them can run immediately |
160 |
after POST, because they are not efi applications. |
161 |
|
162 |
Typically, UEFI firmware do not present a list of efi applications to the user |
163 |
- unless you interrupt the boot process and get into the UEFI menu by pressing |
164 |
an appropriate key. The UEFI firmware will always load and execute the first |
165 |
item on its list, if left to its own devices. If the first item is |
166 |
misconfigured/missing, it'll try to run the next one and so on. |
167 |
|
168 |
|
169 |
> so I ran 'bootctl install' to install |
170 |
> the code (where?) to give me the ability. |
171 |
|
172 |
The systemd-boot installs its efi executable in two places: |
173 |
|
174 |
a) EFI/systemd/systemd-bootx64.efi |
175 |
|
176 |
b) EFI/Boot/bootx64.efi <== Default/fall back efi executable |
177 |
|
178 |
while at the same time it adds it as the first entry in the UEFI firmware boot |
179 |
list, so it is loaded and executed first by the firmware. Once it is launched |
180 |
the systemd-boot will read its own loader configuration files and present a |
181 |
list to the user. |
182 |
|
183 |
|
184 |
> That works, though I do remove |
185 |
> the directory with the 32-hex-digit name, and install my own loader.conf. |
186 |
|
187 |
Sure, the systemd-boot loader configuration files can be edited and |
188 |
overwritten. |
189 |
|
190 |
|
191 |
> The system seems to be stable now. |
192 |
|
193 |
Which is a good enough proof your configuration just works(TM). :-) |
194 |
|
195 |
If it suits your needs, then arguably you don't need to do anything else. If |
196 |
it doesn't suit your needs quite right, you could seek alternatives. I can |
197 |
think of 2 other options you may want to look into. |
198 |
|
199 |
1. A minimalist option is to not use any 3rd party boot manager and stick with |
200 |
the MoBo's UEFI firmware. By default and without intervention, you will |
201 |
always boot the first ordered entry in the UEFI boot menu, without delay. |
202 |
When you need an alternative kernel/OS, you will press the appropriate key |
203 |
during POST to enter the UEFI menu and select another entry from its boot menu |
204 |
manually. The efibootmgr will have to be used every time you install a new |
205 |
kernel to update/configure the UEFI boot menu list. |
206 |
|
207 |
2. Use some other better suited 3rd party boot manager (not systemd-boot). |
208 |
The principle is broadly the same as your present setup. Each boot manager |
209 |
has its own idiosyncrasies and commands of choice. GRUB is quite automated, |
210 |
although you can overwrite its grub.conf menu and decline using update-grub, |
211 |
or grub-mkconfig to generate it. Then again, why would you select such a |
212 |
heavily automated and complicated piece of software, only to bypass the very |
213 |
functionality its devs wanted to offer? Contrastingly, syslinux is very |
214 |
simple and lightweight, but you have to manually configure its also very |
215 |
simple boot menu. |
216 |
|
217 |
PS. The UEFI firmware will scan more than a single VFAT partition marked as |
218 |
ESP type, but as far as I know this will only work if the ESP is on the first |
219 |
disk - I haven't tried it. |