refind-btrfs
refind-btrfs copied to clipboard
Loader file not found when attempting to boot into snapshot
Running the tool and generating the boot stanzas seems like it's worked fine, but when I attempt to actually boot the snapshot I get the following from refind:
Invalid loader file!
Error: Not Found while loading vmlinuz-linux
Here's my manual boot stanza:
menuentry "Arch Linux" {
icon /EFI/refind/icons/os_arch.png
volume "159cd8ec-d101-4ad7-a042-a91718d41bf6"
loader /@/boot/vmlinuz-linux
initrd /@/boot/initramfs-linux.img
options "root=PARTUUID=159cd8ec-d101-4ad7-a042-a91718d41bf6 rw rootflags=subvol=@ resume=/dev/nvme0n1p2"
submenuentry "Boot to terminal" {
add_options "systemd.unit=multi-user.target"
}
}
Here's my fstab if it helps:
# /dev/nvme0n1p3 UUID=159cd8ec-d101-4ad7-a042-a91718d41bf6
LABEL=arch / btrfs rw,relatime,ssd,discard=async,space_cache=v2,subvol=/@ 0 0
# /dev/nvme0n1p2 UUID=a865306e-c24a-490e-b500-b90f35909f01
LABEL=swap none swap defaults 0 0
# /dev/nvme0n1p1 PARTUUID=aef80615-3c4c-c646-99bc-152b6f5977d8
UUID=900C-31BF /mnt/boot vfat defaults 0 0
And here's the boot stanza that was generated:
menuentry "Arch Linux (rwsnap_2023-11-07_16-50-55_ID282)" {
icon /EFI/refind/icons/os_arch.png
volume "159cd8ec-d101-4ad7-a042-a91718d41bf6"
loader /@/@refind-btrfs/rwsnap_2023-11-07_16-50-55_ID282/boot/vmlinuz-linux
initrd /@/@refind-btrfs/rwsnap_2023-11-07_16-50-55_ID282/boot/initramfs-linux.img
options "root=PARTUUID=159cd8ec-d101-4ad7-a042-a91718d41bf6 rw rootflags=subvol=@/@refind-btrfs/rwsnap_2023-11-07_16-50-55_ID282 resume=/dev/nvme0n1p2"
}
And here's the fstab at /@refind-btrfs/rwsnap_2023-11-07_16-50-55_ID282/etc/fstab
:
# /dev/nvme0n1p3 UUID=159cd8ec-d101-4ad7-a042-a91718d41bf6
LABEL=arch / btrfs rw,relatime,ssd,discard=async,space_cache=v2,subvol=/@/@refind-btrfs/rwsnap_2023-11-07_16-50-55_ID282 0 0
# /dev/nvme0n1p2 UUID=a865306e-c24a-490e-b500-b90f35909f01
LABEL=swap none swap defaults 0 0
# /dev/nvme0n1p1 PARTUUID=aef80615-3c4c-c646-99bc-152b6f5977d8
UUID=900C-31BF /mnt/boot vfat defaults 0 0
I've verified that /@refind-btrfs/rwsnap_2023-11-07_16-50-55_ID282/boot/initramfs-linux.img
& /@refind-btrfs/rwsnap_2023-11-07_16-50-55_ID282/boot/vmlinuz-linux
exist.
Any idea what might be going wrong here?
Try changing the "log_level" config option to 1 and then reboot the machine into a snapshot. That should provide you with more information about this error.
Before that, you might want to verify the existence of files contained by the /@/@refind-btrfs/rwsnap_2023-11-07_16-50-55_ID282/boot/
directory. If they do exist (this is also verified by refind-btrfs
) I don't really have advice other than asking rEFInd's author for help, here.
@Venom1991, hi, can you please take a look at this?
Summary: loader
should be loader /boot/vmlinuz-6.5.6-300.fc39.x86_64
not loader /@/boot/vmlinuz-6.5.6-300.fc39.x86_64
.
I can only get refind-btrfs
to run to completion with configuration-1
, if I try to boot into this snapshot I get an error from rEFInd
saying the loader configuration is not correct.
Also, do you plan to provide a Fedora package at any time?
configuration-1
refind.conf
menuentry "Fedora Linux 39 (Workstation Edition) - Stable" {
icon /EFI/refind/icons/os_fedora.png
volume "fedora-rootfs"
loader /@/boot/vmlinuz-6.5.6-300.fc39.x86_64
initrd /@/boot/initramfs-6.5.6-300.fc39.x86_64.img
options "root=UUID=5d302ebd-64a4-4d17-834b-61bd9e1d4cb2 ro add_efi_memmap rootflags=subvol=@"
submenuentry "Boot - terminal" {
add_options "systemd.unit=multi-user.target"
}
}
Generated btrfs-snapshot-stanzas/*.conf
:
menuentry "Fedora Linux 39 (Workstation Edition) - Stable (rwsnap_2023-12-25_15-06-52_ID263)" {
icon /EFI/refind/icons/os_fedora.png
volume "fedora-rootfs"
loader /root/.refind-btrfs/rwsnap_2023-12-25_15-06-52_ID263/boot/vmlinuz-6.5.6-300.fc39.x86_64
initrd /root/.refind-btrfs/rwsnap_2023-12-25_15-06-52_ID263/boot/initramfs-6.5.6-300.fc39.x86_64.img
options "root=UUID=5d302ebd-64a4-4d17-834b-61bd9e1d4cb2 ro add_efi_memmap rootflags=subvol=@/root/.refind-btrfs/rwsnap_2023-12-25_15-06-52_ID263"
}
Configuration that works
menuentry "Fedora Linux 39 (Workstation Edition) - Stable" {
icon /EFI/refind/icons/os_fedora.png
volume "fedora-rootfs"
loader /boot/vmlinuz-6.5.6-300.fc39.x86_64
initrd /boot/initramfs-6.5.6-300.fc39.x86_64.img
options "root=UUID=5d302ebd-64a4-4d17-834b-61bd9e1d4cb2 ro add_efi_memmap rootflags=subvol=@"
submenuentry "Boot - terminal" {
add_options "systemd.unit=multi-user.target"
}
}
menuentry "Fedora Linux 39 (Workstation Edition) - Stable (rwsnap_2023-12-25_15-06-52_ID263)" {
icon /EFI/refind/icons/os_fedora.png
volume "fedora-rootfs"
loader /root/.refind-btrfs/rwsnap_2023-12-25_15-06-52_ID263/boot/vmlinuz-6.5.6-300.fc39.x86_64
initrd /root/.refind-btrfs/rwsnap_2023-12-25_15-06-52_ID263/boot/initramfs-6.5.6-300.fc39.x86_64.img
options "root=UUID=5d302ebd-64a4-4d17-834b-61bd9e1d4cb2 ro add_efi_memmap rootflags=subvol=@/root/.refind-btrfs/rwsnap_2023-12-25_15-06-52_ID263"
}
@mbana
Hi there,
I've tried looking for text differences between these two configurations with this tool and it found that both boot stanzas (manual and generated ones) are identical so I cannot really see why the second one would supposedly let you boot into a snapshot whereas the first one wouldn't do so?
Also, do you plan to provide a Fedora package at any time?
No, not really because I don't use Fedora nor do I use an RPM-based distribution, for that matter. I use Arch and Debian and that's about it.
@Venom1991, sorry, my mistake. I meant I've had to specify the boot stanzas as:
loader /boot/vmlinuz-6.5.6-300.fc39.x86_64
initrd /boot/initramfs-6.5.6-300.fc39.x86_64.img
That is without the /@
at the beginning of the paths for it to work, and by that I mean for the refind-btrfs
command to generate the appropriate file in /boot/efi/EFI/refind/btrfs-snapshot-stanzas/
, if /@
is specified, the command runs to completion.
I guess I could fix this but I don't quite know what the side effects might be, that and the lack of tests make me a bit hesitant about making the change.
Do you have a separate /boot
partition?
Do you have a separate
/boot
partition?
No I do not.
$ cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sun Dec 24 03:54:10 2023
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=5d302ebd-64a4-4d17-834b-61bd9e1d4cb2 / btrfs subvol=@,compress=zstd:1 0 0
UUID=5d302ebd-64a4-4d17-834b-61bd9e1d4cb2 /.snapshots btrfs subvol=@snapshots,compress=zstd:1 0 0
UUID=1583-E8AA /boot/efi vfat umask=0077,shortname=winnt 0 2
UUID=5d302ebd-64a4-4d17-834b-61bd9e1d4cb2 /home btrfs subvol=@home,compress=zstd:1 0 0
$ sudo btrfs subvolume list -pgqt /
ID gen parent top level parent_uuid path
-- --- ------ --------- ----------- ----
256 5164 5 5 - @home
258 5163 5 5 - @
259 4605 258 258 - var/lib/machines
262 4294 5 5 - @snapshots
263 2856 262 262 a308b1a1-b187-114d-8c74-480010bb630f @snapshots/1/snapshot
264 2921 258 258 e925c8ac-7404-6345-a0b7-b41ecc97b21b root/.refind-btrfs/rwsnap_2023-12-25_15-06-52_ID263
I don't know why rEFInd wouldn't be able to boot using the /root/.refind-btrfs/rwsnap_2023-12-25_15-06-52_ID263/boot/vmlinuz-6.5.6-300.fc39.x86_64
and /root/.refind-btrfs/rwsnap_2023-12-25_15-06-52_ID263/boot/initramfs-6.5.6-300.fc39.x86_64.img
files. Do they exist on your filesystem?
Also, rEFInd should be able to accept logical loader
and initrd
paths (a contributor wrote its Btrfs drivers, AFAIK), that is those paths that are prefixed with the name of the subvolume which contains the referenced files. I've not personally encountered any issues with this way of defining loader
and initrd
paths.
If you can also verify the existence of these files, like @djmadeira can:
I've verified that /@refind-btrfs/rwsnap_2023-11-07_16-50-55_ID282/boot/initramfs-linux.img & /@refind-btrfs/rwsnap_2023-11-07_16-50-55_ID282/boot/vmlinuz-linux exist.
there isn't really a lot that I can do other than to recommend checking rEFInd's logs and perhaps seeking help on Sourceforge. Changing this crucial part of the process would assuredly break a lot of user's setups.
Just to be clear, it's not rEFInd
that's the issue, it's rEFInd-btrfs
. As I mentioned before, with this boot stanza rEFInd-btrfs
does not run to completion (it fails):
menuentry "Fedora Linux 39 (Workstation Edition) - Stable" {
icon /EFI/refind/icons/os_fedora.png
volume "fedora-rootfs"
loader /boot/vmlinuz-6.5.6-300.fc39.x86_64
initrd /boot/initramfs-6.5.6-300.fc39.x86_64.img
options "root=UUID=5d302ebd-64a4-4d17-834b-61bd9e1d4cb2 ro add_efi_memmap rootflags=subvol=@"
submenuentry "Boot - terminal" {
add_options "systemd.unit=multi-user.target"
}
}
As a result, we don't have any /boot/efi/EFI/refind/btrfs-snapshot-stanzas/*
files - or stanzas that contains snapshots to boot from.
Could you please try this setup and try to replicate.
The problem with this stanza is that I expect loader
and initrd
paths to be logical ones, i.e. that they be explicitly defined as parts of the @
subvolume (because you do not have a separate /boot
partition), as seen in the example boot stanza.
Like I said, messing with this part of the process would inevitably result in tears, especially due to a lack of tests as you've noticed yourself, before.