Question starting with snapper

I am following the openSUSE Snapper Tutorial which has been harder than I expected because although I had done a new installation when I upgraded my hardware a couple of years ago and upgraded almost daily using zypper up, I found that snapper had not been started so I had to create the initial root configuration using snapper create-config

sudo snapper create-config /

After checking and editing my /etc/snapper/configs/root file I have been able to see something happening:-

alastair@HP-Z640-1:~> sudo snapper list
[sudo] password for root: 
 # | Type   | Pre # | Date                         | User | Cleanup  | Description          | Userdata
---+--------+-------+------------------------------+------+----------+----------------------+---------
0  | single |       |                              | root |          | current              |         
1  | single |       | Sat 22 Jul 2023 16:00:37 BST | root | number   | boot                 |         
2  | single |       | Sat 22 Jul 2023 16:00:37 BST | root | timeline | timeline             |         
3  | single |       | Sat 22 Jul 2023 16:00:37 BST | root | timeline | timeline             |         
4  | pre    |       | Sat 22 Jul 2023 16:22:53 BST | root | number   | yast system_settings |         
5  | post   |     4 | Sat 22 Jul 2023 16:22:53 BST | root | number   |                      |         
alastair@HP-Z640-1:~> 

However I still only have root and cannot see /home as in:-

alastair@HP-Z640-1:~> sudo snapper list-configs
[sudo] password for root: 
Config | Subvolume
-------+----------
root   | /        
alastair@HP-Z640-1:~> 

Reading on I thought I would try the next part of the tutorial

Now we want to try Snapper as an undo tool for YaST. First we run YaST:

yast2 system_settings
alastair@HP-Z640-1:~> sudo yast2 system_settings
No such client module system_settings
alastair@HP-Z640-1:~> 

and then
Within YaST enable the SysReq. After you have finished YaST you should see two new snapshots:

I give in! Clearly I am an unworthy student. Please could somebody help.

Did you create snapper configuration for /home? You have shown only one single command

Why do you expect to see /home if you did not create configuration for /home?

I don’t have that module either. Maybe it’s not default or not used anymore and the tutorial isn’t up-to-date. It doesn’t really matter anyways. For the sake of the tutorial you could do any change (preferably one of which you know the effect) to the system configuration or the security center and snapper should create a snapshot to which you can roll back.

In addition to what arvidjaar wrote: Is your /home on a seperate partition and if yes which filesystem are you using?

I thought I had, this is what I ran:-

I though I had. This is what I ran:-

alastair@HP-Z640-1:~> sudo snapper -c home/create-config /home
[sudo] password for root: 
Unknown command '/home'.
Try 'snapper --help' for more information.
alastair@HP-Z640-1:~> 

Here is what my system sees:-

alastair@HP-Z640-1:~> sudo btrfs subvolume list /
ID 256 gen 232337 top level 5 path @
ID 257 gen 232341 top level 256 path var
ID 258 gen 231953 top level 256 path usr/local
ID 259 gen 232341 top level 256 path tmp
ID 260 gen 232012 top level 256 path srv
ID 261 gen 232142 top level 256 path root
ID 262 gen 231952 top level 256 path opt
ID 263 gen 232341 top level 256 path home
ID 264 gen 232012 top level 256 path boot/grub2/x86_64-efi
ID 265 gen 232012 top level 256 path boot/grub2/i386-pc
ID 309 gen 108176 top level 257 path var/lib/machines
ID 652 gen 232142 top level 256 path .snapshots
ID 653 gen 232022 top level 652 path .snapshots/1/snapshot
ID 654 gen 232023 top level 652 path .snapshots/2/snapshot
ID 655 gen 232024 top level 652 path .snapshots/3/snapshot
ID 656 gen 232065 top level 652 path .snapshots/4/snapshot
ID 657 gen 232066 top level 652 path .snapshots/5/snapshot
ID 658 gen 232134 top level 652 path .snapshots/6/snapshot
ID 659 gen 232135 top level 652 path .snapshots/7/snapshot
ID 660 gen 232136 top level 652 path .snapshots/8/snapshot
ID 661 gen 232137 top level 652 path .snapshots/9/snapshot
ID 662 gen 232141 top level 652 path .snapshots/10/snapshot
alastair@HP-Z640-1:~> 

Should be:

sudo snapper -c home create-config /home

Hi and thanks for the reply. It really does my head in when the tutorial is not up to date which is not unusual in my experience, but I understand why given the pace of changes.
I had already moved on in the tutorial and I am now trying to work out what is expected. My home directory is on a btrfs subvolume as in:-
@/home Btrfs Subvolume mounted at /home

1 Like

OK That explains it. How I have it thanks. Clearly I need specs!

alastair@HP-Z640-1:~> sudo btrfs subvolume list /
ID 256 gen 232367 top level 5 path @
ID 257 gen 232367 top level 256 path var
ID 258 gen 231953 top level 256 path usr/local
ID 259 gen 232367 top level 256 path tmp
ID 260 gen 232012 top level 256 path srv
ID 261 gen 232361 top level 256 path root
ID 262 gen 231952 top level 256 path opt
ID 263 gen 232367 top level 256 path home
ID 264 gen 232012 top level 256 path boot/grub2/x86_64-efi
ID 265 gen 232012 top level 256 path boot/grub2/i386-pc
ID 309 gen 108176 top level 257 path var/lib/machines
ID 652 gen 232355 top level 256 path .snapshots
ID 653 gen 232022 top level 652 path .snapshots/1/snapshot
ID 654 gen 232023 top level 652 path .snapshots/2/snapshot
ID 655 gen 232024 top level 652 path .snapshots/3/snapshot
ID 656 gen 232065 top level 652 path .snapshots/4/snapshot
ID 657 gen 232066 top level 652 path .snapshots/5/snapshot
ID 658 gen 232134 top level 652 path .snapshots/6/snapshot
ID 659 gen 232135 top level 652 path .snapshots/7/snapshot
ID 660 gen 232136 top level 652 path .snapshots/8/snapshot
ID 661 gen 232137 top level 652 path .snapshots/9/snapshot
ID 662 gen 232141 top level 652 path .snapshots/10/snapshot
ID 663 gen 232354 top level 652 path .snapshots/11/snapshot
ID 664 gen 232367 top level 263 path home/.snapshots
alastair@HP-Z640-1:~> 
2 Likes

You should be able to take a snapshot of /home now to test.

Hi and many thanks. I shall keep reading but two questions come to mind:-

I assume snapshots are created at each re-boot but do they get created if I just log out and log back in, which is an action often required after any update?

If I am working on sorting out files and directories in my ~/ directories is there a quick means of taking a snapshot so that I can re-wind if I make a mistake, a not infrequent occurrence these days!

Only if they are configured to do so. Check your snapper configuration to see what they are currently set for.

No

If you are OK with a snapshot of the entirety of /home:

sudo snapper -c home create

Snapper does not offer any means to do it. You would need to create your own script and boot service.

There is pam_snapper which does exactly that (and according to documentation, it can also create periodical snapshots of user’s home directory if user remains logged in). It is described in standard openSUSE documentation. It expects that user’s home directory is in separate subvolume (which is obvious as snapper configuration is per subvolume).

1 Like

snapper includes snapper-boot.timer and an associated service. Enabling that should take snapshots at each boot.

Thanks. Apparently it is rarely used and not widely known (at least I do not remember any single case of anyone using it in several years).

1 Like

Hi and thanks. I think I prefer this to including the script in my snapper config file but this is my first day looking into snapper and need to think through what I need once I have some experience with this. Adding the snapper-boot.timer service is certainly easier to stop and start than editing config file.

One follow up on this, if I use

sudo systemctl enable snapper-boot.timer

and

sudo systemctl start snapper-boot.timer

and if I have configurations set up for both /home and / I assume snapshots will be created for both and any other snapshot configurations I have created. Is that correct?

If so it would be sensible for me to target specific subdirectories rather that all of my /home directory.

I would also appreciate how all this works with pCloud and nfs links which appear on my home directory. I could end up with a problem given the number of subdirectories and files if all are included. I have been looking at similar issues with rsync.

Any further help/advice/further reading would be appreciated.
Thanks again,
Alastair.

Probably because of the way OpenSUSE and Snapper are pre-integrated out of the box.

I maintain a GUI for btrfs that also has support for managing Snapper that is more commonly used with other distros and I see people using it.

It should. One easy way to know is to enable it and reboot. :slight_smile:

Btrfs snapshots will only include the btrfs subvolume. No links or otherwise nested data will be included.

Hi and many thanks once more. That no links or otherwise nested data will be included is good to know and makes life simpler.
I shall play around with the script I have included in my config as I had done so before your info on the systemctl option. Once I have understood I shall try your suggestion and report on my experiences, no doubt with more question.
Time to take dogs for a walk!
Thanks again,
Alastair

1 Like

No. snapper-boot.service only creates snapshots for root snapper config.