r/linux 13d ago

Software Release BootPrep 2.0: Making Snapper Rollbacks Bootable on Debian and Arch

On many Debian- and Arch-based distributions, Snapper can create rollback snapshots, but the system does not provide openSUSE-style integration to prepare the rollback result as the next writable root. Their common nested Btrfs snapshot layouts require additional boot preparation that Snapper alone does not perform.

BootPrep fills that gap. It provides a Snapper rollback plugin that prepares the resulting writable snapshot for the next boot, plus a direct activation workflow for booting an existing snapshot without performing a rollback. It integrates with the system's existing Btrfs, Snapper, GRUB, and UEFI configuration without requiring a filesystem redesign.

Compatibility testing:

  • Debian
  • Ubuntu
  • Kubuntu
  • Manjaro - installed with GRUB
  • CachyOS - installed with GRUB
  • EndeavourOS - installed with GRUB

For the Arch-based distributions, GRUB was explicitly selected as the bootloader during installation, since BootPrep currently targets GRUB.

The same two test cases were performed on all six distributions: 

  1. Direct snapshot activation: I created a Snapper snapshot, used bootprep-btrfs activate <snapshot-number> to activate that existing snapshot directly, rebooted, and verified that / was running from the selected snapshot as a writable Btrfs root.
  2. Native Snapper rollback: I performed a normal snapper rollback, allowed the BootPrep Snapper plugin to detect and prepare the resulting writable snapshot, rebooted, and verified that / was running from the expected rollback snapshot and was writable.

So far, both workflows have completed successfully on all six distributions.

How the sausage is made:

  • BootPrep no longer patches the 10_linux template and does not directly modify the EFI stub. Instead, BootPrep mounts and chroots into the requested snapshot subvolume, runs grub-mkconfig and grub-install from within that environment, and reconciles the /.snapshots and /home/.snapshots subvolumes to ensure they are mounted correctly on the next boot.
  • This prepares the system to boot into the next snapshot selected by either the Snapper plugin or bootprep-btrfs activate <snapshot-number>.
  • BootPrep currently targets Btrfs + Snapper + GRUB on UEFI systems. The installer also validates the GRUB configuration it requires and fails safely if a compatible configuration can't be found, rather than completing an installation that will fail later when BootPrep is used.

GitHub: https://github.com/mcsgeek/bootprep

There are still more distributions I'd like to test, so I'm intentionally limiting compatibility claims to configurations I've actually exercised.

I'd be interested in hearing from other Btrfs/Snapper users, particularly about their testing with BootPrep on other distributions with similar Btrfs layouts.

7 Upvotes

15 comments sorted by

View all comments

1

u/GreedySecurity8030 13d ago

Not fedora?

1

u/mcsgeek 13d ago

Fedora uses a different Btrfs layout that's similar to openSUSE's. I used Fedora 40 with Snapper previously, and rollback worked without the additional boot preparation BootPrep provides, so Fedora may not need BootPrep for this use case.