You are not logged in.

#1 2024-01-24 20:44:18

mcaliandro
Member
Registered: 2019-11-25
Posts: 4

[SOLVED] How to switch from systemd-boot to rEFInd?

Hi all,
Since a couple of days, I'm experiencing some problems in booting Arch with systemd-boot on my laptop (only one OS, no dual-boot).
When I installed Arch on my laptop, I decided to allocate only 256MB for the EFI partition.
It happens that the boot loader is not recognized by the UEFI system, because my SSD drive doesn't appear anymore as a bootable device.
By using a Live USB, I discovered that the EFI partition is full (1MB space left) and I also suspect that maybe the FAT filesystem or some .efi files could be corrupted.
After I freed up some space (deleted a 135MB sized initramfs-fallback image) now systemd-boot "kind of" works again, but some times the bootloader is still unrecognized.

If I still want to keep the partition scheme as it is in the long term, I have to move the kernel and initramfs images inside the root partition. Therefore, I cannot rely anymore on systemd-boot.
Some redditors recommend to install rEFInd as an alternative to systemd-boot. So, I would like to ask some opinions about it and hints on how can I dismiss systemd-boot and prepare the ESP for rEFInd.

Thank you.


Here, some useful info:
- Secure boot disabled
- No encrypted partition
- ESP mounted on /boot

# lsblk

nvme0n1     259:0    0 953.9G  0 disk
├─nvme0n1p1 259:1    0   256M  0 part /boot
├─nvme0n1p2 259:2    0    80G  0 part /
├─nvme0n1p3 259:3    0    80G  0 part /home
├─nvme0n1p4 259:4    0 127.8G  0 part
├─nvme0n1p5 259:5    0 255.8G  0 part
└─nvme0n1p6 259:6    0 256.1G  0 part 

# tree -h /boot

[1.0K]  /boot
├── [ 80K]  amd-ucode.img
├── [ 512]  EFI
│   ├── [ 512]  arch
│   │   ├── [ 512]  fw
│   │   │   └── [ 17M]  fwupd-01453b71-da0c-4832-9f4f-e378245339c7.cap
│   │   └── [ 60K]  fwupdx64.efi
│   ├── [ 512]  BOOT
│   │   └── [ 98K]  BOOTX64.EFI
│   ├── [ 512]  Linux
│   └── [ 512]  systemd
│       └── [ 98K]  systemd-bootx64.efi
├── [135M]  initramfs-linux-fallback.img
├── [ 34M]  initramfs-linux.img
├── [ 512]  loader
│   ├── [ 512]  entries
│   │   └── [ 165]  arch.conf
│   ├── [   6]  entries.srel
│   ├── [  47]  loader.conf
│   └── [  32]  random-seed
└── [ 12M]  vmlinuz-linux

Last edited by mcaliandro (2024-01-29 14:00:06)

Offline

#2 2024-01-25 07:22:47

d.ALT
Member
Registered: 2019-05-10
Posts: 943

Re: [SOLVED] How to switch from systemd-boot to rEFInd?

<EDIT>

mcaliandro wrote:

[...]
It happens that the boot loader is not recognized by the UEFI system, because my SSD drive doesn't appear anymore as a bootable device.
[...]
some times the bootloader is still unrecognized

Anyway, you'd better investingate onto your laptop's UEFI (bad?) implementation.
Usually, Firmware's NVRAM entries should NOT disappear randomly (unless you laptop's UEFI is picky about not-enought free space onto the FAT32 $ESP).
</EDIT>

unmount $ESP , # mkdir /efi , then mount $ESP into /efi ; finally exchange /efi for /boot inside /etc/fstab file.
# cd /efi && cp *-linux* *ucode* ../boot/
Install package refind and configure it accordingly.
Reboot.

Last edited by d.ALT (2024-01-25 07:29:20)


<49,17,III,I>    Fama di loro il mondo esser non lassa;
<50,17,III,I>    misericordia e giustizia li sdegna:
<51,17,III,I>    non ragioniam di lor, ma guarda e passa.

Offline

#3 2024-01-25 07:41:50

-thc
Member
Registered: 2017-03-15
Posts: 715

Re: [SOLVED] How to switch from systemd-boot to rEFInd?

Just to make sure you're not chasing white rabbits: 256 MB is more that sufficient for systemd-boot and the contents of "/boot" - the ESP should not be full at all,

Unmount the "/boot" partition and check it for errors ("fsck.vfat" is part of the package "dosfstools"):

umount /boot
fsck.vfat /dev/nvme0n1p1

Offline

#4 2024-01-25 15:44:36

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,347
Website

Re: [SOLVED] How to switch from systemd-boot to rEFInd?

mcaliandro wrote:

a 135MB sized initramfs-fallback image

You can reduce that by removing the KMS hook from /etc/mkinitcpio.conf and instead add your video driver to the MODULES array.

mcaliandro wrote:

If I still want to keep the partition scheme as it is in the long term, I have to move the kernel and initramfs images inside the root partition. Therefore, I cannot rely anymore on systemd-boot.

If you want to have the kernel & initramfs images on the root partition you can add the relevant EFI filesystem driver to /EFI/systemd/drivers/ on the ESP to allow systemd-boot to read the root an XBOOTLDR partition.

https://man.archlinux.org/man/sd-boot.7#FILES

EDIT: corrected misinformation.

Last edited by Head_on_a_Stick (2024-01-25 18:46:02)


Para todos todo, para nosotros nada

Offline

#5 2024-01-25 16:46:15

d.ALT
Member
Registered: 2019-05-10
Posts: 943

Re: [SOLVED] How to switch from systemd-boot to rEFInd?

Head_on_a_Stick wrote:

add the relevant EFI filesystem driver to /EFI/systemd/drivers/ on the ESP to allow systemd-boot to read the root partition.

https://man.archlinux.org/man/sd-boot.7#FILES

Sometimes systemd-boot will fail on NVMe (I wonder if this would apply on SSD storage also)


<49,17,III,I>    Fama di loro il mondo esser non lassa;
<50,17,III,I>    misericordia e giustizia li sdegna:
<51,17,III,I>    non ragioniam di lor, ma guarda e passa.

Offline

#6 2024-01-25 18:58:58

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,347
Website

Re: [SOLVED] How to switch from systemd-boot to rEFInd?

I've just tried an XBOOTLDR partition on an NVMe SSD and it works for me. I didn't use any .conf files though, I just placed a UKI at /EFI/Linux/arch.efi on the XBOOTLDR partition and it was automatically detected and launched by systemd-boot.


Para todos todo, para nosotros nada

Offline

#7 2024-01-29 13:43:31

mcaliandro
Member
Registered: 2019-11-25
Posts: 4

Re: [SOLVED] How to switch from systemd-boot to rEFInd?

Sorry for my late reply, I finally managed to solve my problem during the weekend.
Actually, I didn't replace systemd-boot with rEFInd. I've simply deleted the image initramfs-linux-fallback and configured mkinitcpio to not create it when upgrading the linux kernel.

I'm aware that my approach is not the recommended, because without a fallback image I won't be able to boot Arch in case the default initramfs image fails, or is compromised (the explanations here: https://wiki.archlinux.org/title/Mkinit … odule_XXXX).

I wasn't aware about this solution before and I chose to go with it because I needed to restore my laptop as soon as possible. To be honest, I wasn't neither sure to replace systemd-boot with rEFInd.

d.ALT wrote:

Anyway, you'd better investingate onto your laptop's UEFI (bad?) implementation.
Usually, Firmware's NVRAM entries should NOT disappear randomly (unless you laptop's UEFI is picky about not-enought free space onto the FAT32 $ESP).

Despite this happened after I tried to upgrade the secure boot firmware (using fwupd) with a full EFI partition, fortunately I'm not afflicted by it because now I'm able to start systemd-boot bootloader without problems.

I also checked the EFI partition as -thc recommended and there are no issues.

Head_on_a_Stick wrote:

You can reduce that by removing the KMS hook from /etc/mkinitcpio.conf and instead add your video driver to the MODULES array.
[...]
If you want to have the kernel & initramfs images on the root partition you can add the relevant EFI filesystem driver to /EFI/systemd/drivers/ on the ESP to allow systemd-boot to read the root an XBOOTLDR partition.

I totally agree with your proposal: I'll evaluate these solutions the next time I have to install Arch from the scratch.
Right now, I'll keep the partition table as it is and stay without a fallback image.

Thank to all of you for the support.

EDIT: improved description

Last edited by mcaliandro (2024-01-29 14:02:07)

Offline

Board footer

Powered by FluxBB