Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] UEFI data corruption? [FIXED]
Date: Sun, 29 Sep 2019 10:59:21
Message-Id: CAGOe-ey+GYSys80vEmPCKdH2bCxcXG5wk75tAZEsfsigB-mFgQ@mail.gmail.com
In Reply to: Re: [gentoo-user] UEFI data corruption? [FIXED] by Peter Humphrey
1 On Fri, 27 Sep 2019 at 09:13, Peter Humphrey <peter@××××××××××××.uk> wrote:
2 >
3 > On Thursday, 26 September 2019 16:44:10 BST Mick wrote:
4 > > On Thu, 26 Sep 2019 at 15:47, Peter Humphrey <peter@××××××××××××.uk> wrote:
5 > > > On Thursday, 26 September 2019 10:16:54 BST Adam Carter wrote:
6 >
7 > [Snip interesting stuff]
8 >
9 > > > > I got the impression that I would be able to UEFI boot from multiple
10 > > > > different devices, eg a USB drive with UEFI as well as the hard disk.
11 > >
12 > > I may be wrong, but I don't think this is possible (yet?). You could
13 > > use a secondary bootloader, e.g. GRUB, other than the UEFI firmware to
14 > > load OS kernels wherever they might be positioned on the system.
15 >
16 > But see next:
17 >
18 > > > Oh yes, removable devices can be booted, but not secondary, internal hard
19 > > > drives. Apparently. On this system. Today.
20 >
21 > I can boot from USB or CD drives by entering the UEFI BIOS at boot and
22 > selecting the one I want to boot from - and this BIOS dates from 2014. I doubt
23 > this is unusual.
24
25 Sorry, my mistake - the following is what I meant to write, but in a
26 rush I failed to do so:
27
28 As long as you structure the ESP filesystem as per UEFI specification,
29 a sympathetic OEM UEFI firmware implementation will process the first
30 ESP on the first hard disk and list OS kernels it finds in its boot
31 manager menu for you to select from. The latest UEFI specification
32 does not restrict the number of ESPs, or their location. It is
33 unlikely the UEFI firmware will process additional ESPs on the same,
34 or other hard disks, or partitions which have anything other than
35 FAT(12,16,32) filesystems. I seem to recall earlier OEM
36 implementations explicitly excluded more than one ESP on the primary
37 disk. In the future the UEFI specification may evolve to include more
38 than one ESP or FAT partitions, perhaps even with/without the ESP GUID
39 being set.
40
41 Removable devices with an ESP structured as per UEFI specification
42 will also be probed and their primary (default) bootable kernel listed
43 by the UEFI firmware. Selecting a listed removable device from within
44 the UEFI boot menu will boot it, as you observed.
45
46 If you want more than one kernel per OS subdirectory to be listed in
47 the UEFI boot manager's menu, you will need to add them in the desired
48 order using the efibootmgr command. Otherwise, the UEFI firmware will
49 not behave predictably in which of these kernels it selects to list in
50 its boot menu.
51
52 As I understand it, 'bootctl --update' can be used to update
53 systemd-boot boot manager's menu and it is looking for bootable
54 kernels by scanning /efi, /boot, and /boot/efi, or the directory set
55 by passing the '--path' option to it. Manual addition of bootable
56 kernels must be set via /loader/entries/*.conf (one file per kernel
57 image) and then setting the default kernel to be booted in
58 /loader/loader.conf. I find all this to be unnecessary complication
59 for maintaining a boot manager manually, compared to using say
60 efibootmgr. However, it is handy to be able to press 'e' to edit the
61 default entry at boot time, or if new kernels are always stored where
62 expected by the scripts of binary distros.
63
64 For Peter's use case, OS and kernel resides on secondary disk, the
65 solutions I can think are:
66
67 1. Use GRUB. The UEFI firmware will load the GRUB efi image, which
68 will load the desired kernel and OS wherever it might reside.
69 Secondary disks and non-FAT filesystems are not a problem, because
70 GRUB has various fs drivers and will probe additional devices.
71 Following installation maintenance is minimal compared to other
72 options.
73
74 2. Use systemd-boot. Copy each kernel from the secondary disk to
75 /boot/EFI/ creating the corresponding /loader/entries/*.conf, adding
76 the kernel .conf name and the OS root partition's path on the
77 secondary disk. The root path can also/instead be included in the
78 kernel itself (CONFIG_CMDLINE).
79
80 3. Use some other boot manager (e.g. rEFInd, ELILO).
81
82 4. Use efibootmgr after you copy the kernel from the secondary disk to
83 the ESP in a corresponding OS subdirectory. The root path should be
84 included in the kernel.
85
86 I hope the above clarifies my previous post.
87 --
88 Regards,
89 Mick

Replies

Subject Author
Re: [gentoo-user] UEFI data corruption? [FIXED] Neil Bothwick <neil@××××××××××.uk>