1 |
On Saturday, 26 October 2019 12:36:56 BST Peter Humphrey wrote: |
2 |
> On Friday, 25 October 2019 16:33:07 BST Mick wrote: |
3 |
> > If you intend to have a list of available OS kernels displayed for you to |
4 |
> > choose from at boot time, then you need a Boot Manager (eLILO, GRUB, |
5 |
> > systemd- boot, et al.) and will *have* to follow the respective Boot |
6 |
> > Manager's conventions regarding its configuration and storage/naming of |
7 |
> > kernel images. |
8 |
> |
9 |
> That's the key. It's clear that I haven't understood what was going on until |
10 |
> now. Mind you, I've not been helped by the plethora of mutually |
11 |
> contradictory wiki and other articles purporting to guide me through the |
12 |
> boot process - for instance, should my boot partition (FAT32) be mounted on |
13 |
> /efi, /boot or /boot/efi? All are recommended in various places. Mine is on |
14 |
> /boot. |
15 |
|
16 |
Your $BOOT partition should be set as type ESP (i.e. with GUID C12A7328- |
17 |
F81F-11D2-BA4B-00A0C93EC93B), or as 'Linux Extended Boot' (GUID |
18 |
BC13C2FF-59E6-4262-A352-B275FD6F7172),[1] as long as this is a disk with a GPT |
19 |
rather than MBR partition table. |
20 |
|
21 |
[1] The 'Linux Extended Boot' partition type as called by fdisk is typically |
22 |
used when the ESP is too small to contain all OS kernels, Boot Manager files |
23 |
and UEFI applications. You'll need to set the ESP partition type using a |
24 |
partition manager, like gdisk, parted, fdisk. |
25 |
|
26 |
The filesystem on $BOOT should be FAT32 (although it can be FAT12, or FAT16). |
27 |
|
28 |
The $BOOT partition should be mounted on mountpoint /boot. |
29 |
|
30 |
In its filesystem-root, boot/ should have a directory EFI/, i.e. /boot/EFI. |
31 |
Any OS system kernel images you expect the UEFI boot manager to autodetect and |
32 |
list in its own firmware/BIOS GUI should be added in /boot/EFI/, each one in a |
33 |
separate subdirectory suitably named to identify the OS. |
34 |
|
35 |
In boot/EFI should also be the subdirectory boot/EFI/BOOT/, in which the |
36 |
default fall-back OS kernel image should be stored. The UEFI boot manager |
37 |
will boot this kernel image if other kernel images fail to boot. Removable |
38 |
devices can have more than one subdirectory with a kernel image in them, in |
39 |
boot/EFI/BOOT/, to automatically boot one of them. |
40 |
|
41 |
The above is no gospel, indeed some binary distros install /boot/efi/EFI and |
42 |
drop their Boot Manager's grubX64.efi in some suitably named subdirectory in |
43 |
there, but you get the gist. |
44 |
|
45 |
|
46 |
> To sum up: I didn't need efibootmgr at all, except to remove an entry I'd |
47 |
> created before. I did need bootctl from sys-boot/systemd-boot, and I had to |
48 |
> 'bootctl install' it without any configuration files under /boot. I also |
49 |
> needed a machine ID in /etc/machine-id, without which 'bootctl install' |
50 |
> refused to do anything. |
51 |
|
52 |
systemd-boot uses the machine-id[2] in its nomenclature for each OS installed |
53 |
on this hardware and it also creates a correspondingly named subdirectory |
54 |
within /boot/ for OS kernel images and associated files to be dropped in there |
55 |
by binary distros' kernel installer scripts. Without a machine-id I would |
56 |
think systemd-boot would cough loudly when you try to install it, just as you |
57 |
report. The same machine-id is subsequently used for the naming of .conf |
58 |
files for each OS/kernel - see below. |
59 |
|
60 |
[2] If there is no /etc/machine-id check for /var/lib/dbus/machine-id. The |
61 |
machine-id is generated at install time, by dbus. On my system /var/lib/dbus/ |
62 |
machine-id is a symlink to /etc/machine-id. |
63 |
|
64 |
|
65 |
> The procedure was: |
66 |
> |
67 |
> 1. Format /dev/nvme0n1p2 as FAT32 and mount it on /boot. |
68 |
> 2. Build and install the kernel. |
69 |
> 3. Run bootctl install. |
70 |
> 4. Write /boot/loader/loader.conf, and suitable .conf files under |
71 |
> /boot/loader/entries. |
72 |
> |
73 |
> That still left an empty /boot/<machine-id> directory. I may risk removing |
74 |
> it some time. |
75 |
|
76 |
I wouldn't do such a thing, but YMMV. If your intention is to use systemd- |
77 |
boot as the Boot Manager of choice, I would try moving all kernels and |
78 |
associated files to your /boot/<machine-id>/ subdirectory. |
79 |
|
80 |
Then create corresponding /boot/loader/entries/*.conf files, which according |
81 |
to the systemd boot loader specification should be named like so: |
82 |
|
83 |
/boot/loader/entries/4eec63dc92f83de25e1e2e485d7f6536-4.19.72-gentoo.conf |
84 |
|
85 |
/boot/loader/entries/<machine-id>-<kernel_version>.<os-release-ID>.conf |
86 |
|
87 |
For <kernel_version> use the output of 'uname -r'. |
88 |
|
89 |
For <os-release-ID> use the ID field of /etc/os-release. You may 'find uname |
90 |
-r' and os-release-ID are the same on your Gentoo installation. |
91 |
|
92 |
The contents of the file should look like so: |
93 |
|
94 |
title 08-gentoo-4.19.72-rescue (My rescue kernel) |
95 |
version 4.19.72-gentoo |
96 |
machine-id 4eec63dc92f83de25e1e2e485d7f6536 |
97 |
options root=/dev/nvme0n1p4 net.ifnames=0 |
98 |
architecture x64 |
99 |
linux /4eec63dc92f83de25e1e2e485d7f6536/4.19.72-gentoo/linux |
100 |
initrd /4eec63dc92f83de25e1e2e485d7f6536/4.19.72-gentoo/initrd |
101 |
|
102 |
For 'title' you can use the PRETTY_NAME in /etc/os-release, or whatever you |
103 |
want displayed in the boot menu to differentiate visibly this menu entry from |
104 |
all others. |
105 |
|
106 |
For 'version' you can use the kernel version you want to boot with, but it is |
107 |
an optional field. |
108 |
|
109 |
Machine-id is also optional, but it helps to differentiate between various |
110 |
installations. |
111 |
|
112 |
'linux' and 'initrd' fields show the relative path(s) where your vmlinuz and |
113 |
initrd.img files are stored. |
114 |
|
115 |
I hope the above works for you with systemd-boot and helps customise its boot |
116 |
menu to your liking. |
117 |
|
118 |
-- |
119 |
Regards, |
120 |
|
121 |
Mick |