Migrating from grub to rEFInd. Snapshots and other things

So it can actually represent the UUID of a deleted subvolume? If so, that’s a pretty meaningless (superfluous, even) piece of information if you ask me. There’s no way you can mount that subvolume or do anything with it, really, because it’s been deleted.

It’s hard for me to understand because there are so many different options. (packages) There is the refind-btrfs.conf, refind.conf and refind_linux.conf… and so on. I have btrfs-assistant installed with snapper and snap-pac. I’m not even sure if it works with this or i need another package instead in order to have boot from snapshots in rEFInd. I think i need @dalto expertise. It would be nice to have this refind-btrs setup working to go along with the btrfs-assistant using rEFInd.

I see, this is the issue. You are trying to make it work with any btrfs snapshot including manual snapshots.

Given the way btrfs handles snapshots this seems hard. As soon as you do a restore the other snapshots of that subvolume could have the same parent UUID as the restored subvolume.

More, the snapshots of a given subvolume name could all have different parent UUIDs

Snapshots in general are quite odd in btrfs. It seems like it would make more sense for them to attirbutes of the parent instead of loosely coupled the way they are.

Here is a real world example for reference. As you can see, the snapshots have different parent UUIDs and most of them refer to a UUID that doesn’t exist any longer.

This isn’t a / subvolume but the same thing could happen there.

ID 1185 gen 136072 top level 3859 parent_uuid -                                    uuid 871d61c6-f498-8a47-918d-7cf18f722e31 path @home/dalto/@docs/.snapshots
ID 1188 gen 52652 top level 1185 parent_uuid 6262c2be-cd83-ce41-b7e6-35730e03d1bc uuid 36e474a7-be4a-2041-b5dd-77fe95061602 path @home/dalto/@docs/.snapshots/3/snapshot
ID 1209 gen 53430 top level 1185 parent_uuid 6262c2be-cd83-ce41-b7e6-35730e03d1bc uuid 33e25500-8f29-334d-a026-33a820af7c28 path @home/dalto/@docs/.snapshots/10/snapshot
ID 2559 gen 111183 top level 257 parent_uuid cf66a591-5a4a-f642-af91-1ec6dbc2490f uuid 5b01ff91-c52f-6648-a904-19a4381999fd path @home/dalto/@docs_backup_20221505085137621
ID 2675 gen 100845 top level 1185 parent_uuid 5b01ff91-c52f-6648-a904-19a4381999fd uuid 701eb6fe-9268-2141-9380-d435ccac72c3 path @home/dalto/@docs/.snapshots/493/snapshot
ID 3239 gen 111783 top level 257 parent_uuid 902d6787-ba91-5049-b8ef-ba65616c5eba uuid 9a1a420d-af23-1f40-b145-f36aa743c0bc path @home/dalto/@docs_backup_20221505161716824
ID 3254 gen 123569 top level 257 parent_uuid 5ae23e6e-9602-8a44-a7da-5606b9ab2356 uuid 4b833fa2-ca97-5744-a925-0989276ab657 path @home/dalto/@docs_backup_20221106095056045
ID 3535 gen 117423 top level 1185 parent_uuid 4b833fa2-ca97-5744-a925-0989276ab657 uuid 72a038c9-0a69-2d45-b33d-740ed9da88ab path @home/dalto/@docs/.snapshots/771/snapshot
ID 3859 gen 135996 top level 257 parent_uuid f9665695-b583-9a47-8a45-1622b8925626 uuid dfd7b594-2ea6-494d-9908-df1ef54951bd path @home/dalto/@docs
ID 3974 gen 125765 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid a79f5a94-5516-5147-9aa0-e1d8b546f895 path @home/dalto/@docs/.snapshots/917/snapshot
ID 4223 gen 130454 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid e1961579-8e07-8842-bda4-7af6777c2063 path @home/dalto/@docs/.snapshots/1000/snapshot
ID 4226 gen 130471 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid 4c988a98-842c-4544-89d5-8d1e92f0129e path @home/dalto/@docs/.snapshots/1001/snapshot
ID 4268 gen 131254 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid 6db84c25-9006-9949-b3c3-63c6f7131d38 path @home/dalto/@docs/.snapshots/1015/snapshot
ID 4319 gen 132215 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid 628885d9-9985-3e45-99a8-73d8f336dad4 path @home/dalto/@docs/.snapshots/1032/snapshot
ID 4328 gen 132384 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid f3a0113a-4cdf-fb43-9dfd-c8273754a48e path @home/dalto/@docs/.snapshots/1035/snapshot
ID 4361 gen 132951 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid 7b30921a-d9e5-8f47-891b-41533d54d526 path @home/dalto/@docs/.snapshots/1046/snapshot
ID 4364 gen 133037 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid e88ab860-13e6-f949-93c4-fb9f7214b9a9 path @home/dalto/@docs/.snapshots/1047/snapshot
ID 4373 gen 133197 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid d6e6815a-90f4-0d4c-ae98-b87d5656cf40 path @home/dalto/@docs/.snapshots/1050/snapshot
ID 4424 gen 134152 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid ec3b6d21-2ab8-ca43-afa8-f155aadf2b39 path @home/dalto/@docs/.snapshots/1067/snapshot
ID 4496 gen 135498 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid bce675dd-9920-f046-ae43-cc66cb329f1f path @home/dalto/@docs/.snapshots/1091/snapshot
ID 4499 gen 135552 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid 27525164-42ce-c94f-be2c-91b00655c96b path @home/dalto/@docs/.snapshots/1092/snapshot
ID 4502 gen 135607 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid 5f571ecb-a9a3-3c46-ac4b-246e07e8d8b4 path @home/dalto/@docs/.snapshots/1093/snapshot
ID 4505 gen 135661 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid 15bb4e74-ccb5-1442-9885-211c9a1d2d30 path @home/dalto/@docs/.snapshots/1094/snapshot
ID 4508 gen 135716 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid 44d6e708-4761-9140-be70-58aebfbb930e path @home/dalto/@docs/.snapshots/1095/snapshot
ID 4511 gen 135771 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid c18f0ee9-1654-0c47-803e-b6887a97617a path @home/dalto/@docs/.snapshots/1096/snapshot
ID 4514 gen 135827 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid 62886965-56ee-1d46-8965-d0cc859db7d9 path @home/dalto/@docs/.snapshots/1097/snapshot
ID 4517 gen 135885 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid 5fcd9646-637c-a649-8463-0e6c124cf871 path @home/dalto/@docs/.snapshots/1098/snapshot
ID 4520 gen 135941 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid 92311182-b07b-6f49-ba51-842d742ca7d7 path @home/dalto/@docs/.snapshots/1099/snapshot
ID 4523 gen 135996 top level 1185 parent_uuid dfd7b594-2ea6-494d-9908-df1ef54951bd uuid 2ebbe68e-e9b6-e34b-afa5-1be4f04fe267 path @home/dalto/@docs/.snapshots/1100/snapshot

I see, this is the issue. You are trying to make it work with any btrfs snapshot including manual snapshots.

As far as I understand it, all of these tools are convenient wrappers around Btrfs userspace libraries which means that all of them, internally (under the hood, however you want to put it), call the same functions. They’re meant to save the user from having to write their own scripts or similar.

But I agree in a sense that there is no “standardized” way of doing snapshot management, subvolume restoring and similar but that’s just how things are with Linux in general.

1 Like

That is true but the problem is that the underlying btrfs information isn’t enough on it’s own to get you back to where you need to go. Tools like like snapper and timeshift contain supplemental information that will help with this.

As the maintainer of a partially agnostic btrfs tool myself, I understand your pain.

@Venom1991 Can you have a look at the boot stanza I posted above? It’s coming back unusable but I’m not sure why.

Sep 11 13:00:58 bryan-zenbookux425qaum425qa /usr/lib/python3.10/site-packages/refind_btrfs/main.py[606]: ERROR (refind_btrfs.state_management.conditions/conditions.py/check_matched_boot_stanzas): None of the matched boot stanzas are usable!

I am not sure why that isn’t working with btrfs-refind but as general note, do you not need to load any microcode?

Apparently not. I’ve got a Ryzen 5800U in here and the contents of refind_linux.conf are as follows, don’t see a microcode option. This is where I got the custom stanza options in the first place.

"Boot with standard options"  "root=UUID=115e14e8-db06-40b9-8639-6934372d846e rw rootflags=subvol=@ resume=UUID=3cbbdf01-e7a7-4fa9-a24f-48180d6f4b45 loglevel=3 nowatchdog nvme_load=YES i8042.probe_defer"
"Boot to single-user mode"    "root=UUID=115e14e8-db06-40b9-8639-6934372d846e rw rootflags=subvol=@ resume=UUID=3cbbdf01-e7a7-4fa9-a24f-48180d6f4b45 loglevel=3 nowatchdog nvme_load=YES i8042.probe_defer single"
"Boot with minimal options"   "ro root=/dev/nvme0n1p2"

btrfs-refind is definitely deciding that the manual stanzas aren’t right, and based on the fact that I can’t boot with them I agree, but I’d like to find out what it’s keying in on, since refind is supposed to be using the options in refind_linux.conf for the automatic boot entries…which I used to create the manual stanzas. :slight_smile:

I tried in a vm and the only thing I’m getting is the refind-btrfs reports it can’t find the snapshots. I just don’t understand it well enough to figure it out.

If you are using the Ryzen, you should be loading amd_code.img, refind doesn’t autodetect that. Add it to the options line initrd=boot\amd-ucode.img

Weird that I’m not running with that now. I’ll add it to both areas and see what happens…after the game that I’m currently watching on the machine. :wink:

Here the example from the Arch wiki:

menuentry "Arch Linux" {
	icon     /EFI/refind/icons/os_arch.png
	volume   "Arch Linux"
	loader   /boot/vmlinuz-linux
	initrd   /boot/initramfs-linux.img
	options  "root=PARTUUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX rw add_efi_memmap initrd=boot\intel-ucode.img initrd=boot\amd-ucode.img"
	submenuentry "Boot using fallback initramfs" {
		initrd /boot/initramfs-linux-fallback.img
	}
	submenuentry "Boot to terminal" {
		add_options "systemd.unit=multi-user.target"
	}
}

Your manual stanza has…

Is “EndeavourOS” your actual partition label?

I’ve just done a test, admittedly not BTRFS, but using my root partition LABEL for “volume” gives a booting manual stanza.

Yeah, it is. I guess I haven’t tried using the GUID yet. Can’t leave that as default as rEFInd is on the EFI parititon and the kernels aren’t.

1 Like

The only thing I’d suggest is try removing the quotes…
Probably won’t work…
But you never know…
:smiley:

Ok, specifying the UUID of the partition didn’t work…though the partition shows “No Label” in rEFInd so something’s not matching up.

Anyway, now we’re here, still not booting, and refind_btrfs still says the stanza isn’t usable. Next up will be removing the quotes from menuentry…that’s not the way the Arch Wiki has it, but maybe it’s wrong.

menuentry "EndeavourOS Zen" {
    icon     /EFI/refind/icons/endeavour-zen.png
    volume   115E14E8-DB06-40B9-8639-6934372D846E
    loader   /boot/vmlinuz-linux-zen
    initrd   /boot/initramfs-linux-zen.img
    options  "root=UUID=115e14e8-db06-40b9-8639-6934372d846e rw rootflags=subvol=@ resume=UUID=3cbbdf01-e7a7-4fa9-a24f-48180d6f4b45 loglevel=3 nowatchdog nvme_load=YES add_efi_memmap initrd=boot\amd-ucode.img i8042.probe_defer"
    submenuentry "Boot using fallback initramfs" {
        initrd /boot/initramfs-linux-zen-fallback.img
    }
    submenuentry "Boot to terminal" {
        add_options "systemd.unit=multi-user.target"
    }
#    disabled
}

What are the loader and init lines relative to? Do you need to put the subvolume in there? Like @/boot/vmlinuz-linux-zen?

I don’t think so, it’s finding the icon. Worth a try though.

Pulling the quotes out caused rerfind-btrfs to generate validation errors, so I don’t think that’s it.

1 Like