Skip to content

ERROR (refind_btrfs.state_management.refind_btrfs_machine/refind_btrfs_machine.py/run): Subvolume '@' is itself a snapshot #61

Open
@Martan404

Description

@Martan404

So I have an Arch system with BTRFS snapshots using snapper and the standard Arch BTRFS partition layout. Previously I used GRUB with grub-btrfs as my bootloader and now I use rEFInd instead.

When I try to run refind-btrfs I get these errors

Initializing the block devices using lsblk.
Initializing the physical partition table for device '/dev/sda' using lsblk.
Initializing the live partition table for device '/dev/sda' using findmnt.
Initializing the physical partition table for device '/dev/sdb' using lsblk.
Initializing the live partition table for device '/dev/sdb' using findmnt.
Initializing the physical partition table for device '/dev/nvme0n1' using lsblk.
Initializing the live partition table for device '/dev/nvme0n1' using findmnt.
Found the ESP mounted at '/boot' on '/dev/nvme0n1p1'.
Found the root partition on '/dev/nvme0n1p2'.
Found a separate boot partition on '/dev/nvme0n1p1'.
Searching for snapshots of the '@' subvolume in the '/.snapshots' directory.
Found subvolume '@' mounted as the root partition.
ERROR (refind_btrfs.state_management.refind_btrfs_machine/refind_btrfs_machine.py/run): Subvolume '@' is itself a snapshot (parent UUID - 'b1004b3f-ebee-0d4f-bc30-f8d763023dda'), exiting...

I am assuming it might be because of how I restore my snapshots? My system is not read-only and there is no reason I can not make a new snapshots for my system.

Here's the script I am using to restore a previous snapshot after I have booted in to it from grub

#!/bin/bash
# shellcheck disable=SC2002,SC2162,SC2086
snapshot_layout="arch"
snap_manager="snapper"

if [[ $snapshot_layout == "snapper" ]]; then
		snapshot_path="$snaphot_number/snapshot"

	elif [[ $snapshot_layout == "arch" ]] && [[ $snap_manager == "snapper" ]]; then
		snapshot_path="$snaphot_number/snapshot"

	elif [[ $snapshot_layout == "arch" ]] && [[ $snap_manager == "yabsnap" ]]; then
		snapshot_path="$snaphot_number"
fi

echo -e "
                        Snapshot rollback script
-------------------------------------------------------------------------"

root_disk=$(cat /proc/cmdline | awk '{sub("root=UUID=", "", $2); print $2}')
snaphot_number=$(cat /proc/cmdline | awk -F '/' '{print $3}')

echo -e "Mounting root on /mnt"

sudo mount "/dev/disk/by-uuid/$root_disk" /mnt

echo -e "-------------------------------------------------------------------------"
echo -e "Moving broken root"

sudo mv /mnt/@ /mnt/@broken

echo -e "-------------------------------------------------------------------------"
echo -e "Setting snapshot as root"

sudo btrfs subvolume snapshot /mnt/@snapshots/$snapshot_path /mnt/@ && success="yes"

echo -e "-------------------------------------------------------------------------"
echo -e "Removing broken root"

[[ $success == "yes" ]] && sudo rm -rf /mnt/@broken

if [ -e "/mnt/@/var/lib/pacman/db.lck" ]; then

	echo -e "-------------------------------------------------------------------------"
	echo -e "Removing pacman db.lck"

	sudo rm /mnt/@/var/lib/pacman/db.lck
fi

echo -e "-------------------------------------------------------------------------"
echo -e "Unmounting /mnt"

sudo umount -R /mnt

read -p "Press any key to reboot..."
reboot

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions