Re[2]: [gentoo-user] Fun with systemd-boot
-- Original Message -- From "Alan Mackenzie" To gentoo-user@lists.gentoo.org Date 18.12.2024 22:31:42 Subject Re: [gentoo-user] Fun with systemd-boot Also, none of the documentation was explicit in saying that with efibootmgr, you have to go into the BIOS setup to select the kernel you want to boot. Nothing wrong with that, but if I'd know first, I wouldn't have bothered getting it working. (Sorry, it's been a strenuous evening.) After a bit of wiki browsing and experimentation I have ended up with the following process for a gentoo VM using UEFI boot: - `emerge gentoo-kernel-bin` - kernel and initramfs end up in /boot - `efi-update 6.12.5` where efi-update is #!/bin/zsh BASE=/efi/EFI/gentoo/ VERSION=${1-6.8.10} KERNEL="vmlinuz-${VERSION}-gentoo-dist" INITRD="initramfs-${VERSION}-gentoo-dist.img" cp /boot/${KERNEL} /boot/${INITRD} ${BASE} efibootmgr --create-only --create --disk /dev/sdd --part 1 --label "gentoo ${VERSION}" --loader "\\EFI\\gentoo\\${KERNEL}" --unicode "initrd=\\EFI\\gentoo\\${INITRD}" echo "try: efibootmgr -n " echo "use: efibootmgr -o ,,..." echo "del: efibootmgr -B -b " The last three lines are to remind of which options to use for managing the kernel for the next boot only (try), changing the permament boot sequence and cleaning up old kernels. I never had to enter the UEFI BIOS on this VM. HTH, s.
Re: [gentoo-user] Fun with systemd-boot
Hello, Michael. Thanks for the reply. On Wed, Dec 18, 2024 at 15:58:14 +, Michael wrote: > On Wednesday 18 December 2024 14:30:12 GMT Peter Humphrey wrote: > > On Wednesday 18 December 2024 12:13:59 GMT Alan Mackenzie wrote: > > > I've been having fun with systemd-boot. [ ] > > > Could somebody perhaps suggest a better boot loader to me? I need to be > > > able to chose between several kernels at booting time, but I certainly > > > don't want something "refined" like grub - I just need what I thought > > > systemd-boot actually was before yesterday. > > That's even worse than what I was suffering until I developed my own system. > > > Thanks in advance! > > Hope that helps. > If the OP is running a systemd installation then using an ESP FAT32 formatted > partition on /efi mountpoint and a XBOOTLDR partition at /boot mountpoint > would greatly simplify things and avoid conflicts between what the systemd > bootctl expects to find and wants to do and what the user prefers: > https://wiki.gentoo.org/wiki/EFI_System_Partition#Standard_layout I'm on openRC. > On an OpenRC system without GRUB, rEFInd is a good choice, or for a totally > manual approach use the efibootmgr: > https://wiki.gentoo.org/wiki/Efibootmgr I got efibootmgr installed on one of my machines. Somebody (tm) should tell the maintainers that "File or directory not found" is an incomplete error message. It cost me around an hour till I figured out it was trying to access files on /dev/sda1 (which I don't have). Also, none of the documentation was explicit in saying that with efibootmgr, you have to go into the BIOS setup to select the kernel you want to boot. Nothing wrong with that, but if I'd know first, I wouldn't have bothered getting it working. (Sorry, it's been a strenuous evening.) rEFInd doesn't feel right, somehow. It seems to involve a graphics screen, and configuring icons in a config file. I just want want to get the system booted, with a choice of kernels at boot time, and not have all the overhead of graphics and "flexibility". I thought systemd-boot was OK, until it starting emptying my /boot partition, and booting from a partition other than the one I'd told it to. Don't we just love software which is clever? . It looks like I'm going to have to make some compromises, somewhere. It's a pity lilo isn't still going. -- Alan Mackenzie (Nuremberg, Germany).
Re: [gentoo-user] Fun with systemd-boot
Sorry for the top post. (Need to fix this mobile app) I have been using "refind" for my desktops and laptops. It works perfectly and even makes dualboot with non Linux simple. Sent from Nine From: Alan Mackenzie [a...@muc.de] Sent: Wednesday, 18 December 2024 13:13 To: [gentoo-user@lists.gentoo.org] Subject: [gentoo-user] Fun with systemd-boot Hello, Gentoo. I've been having fun with systemd-boot. On my new (2024-08) machine, on Friday 2024-12-06, I suddenly noticed that my /boot partition was empty, I can't remember why I looked at it. I am quite sure I didn't empty it myself. There then followed a couple of hours where I restored the boot manager, kernels, and the boot configuration. Thankfully, it booted again the next time I tried. On my old machine, I've been noticing over the past weeks that only two older kernels have been offered for booting, despite me installing later kernels to /boot/EFI/gentoo, and configuring them in /boot/loader. It all became clear yesterday and today. bootctl install had installed itself to /dev/nvme1n1p1 rather than /boot (which I have mounted on /dev/nvme0n1p1). Both of these partitions are EFI system partitions. It also clogged up my UEFI boot sequence with lots of extra entries, leaving nvme1 rather than nvme0 the prime EFI system partition for booting with. I've had a look at the manual page for bootctrl. It doesn't mention any way of specifying which EFI partition will get written to, and doesn't seem to mention that it changes the UEFI BIOS settings. Or maybe it does. It's a vague, poor quality manual. I don't need all this. Booting should not be fun. It should be boring, boring, boring. Boring and dependable. Could somebody perhaps suggest a better boot loader to me? I need to be able to chose between several kernels at booting time, but I certainly don't want something "refined" like grub - I just need what I thought systemd-boot actually was before yesterday. Thanks in advance! -- Alan Mackenzie (Nuremberg, Germany).
Re: [gentoo-user] Fun with systemd-boot
Hi Alan, Alan Mackenzie writes: > Hello, Gentoo. > > I've been having fun with systemd-boot. > > On my new (2024-08) machine, on Friday 2024-12-06, I suddenly noticed > that my /boot partition was empty, I can't remember why I looked at it. > I am quite sure I didn't empty it myself. There then followed a couple > of hours where I restored the boot manager, kernels, and the boot > configuration. Thankfully, it booted again the next time I tried. > > On my old machine, I've been noticing over the past weeks that only two > older kernels have been offered for booting, despite me installing later > kernels to /boot/EFI/gentoo, and configuring them in /boot/loader. You don't need to do that manually, installkernel should handle it for you. You should get installkernel[systemd,systemd-boot]. > It all became clear yesterday and today. bootctl install had > installed itself to /dev/nvme1n1p1 rather than /boot (which I have > mounted on /dev/nvme0n1p1). This would mean you mounted /dev/nvme1n1p1 on /efi: --esp-path= Path to the EFI System Partition (ESP). If not specified, /efi/, /boot/, and /boot/efi/ are checked in turn. It is recommended to mount the ESP to /efi/, if possible. You should have one ESP mounted at any time, and mounted at /efi. The rest should work fine. > Both of these partitions are EFI system partitions. It also clogged > up my UEFI boot sequence with lots of extra entries, leaving nvme1 > rather than nvme0 the prime EFI system partition for booting with. UEFI boot order entries are only created as part of 'bootctl install' so this would mean you ran it many times. It only needs to be ran once. To update the bootloader, you'd use 'bootctl update', to add/remove entries you'd use kernel-install. > I've had a look at the manual page for bootctrl. It doesn't mention any > way of specifying which EFI partition will get written to, and doesn't > seem to mention that it changes the UEFI BIOS settings. Or maybe it > does. It's a vague, poor quality manual. That'd be --esp-path. WRT changing UEFI settings, this is a necessity for UEFI boot - grub-install does the same thing. > I don't need all this. Booting should not be fun. It should be boring, > boring, boring. Boring and dependable. > > Could somebody perhaps suggest a better boot loader to me? I need to be > able to chose between several kernels at booting time, but I certainly > don't want something "refined" like grub - I just need what I thought > systemd-boot actually was before yesterday. I suspect your problem lies elsewhere. What partitions are you mounting? How are you installing kernels? Have a lovely day! -- Arsen Arsenović signature.asc Description: PGP signature
Re: [gentoo-user] Fun with systemd-boot
--- Original message --- From: Alan Mackenzie To: gentoo-user@lists.gentoo.org Date: Wed, 18 Dec 2024 14:41:00 +0100 Hello, Arsen. On Wed, Dec 18, 2024 at 13:50:09 +0100, Arsen Arsenović wrote: Hi Alan, Alan Mackenzie writes: > Hello, Gentoo. > I've been having fun with systemd-boot. > On my new (2024-08) machine, on Friday 2024-12-06, I suddenly noticed > that my /boot partition was empty, I can't remember why I looked at it. > I am quite sure I didn't empty it myself. There then followed a couple > of hours where I restored the boot manager, kernels, and the boot > configuration. Thankfully, it booted again the next time I tried. > On my old machine, I've been noticing over the past weeks that only two > older kernels have been offered for booting, despite me installing later > kernels to /boot/EFI/gentoo, and configuring them in /boot/loader. You don't need to do that manually, installkernel should handle it for you. You should get installkernel[systemd,systemd-boot]. No, I don't need to learn a new abstruse command (which might do anything apart from its prime function) when cp works 100%. > It all became clear yesterday and today. bootctl install had > installed itself to /dev/nvme1n1p1 rather than /boot (which I have > mounted on /dev/nvme0n1p1). This would mean you mounted /dev/nvme1n1p1 on /efi: --esp-path= Path to the EFI System Partition (ESP). If not specified, /efi/, /boot/, and /boot/efi/ are checked in turn. It is recommended to mount the ESP to /efi/, if possible. I have never knowingly mounted anything on /efi. Even if it was by accident, somehow, I certainly wouldn't have done it on both my old and new machines. And why the partition on nvme1? You should have one ESP mounted at any time, and mounted at /efi. The rest should work fine. I've got /dev/nvme0n1p1 mounted on /boot. That should work. > Both of these partitions are EFI system partitions. It also clogged > up my UEFI boot sequence with lots of extra entries, leaving nvme1 > rather than nvme0 the prime EFI system partition for booting with. UEFI boot order entries are only created as part of 'bootctl install' so this would mean you ran it many times. That's possible, though I don't remember now. It only needs to be ran once. To update the bootloader, you'd use 'bootctl update', to add/remove entries you'd use kernel-install. > I've had a look at the manual page for bootctrl. It doesn't mention any > way of specifying which EFI partition will get written to, and doesn't > seem to mention that it changes the UEFI BIOS settings. Or maybe it > does. It's a vague, poor quality manual. That'd be --esp-path. Thanks! Though just /boot should work. WRT changing UEFI settings, this is a necessity for UEFI boot - grub-install does the same thing. I've always set the boot devices in the BIOS settings - including an entry for my DVD device, enabling me to install Gentoo. :-) > I don't need all this. Booting should not be fun. It should be boring, > boring, boring. Boring and dependable. > Could somebody perhaps suggest a better boot loader to me? I need to be > able to chose between several kernels at booting time, but I certainly > don't want something "refined" like grub - I just need what I thought > systemd-boot actually was before yesterday. I suspect your problem lies elsewhere. What partitions are you mounting? How are you installing kernels? I mount an EFI partition on /boot, along with several LVM partitions on / and subdirectories. I install kernels with cp from /usr/src/linux-x.y.z-gentoo/arch/x86/boot/bzImage to /boot/EFI/gentoo/, with a suitable new name. Then I add a new configuration file for the new kernel in /boot/loader/Entries. For sys-boot/refind: # ls /boot/EFI/Gentoo/ gentoo_6_6_62.efi I include the initramfs and commandline into the kernel image. But you can specify initrd seperately if needed by adding extra menu-entries. -- Joost
Re: [gentoo-user] Fun with systemd-boot
On Wednesday 18 December 2024 12:13:59 GMT Alan Mackenzie wrote: > I've been having fun with systemd-boot. I've been using bootctl from systemd-utils for some years; ever since I graduated to an EFI system. I don't follow the wiki because of the resulting impenetrable thicket of unpronounceable names and 32-digit hex numbers. Fine for a distro builder, perhaps, but not for me thank you - especially as I want a selection of kernels to boot from, which I never did work out how to achieve following the official advice. My method has only one related USE variable: sys-apps/systemd-utils boot kernel-install My EFI partition, unformatted and not mentioned in /etc/fstab, is /dev/ nvme0n1p1. 0n1p2 is the FAT-32 /boot. # tree -L 3 /boot /boot ├── [config files from make install] ├── early_ucode.cpio ├── EFI │ ├── BOOT │ │ └── BOOTX64.EFI │ ├── Linux │ └── systemd │ └── systemd-bootx64.efi ├── intel-uc.img ├── loader │ ├── entries │ │ ├── 06-gentoo-rescue-6.6.52.conf │ │ ├── 07-gentoo-rescue-6.6.52.nonet.conf │ │ ├── 08-gentoo-rescue-6.6.62.conf │ │ ├── 09-gentoo-rescue-6.6.62.nonet.conf │ │ ├── 30-gentoo-6.6.62.conf │ │ ├── 32-gentoo-6.6.62.nox.conf │ │ └── 34-gentoo-6.6.62.nonet.conf │ ├── entries.srel │ ├── loader.conf │ └── random-seed ├── [System.map files from make install] ├── vmlinuz-6.6.38-gentoo-rescue ├── vmlinuz-6.6.52-gentoo ├── vmlinuz-6.6.52-gentoo-rescue ├── vmlinuz-6.6.62-gentoo └── vmlinuz-6.6.62-gentoo-rescue This is the relevant parts of the kernel make script on my little i5 NUC box: cd /usr/src/linux time (make -j4 && make modules_install &&\ make install && rm -f /boot/*old) emerge @module-rebuild @x11-module-rebuild rm -f /boot/early_ucode.cpio.new &&\ iucode_tool -q -S --write-earlyfw=/boot/early_ucode.cpio.new \ -tr /boot/early_ucode.cpio -tb /lib/firmware/intel-ucode &&\ mv -v /boot/early_ucode.cpio.new /boot/early_ucode.cpio &&\ echo Then all I have to do is some simple mmv and sed -i on the files in /boot/ loader/entries and loader.conf. Also remove obsolete kernels, configs and maps from /boot. Oh, and bootctl set-default 30-gentoo-6.6.62.conf if it's a remote machine and I won't be present at boot time. --->8 > Could somebody perhaps suggest a better boot loader to me? I need to be > able to chose between several kernels at booting time, but I certainly > don't want something "refined" like grub - I just need what I thought > systemd-boot actually was before yesterday. That's even worse than what I was suffering until I developed my own system. > Thanks in advance! Hope that helps. -- Regards, Peter.
Re: [gentoo-user] Fun with systemd-boot
On Wednesday 18 December 2024 14:30:12 GMT Peter Humphrey wrote: > On Wednesday 18 December 2024 12:13:59 GMT Alan Mackenzie wrote: > > I've been having fun with systemd-boot. > > I've been using bootctl from systemd-utils for some years; ever since I > graduated to an EFI system. I don't follow the wiki because of the resulting > impenetrable thicket of unpronounceable names and 32-digit hex numbers. > Fine for a distro builder, perhaps, but not for me thank you - especially > as I want a selection of kernels to boot from, which I never did work out > how to achieve following the official advice. > > My method has only one related USE variable: > sys-apps/systemd-utils boot kernel-install > > My EFI partition, unformatted and not mentioned in /etc/fstab, is /dev/ > nvme0n1p1. 0n1p2 is the FAT-32 /boot. > # tree -L 3 /boot > /boot > ├── [config files from make install] > ├── early_ucode.cpio > ├── EFI > │ ├── BOOT > │ │ └── BOOTX64.EFI > │ ├── Linux > │ └── systemd > │ └── systemd-bootx64.efi > ├── intel-uc.img > ├── loader > │ ├── entries > │ │ ├── 06-gentoo-rescue-6.6.52.conf > │ │ ├── 07-gentoo-rescue-6.6.52.nonet.conf > │ │ ├── 08-gentoo-rescue-6.6.62.conf > │ │ ├── 09-gentoo-rescue-6.6.62.nonet.conf > │ │ ├── 30-gentoo-6.6.62.conf > │ │ ├── 32-gentoo-6.6.62.nox.conf > │ │ └── 34-gentoo-6.6.62.nonet.conf > │ ├── entries.srel > │ ├── loader.conf > │ └── random-seed > ├── [System.map files from make install] > ├── vmlinuz-6.6.38-gentoo-rescue > ├── vmlinuz-6.6.52-gentoo > ├── vmlinuz-6.6.52-gentoo-rescue > ├── vmlinuz-6.6.62-gentoo > └── vmlinuz-6.6.62-gentoo-rescue > > This is the relevant parts of the kernel make script on my little i5 NUC > box: cd /usr/src/linux > time (make -j4 && make modules_install &&\ > make install && rm -f /boot/*old) > emerge @module-rebuild @x11-module-rebuild > rm -f /boot/early_ucode.cpio.new &&\ > iucode_tool -q -S --write-earlyfw=/boot/early_ucode.cpio.new \ > -tr /boot/early_ucode.cpio -tb /lib/firmware/intel-ucode &&\ > mv -v /boot/early_ucode.cpio.new /boot/early_ucode.cpio &&\ > echo Not relevant to the OP, but why don't you build the µcode blob in the kernel itself for a simpler life? > Then all I have to do is some simple mmv and sed -i on the files in /boot/ > loader/entries and loader.conf. Also remove obsolete kernels, configs and > maps from /boot. Oh, and bootctl set-default 30-gentoo-6.6.62.conf if it's > a remote machine and I won't be present at boot time. > > --->8 > > > Could somebody perhaps suggest a better boot loader to me? I need to be > > able to chose between several kernels at booting time, but I certainly > > don't want something "refined" like grub - I just need what I thought > > systemd-boot actually was before yesterday. > > That's even worse than what I was suffering until I developed my own system. > > Thanks in advance! > > Hope that helps. If the OP is running a systemd installation then using an ESP FAT32 formatted partition on /efi mountpoint and a XBOOTLDR partition at /boot mountpoint would greatly simplify things and avoid conflicts between what the systemd bootctl expects to find and wants to do and what the user prefers: https://wiki.gentoo.org/wiki/EFI_System_Partition#Standard_layout On an OpenRC system without GRUB, rEFInd is a good choice, or for a totally manual approach use the efibootmgr: https://wiki.gentoo.org/wiki/Efibootmgr signature.asc Description: This is a digitally signed message part.
Re: [gentoo-user] Fun with systemd-boot
Hello, Arsen. On Wed, Dec 18, 2024 at 13:50:09 +0100, Arsen Arsenović wrote: > Hi Alan, > Alan Mackenzie writes: > > Hello, Gentoo. > > I've been having fun with systemd-boot. > > On my new (2024-08) machine, on Friday 2024-12-06, I suddenly noticed > > that my /boot partition was empty, I can't remember why I looked at it. > > I am quite sure I didn't empty it myself. There then followed a couple > > of hours where I restored the boot manager, kernels, and the boot > > configuration. Thankfully, it booted again the next time I tried. > > On my old machine, I've been noticing over the past weeks that only two > > older kernels have been offered for booting, despite me installing later > > kernels to /boot/EFI/gentoo, and configuring them in /boot/loader. > You don't need to do that manually, installkernel should handle it for > you. You should get installkernel[systemd,systemd-boot]. No, I don't need to learn a new abstruse command (which might do anything apart from its prime function) when cp works 100%. > > It all became clear yesterday and today. bootctl install had > > installed itself to /dev/nvme1n1p1 rather than /boot (which I have > > mounted on /dev/nvme0n1p1). > This would mean you mounted /dev/nvme1n1p1 on /efi: >--esp-path= >Path to the EFI System Partition (ESP). If not specified, >/efi/, /boot/, and /boot/efi/ are checked in turn. It is >recommended to mount the ESP to /efi/, if possible. I have never knowingly mounted anything on /efi. Even if it was by accident, somehow, I certainly wouldn't have done it on both my old and new machines. And why the partition on nvme1? > You should have one ESP mounted at any time, and mounted at /efi. The > rest should work fine. I've got /dev/nvme0n1p1 mounted on /boot. That should work. > > Both of these partitions are EFI system partitions. It also clogged > > up my UEFI boot sequence with lots of extra entries, leaving nvme1 > > rather than nvme0 the prime EFI system partition for booting with. > UEFI boot order entries are only created as part of 'bootctl install' so > this would mean you ran it many times. That's possible, though I don't remember now. > It only needs to be ran once. To update the bootloader, you'd use > 'bootctl update', to add/remove entries you'd use kernel-install. > > I've had a look at the manual page for bootctrl. It doesn't mention any > > way of specifying which EFI partition will get written to, and doesn't > > seem to mention that it changes the UEFI BIOS settings. Or maybe it > > does. It's a vague, poor quality manual. > That'd be --esp-path. Thanks! Though just /boot should work. > WRT changing UEFI settings, this is a necessity for UEFI boot - > grub-install does the same thing. I've always set the boot devices in the BIOS settings - including an entry for my DVD device, enabling me to install Gentoo. :-) > > I don't need all this. Booting should not be fun. It should be boring, > > boring, boring. Boring and dependable. > > Could somebody perhaps suggest a better boot loader to me? I need to be > > able to chose between several kernels at booting time, but I certainly > > don't want something "refined" like grub - I just need what I thought > > systemd-boot actually was before yesterday. > I suspect your problem lies elsewhere. What partitions are you > mounting? How are you installing kernels? I mount an EFI partition on /boot, along with several LVM partitions on / and subdirectories. I install kernels with cp from /usr/src/linux-x.y.z-gentoo/arch/x86/boot/bzImage to /boot/EFI/gentoo/, with a suitable new name. Then I add a new configuration file for the new kernel in /boot/loader/Entries. > Have a lovely day! Thanks! > -- > Arsen Arsenović -- Alan Mackenzie (Nuremberg, Germany).
[gentoo-user] Fun with systemd-boot
Hello, Gentoo. I've been having fun with systemd-boot. On my new (2024-08) machine, on Friday 2024-12-06, I suddenly noticed that my /boot partition was empty, I can't remember why I looked at it. I am quite sure I didn't empty it myself. There then followed a couple of hours where I restored the boot manager, kernels, and the boot configuration. Thankfully, it booted again the next time I tried. On my old machine, I've been noticing over the past weeks that only two older kernels have been offered for booting, despite me installing later kernels to /boot/EFI/gentoo, and configuring them in /boot/loader. It all became clear yesterday and today. bootctl install had installed itself to /dev/nvme1n1p1 rather than /boot (which I have mounted on /dev/nvme0n1p1). Both of these partitions are EFI system partitions. It also clogged up my UEFI boot sequence with lots of extra entries, leaving nvme1 rather than nvme0 the prime EFI system partition for booting with. I've had a look at the manual page for bootctrl. It doesn't mention any way of specifying which EFI partition will get written to, and doesn't seem to mention that it changes the UEFI BIOS settings. Or maybe it does. It's a vague, poor quality manual. I don't need all this. Booting should not be fun. It should be boring, boring, boring. Boring and dependable. Could somebody perhaps suggest a better boot loader to me? I need to be able to chose between several kernels at booting time, but I certainly don't want something "refined" like grub - I just need what I thought systemd-boot actually was before yesterday. Thanks in advance! -- Alan Mackenzie (Nuremberg, Germany).