Using Snapper on openSUSE to Take Atomic System Snapshots and Roll Back Changes
Learn how to create, verify, and roll back Btrfs snapshots on openSUSE with Snapper, ensuring safe package updates and system recovery. Follow step‑by‑step commands and checks for a reliable rollback process.
30 May 2026, 20:37 UTC

Desired Outcome
On openSUSE (Leap or Tumbleweed), you want to guarantee that every package change can be undone atomically. The goal is to use the built‑in Btrfs file system and the Snapper tool to create pre‑ and post‑snapshots around Zypper operations, verify that snapshots exist, and roll back to a known‑good state if something goes wrong.
Prerequisites
- openSUSE 15.x or newer installed on a Btrfs‑formatted root partition.
- Root or sudo privileges to run Snapper and Zypper commands.
- Basic familiarity with the command line and Btrfs concepts.
- Optional: a recent backup of critical data (not required for the rollback itself).
Subvolume Layout Overview
openSUSE arranges the filesystem as follows:
/– the root subvolume (snapshots target)./var– separate subvolume for system logs and state./home– separate subvolume for user data.
Because /var and /home are isolated, a system rollback will not touch user files or logs.
Step 1 – Verify Snapper Installation
# snapper --version
snapper 1.5.0
If Snapper is missing, install it with zypper install snapper.
Step 2 – Inspect Existing Snapshots
# snapper list
ID STATE TIMESTAMP PRE POST COMMENT
0 default 2026-10-13 12:00:00 - - system root
1 pre 2026-10-13 12:05:00 - 2 package update
2 post 2026-10-13 12:05:10 1 - package update
The snapper list command shows numbered snapshots. The first snapshot (0) is the default boot root. Snapshots with pre and post states surround each Zypper transaction.
Step 3 – Trigger an Automatic Snapshot Pair
Run a package installation or update. Snapper will automatically create a pre snapshot before the transaction and a post snapshot after it completes.
# zypper install vim
After the command finishes, run snapper list again to confirm a new pre and post pair.
Step 4 – Verify Snapshot Visibility in GRUB
Reboot the machine. In the GRUB menu, you should see entries like:
- openSUSE 15.6 (read‑only snapshots)
- openSUSE 15.6 snapshot #3 (pre‑update)
Selecting a snapshot boots the system into that snapshot’s state. This is a quick manual rollback option.
Step 5 – Perform a Permanent Rollback
If you decide you want to roll back permanently to snapshot 1 (the pre‑update state), run:
# snapper rollback 1
Explanation of the command:
snapper rollback 1creates a new snapshot that copies the contents of snapshot1and sets it as the new default boot root.- It does not delete the original snapshot; you still have the history.
After the command completes, reboot. The system will boot from the rolled‑back snapshot.
Expected Checks After Rollback
snapper list– verify that a new snapshot (e.g.,4) appears as the default state.- Run
zypper se vim– confirm that the package is still installed or removed, depending on the snapshot. - Check
/etc/os-release– ensure system version matches the snapshot.
Recovery Options
- If the rollback fails to boot, use the GRUB
read‑only snapshotsentry to boot into the last known‑good snapshot. - If Snapper configuration is corrupted, you can manually create a new snapshot with
snapper create --description "manual backup"and then set it as default withsnapper set-default. - As a last resort, use a live USB to mount the root subvolume and manually copy files from a healthy snapshot to a recovery location.
Limitations & Practical Checks
- Snapshots do not cover
/homeor/vardata; user files remain untouched during a system rollback. - Each snapshot consumes space. Monitor disk usage with
btrfs filesystem df /and clean old snapshots viasnapper cleanup. - Manual modifications to Btrfs subvolumes (e.g., moving
/homeinto the root subvolume) break Snapper integration. Avoid such changes. - Always run
snapper listbefore and after operations to confirm snapshot creation.
Conclusion
By leveraging openSUSE’s default Btrfs layout and the Snapper tool, you can safely package update, verify, and roll back system changes with minimal risk. The process is fully automated for Zypper transactions, yet you retain manual control via GRUB or the snapper rollback command. Regular snapshot cleanup and awareness of the subvolume layout will keep your system clean and recoverable.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.