You are not logged in.

#1 2020-05-19 02:04:52

Registered: 2020-05-19
Posts: 3

[SOLVED] rEFInd: Invalid loader file

Problem: rEFInd complains about loader being invalid (cannot find file)
Goal: I would like to be able to boot from either of /dev/sda or /dev/sdb, and use btrfs as the filesystem that occupies the rest of the drive. So, if this would be easier to do with GRUB, I'm absolutely open to that suggestion.

I'll start with a dump of commands and files that I have seen people share on posts similar to this, then share the error message, and finally briefly describe my limited what-have-I-tried.

loop0                 squashfs                    /run/archiso/sfs/airootfs
├─sda1    zeta:esp    linux_raid_member esp1
│ └─md127 ESP         vfat                        /mnt/efi
└─sda3    stuff       btrfs             stuff1
├─sdb1    zeta:esp    linux_raid_member esp2
│ └─md127 ESP         vfat                        /mnt/efi
└─sdb3    stuff       btrfs             stuff2    /mnt/home
sdc       ARCH_202005 iso9660
├─sdc1    ARCH_202005 iso9660                     /run/archiso/bootmnt
└─sdc2    ARCHISO_EFI vfat
# cat /mnt/etc/fstab
LABEL=stuff         /         btrfs     rw,noatime,ssd,space_cache,subvolid=636,subvol=/arch_root,subvol=arch_root0 0
LABEL=stuff         /home     btrfs     rw,noatime,ssd,space_cache,subvolid=637,subvol=/arch_home,subvol=arch_home0 0

LABEL=ESP           /efi      vfat      noauto,rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro0 2
# cat /proc/mdstat
Personalities : [raid1]
md127 : active raid1 sda1[0] sdb1[1]
      204736 blocks super 1.0 [2/2] [UU]

unused devices: <none>
# cat /mnt/etc/mdadm.conf
# This is what this file should contain, but it doesn't. UEFI can end up writing stuff to ESP,
# and this can cause the array to go out of sync. Mounting with noauto option in fstab instead.
#DEVICE partitions
#ARRAY /dev/md/esp  metadata=1.0 UUID=6102fd33:f6059356:bb9333a3:a321348c name=zeta:esp
# cat /mnt/etc/systemd/system/resync-esp.service
Description=Resync /efi RAID

ExecStart=/usr/bin/mdadm --assemble /dev/md/esp --update=resync /dev/disk/by-partlabel/esp1 /dev/disk/by-partlabel/esp2
ExecStart=/usr/bin/mount /efi

# sed -n '/^[^#]/p' /mnt/efi/EFI/refind/refind.conf
timeout 60
use_graphics_for osx,windows
also_scan_dirs +,boot,ESP:/,arch_root:/boot
scan_driver_dirs +,EFI/tools/drivers_x64
extra_kernel_version_strings linux-hardened,linux-zen,linux-lts,linux
enable_and_lock_vmx false
menuentry "Arch Linux Zen" {
    icon     /EFI/refind/icons/os_arch.png
volume   "stuff"
    loader   /boot/vmlinuz-linux-zen
    initrd   /boot/initramfs-linux-zen.img
    options  "root=LABEL=stuff rootflags=subvol=arch_root rw add_efi_memmap initrd=\boot\intel-ucode.img"
    submenuentry "Boot using fallback initramfs" {
        initrd /boot/initramfs-linux-zen-fallback.img
    submenuentry "Boot to terminal" {
        add_options ""
# cat /mnt/boot/refind_linux.conf

Yes, I left refind_linux.conf blank since I couldn't find any consistent recommendations for how to mount btrfs subvolumes.

# btrfs subvolume list /mnt                                                      :(
ID 256 gen 2663 top level 5 path @backup
ID 688 gen 3195 top level 5 path arch_root
ID 689 gen 3186 top level 5 path arch_home
ID 690 gen 3191 top level 688 path var/lib/portables
ID 691 gen 3192 top level 688 path var/lib/machines

I did not create var/lib/portables nor var/lib/machines, but those show up after a pacstrap of the arch_root.

# find /mnt/efi -type f ! \( -name '*.png' -o -name '*.svg' \)
# find /mnt/boot -type f

And here is the exact text of the error message that I see when arrow over to the "Arch Linux Zen" option and press  <F2><F2><Enter>:

Starting vmlinuz-linux-zen
Using load options 'root=LABEL=stuff rootflags=subvol=arch_root rw add_efi_memmap initrd=\boot\intel-ucode.img'
Invalid loader file!
Error: Not Found while loading vmlinuz-linux-zen

* Hit any key to continue *

With my luck, I probably have a small typo somewhere, but I have tried my best to triple check myself... Anyway, I have tried various settings for the manual boot stanza (changing anywhere /boot or \boot is referenced):
* /boot/vmlinuz-linux-zen
* boot/vmlinuz-linux-zen
* /vmlinuz-linux-zen
* vmlinuz-linux-zen

None of those have produced a successful boot from rEFInd, and all show the same error. Any help on this matter is greatly appreciated smile

Last edited by kevinkjt2000 (2020-05-20 12:29:58)


#2 2020-05-19 20:45:04

Registered: 2014-03-06
Posts: 17,592

Re: [SOLVED] rEFInd: Invalid loader file

The ESP is on LVM2 RAID1?  Please see the warning from EFI_system_partition#Create_the_partition although as refind is loaded that may not be the cause of the current issue.


#3 2020-05-20 00:13:24

Registered: 2020-05-19
Posts: 3

Re: [SOLVED] rEFInd: Invalid loader file

Thanks for asking for clarification.

Yes, rEFInd loads okay. I used 1.0 metadata when creating the ESP mdadm raid1. … _the_array and other online sources mention that 0.9 or 1.0 metadata is needed in order to boot from a raid1 drive. Before I decided to give btrfs a try, my disks were formatted in much the same way except that instead of btrfs, I had ext4 raid1. I was also using grub instead of rEFInd. It is as you say though, rEFInd is loaded so it is not the cause of the current issue. I highly suspect my issue has something to do with the settings I typed out in the manual boot stanza.

Another key difference between now and my previous setup is that my /boot and /efi are separate. At the moment /boot is coming from a folder on the arch_root btrfs subvolume. Whereas, /efi is coming from the mdadm raid1. My understanding is that this is okay with rEFInd, so long as the driver for btrfs is loaded okay.


#4 2020-05-20 08:55:52

The Evil Wiki Admin
Registered: 2016-07-02
Posts: 622

Re: [SOLVED] rEFInd: Invalid loader file

rEFInd accesses the root of the file system not a specific subvolume. Try prepending "/arch_root" to the loader (and possibly also initrd) path in refind.conf.


#5 2020-05-20 12:29:24

Registered: 2020-05-19
Posts: 3

Re: [SOLVED] rEFInd: Invalid loader file

That did the trick! Much thanks for this! I was mistakenly under the impression that the rootflags=subvol=arch_root would handle that. I also added rootfstype=btrfs somewhere along the way.

menuentry "Arch Linux Zen" {
    icon     /EFI/refind/icons/os_arch.png
    volume   "stuff"
    loader   /arch_root/boot/vmlinuz-linux-zen
    initrd   /arch_root/boot/initramfs-linux-zen.img
    options  "root=LABEL=stuff rootflags=subvol=arch_root rw rootfstype=btrfs add_efi_memmap initrd=\arch_root\boot\intel-ucode.img"
    submenuentry "Boot using fallback initramfs" {
        initrd /arch_root/boot/initramfs-linux-zen-fallback.img
    submenuentry "Boot to terminal" {
        add_options ""

Last edited by kevinkjt2000 (2020-05-20 12:30:30)


Board footer

Powered by FluxBB