How many root files can be rollbacked by Snapper?

I installed openSUSE 15.2 on a luks2 lvm btrfs, Snapper is enabled by default. After some root operations I tried to rollback the system to the earlier snapshot. I remember which softwares did not exist in the snapshot, but after rollback the unwanted softwares are not removed by Snappper.

Can’t Snapper remove the files in running? What files can/can’t be removed by Snapper?

I wonder what your ideas are about Btrfs and snapper.

I seems you think that snapshots are taken whenever a bit changes in a file on a Btrfs subvolume.
This is not the case. Snapshots must be made. And yes, when you use zypper/YaST to install software, snapshots are made. But when you e.g. change a character in a configuration file in /etc, a snapshot is not created automagicaly.

The snapshot of subvolume I am referring to is made automatically every one hour by Snapper with default configuration, which can be seen in Snapper window. Do I need to boot into live USB for the rollback?

Snapshots are managed automatically, see “man snapper”. Change settings at /etc/snapper/configs/root. For reverting to an older snapshot use “snapper rollback …” and reboot.

You need to explain how you check for the software existence (specific file or its content? RPM package? something else?) Copy-paste exact commands and their output you used to check for software and to perform rollback.

Otherwise any response will be just guesswork.

Never find “snapper rollback …” option in Snapper interface…In fact, I select the snapshot, click show changes, then select all files, restore them all. is that the “rollback”?

Sorry I reinstalled openSUSE then. By the way, what is differences between “restore all files in Snapper” and “rollback”?

A btrfs file system consists of subvolumes and snapshots (readonly or read/write), one of which is mounted to / by default when a subvolid isn’t specified. Rollback simply sets a new default subvolume, which will be one of those readonly snapshot taken sometime before. Actually a new read/write snapshot is made from that readonly snapshot, and set as default subvolume. The state is reverted as one atomic operation. This is a btrfs basic feature.

Find the current default rootfs:

btrfs subvolume get-default /

“Restore selected files”, as the label implies, lets you pick which files are restored, which means they need to be restored one by one. This is done by snapper itself.

openSUSE installer defaultly presets some subvolumes with COW disable for performance reason, and both /boot and /boot/efi are not btrfs, only change the rootfs default subvolume is enough to the whole / (except /home)? Last year I changed the default subvolume to the snapshot made by Snapper then made errors on Snapper.

There is “yast2 snapper” and there is “snapper”. From “snapper --help”:

  Rollback:
        snapper rollback [number]

    Options for 'rollback' command:
        --print-number, -p              Print number of second created snapshot.
        --description, -d <description> Description for snapshots.
        --cleanup-algorithm, -c <algo>  Cleanup algorithm for snapshots.
        --userdata, -u <userdata>       Userdata for snapshots.


You may rollback to any of the known snaphots:

erlangen:~ # snapper list
    # | Type   | Pre # | Date                     | User | Used Space | Cleanup | Description            | Userdata     
------+--------+-------+--------------------------+------+------------+---------+------------------------+--------------
   0  | single |       |                          | root |            |         | current                |              
1629* | single |       | Wed Jul 29 04:45:52 2020 | root | 176.00 KiB |         | writable copy of #1623 |              
1630  | pre    |       | Thu Jul 30 05:58:23 2020 | root | 311.16 MiB | number  | zypp(zypper)           | important=no 
1631  | post   |  1630 | Thu Jul 30 05:59:00 2020 | root |  13.02 MiB | number  |                        | important=no 
1632  | pre    |       | Fri Jul 31 05:24:28 2020 | root |  15.33 MiB | number  | zypp(zypper)           | important=no 
1633  | post   |  1632 | Fri Jul 31 05:26:45 2020 | root |   7.34 MiB | number  |                        | important=no 
1634  | pre    |       | Fri Jul 31 20:32:05 2020 | root |   6.52 MiB | number  | zypp(zypper)           | important=yes
1635  | post   |  1634 | Fri Jul 31 20:33:27 2020 | root |  11.77 MiB | number  |                        | important=yes
1636  | pre    |       | Sat Aug  1 05:43:10 2020 | root |   1.12 MiB | number  | zypp(zypper)           | important=no 
1637  | post   |  1636 | Sat Aug  1 05:43:26 2020 | root |   1.69 MiB | number  |                        | important=no 
1638  | pre    |       | Sun Aug  2 06:16:02 2020 | root |   9.20 MiB | number  | zypp(zypper)           | important=yes
1639  | post   |  1638 | Sun Aug  2 06:18:16 2020 | root |   2.28 MiB | number  |                        | important=yes
1640  | pre    |       | Sun Aug  2 07:10:47 2020 | root | 512.00 KiB | number  | yast snapper           |              
1641  | post   |  1640 | Sun Aug  2 07:12:21 2020 | root | 144.00 KiB | number  |                        |              
erlangen:~ # 

Quite a few subvolumes, but only /var has the nocow attribute.

/boot/efi can’t be btrfs, and there are two btrfs subvolumes under /boot/grub2/, but /boot is a plain subdirectory on rootfs.

That’s right. Of course, not any subvolume can be the new default, it should be a read/write snapshot from the top-level subvolume.

If you changed manually, I wouldn’t be surprised. If you change it through snapper, then a bug report is warranted.

If you pick an entry of Type = “Pre”, snapper will complain that it can show the differences. Because it needs exactly two snapshots, a Pre and a Post. I already explained how this “Restore” (which is not “Rollback”, notice the naming scheme) works. IMO this option (Restore) should be buried, and the real “rollback” should be present in a GUI.

This years I had always thought YaST-Snapper and Snapper are the same thing. Thank you so much to your correction on me.

I doubt there is much if any difference.
Prompted by this discussion, I took another look at YaST2 “filesystem snapshots” which is a name change from previous implementations.
Interesting changes, as the @OP noticed, the prominent “Show Changes” button now makes it easy to “undo” file changes instead of the entire volume which is the default behavior of command line snapper.

I actually doubt there is any difference between the two, only that each emphasizes a specific functionality… So for instance it looks like it’s still very easy to use YaST Filesystem Snapshots to rollback an entire volume just as it’s also likely possible to restore individual files from a snapshot using snapper.

In any case the ability to rollback or recover versions of a file is a feature of BTRFS, not whatever application is used to used to utilize that feature.

Another note…
LVM and BTRFS volumes are incompatible although structurally similar.
Because of their similarity, the YaST Volume Management module has the ability to manage both types of volumes, but the original post suggests there was a mixing of the two on the same system (which can’t happen).

By all appearances but recognizing could be inaccurate…
TSU