btrfs snapshots are a wonderful safety net right up to the moment you actually need one, at which point you discover that "roll back to this morning" means booting into a snapshot, and your boot manager has never heard of it. The excellent refind-btrfs solves this, but it's Python with a dependency tree, and I wanted something I could drop onto a machine as one file and forget about.
So refind-btrfs-snapshots is a single static Go binary that discovers your btrfs snapshots and generates rEFInd boot-menu entries for them. Run it as a one-off whenever you like; it's a plain binary, so systemd isn't required. But drop in the optional systemd path unit and it watches your snapshots directory, so the instant Snapper takes a snapshot the boot menu regenerates and that backup is bootable straight away, with nothing for you to remember to run. Either way, you pick a snapshot from the boot menu and boot straight into it.
The part I care about is that it gets the details right, because boot is exactly where you don't want surprises:
- Per-snapshot boot-mode detection. Whether a snapshot boots in ESP mode (kernel on a separate
/boot) or btrfs mode (kernel inside the snapshot) is read from that snapshot's own/etc/fstab, not assumed globally. So snapshots taken before you changed your disk layout still boot correctly, and one menu can mix both kinds. - Stale-kernel handling, the feature other tools skip. With a separate ESP
/boot, a kernel upgrade can leave an old snapshot whose kernel modules no longer match the kernel on the ESP. It would boot, then fail to find its modules. This binary detects that mismatch and, by default, excludes the snapshot rather than offering you a boot that dies halfway, withwarn,disableandfallbackoptions if you'd rather handle it differently. Not silently. - The correct config method. It writes an include file rather than abusing
refind_linux.conf(which can only overrideoptions, not thevolume/loader/initrdthat btrfs-mode entries need), and it shows you a diff before it touches anything.
And it auto-detects most of what matters: your ESP, each snapshot's boot mode, a standard Snapper layout. The defaults work with no configuration on a typical setup, so for most people it's install, enable the path unit, and forget it's there. Installs from the AUR (refind-btrfs-snapshots-bin) or as a prebuilt binary, and --dry-run is first-class. Repo on GitHub.
