Using snapper to snapshoot and restore a system

I’m sure he knows just looking at it. I don’t see the /snapshots if i run lsblk -l? On the last one you just posted is from following the tutorial but it’s a complete install of Arch so i’m doing it as i go. The other is trying to add snapper kind of after and i don’t know the correct steps obviously.

These two seems off to me. I am not sure if you need an extra @snapshots for snapper. Snapper makes a hidden folder .snaphots under /

The tutorial i used the first time does make a subvolume for snapshots. Like i say I’m confused because i don’t understand it completely. Not confused really but just don’t know the way it’s done exactly and why and what it means. :confounded:

Edit: See here the tutorial shows this.

[ricklinux@archsnap ~]$ lsblk -l
NAME      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda         8:0    0 465.8G  0 disk 
sda1        8:1    0   512M  0 part /boot
sda2        8:2    0    32G  0 part [SWAP]
sda3        8:3    0 433.3G  0 part /var
                                    /home
                                    /.snapshots
                                    /

Edit2: Of course i don’t know if this is correct either but it seems better than my try in the vm.

That is more in line with what I think it should look like “the standard way”. But surely there are alternative ways to set it up.How I have understood is that snapper defaults to /.snapshots as the sobvolume in which it stores the snapshots.

On the other on it doesn’t show where /snapshots is using lsblk -l.

Edit: I Did install the snapper GUI tool also. But of course on KDE it’s like Timeshift where you can’t browse properties to see the config file. But on Xfce it does so it’s useful or useless depending on how you look at it.

I don’t know what the issue might be.

Yes, I saw it being mentioned on ArchWiki but I haven’t look into it further. By the way Rick, would you mind posting the link for the tutorial you have followed?

(How to install Arch Linux with BTRFS & Snapper - YouTube)

1 Like

Thanks! I’ll have a look. Tomorrow. It is way past midnight here now and I am running out of steam. I should be hitting the bed soon.

1 Like

Snapper automatically creates everything it needs to hold the snapshots. You shouldn’t need those @snapshots subvolumes and you don’t need to create anything special for it.

lsblk shows block devices. btrfs subvolumes aren’t block devices so they shouldn’t show there.

You can use btrfs subvolume list / to see subvolumes/snapshots. What lsblk will show you is all the mountpoints tied to a block device so if you mount the subvolumes lsblk will list the mountpoints.

Do you have a subvolume mounted on /var? That will make it harder to recover if you ever need to rollback a snapshot. You probably don’t want that on Arch-based system.

I think i created it in the tutorial because he removes it first and then recreates it. Something to do with doing it before or after is more tedious in fstab? I don’t really know . I just installed Arch and followed the tutorial.

So If i install EOS and use Btrfs file system it automatically creates the subvolumes. But not /snapshots. I don’t need to? So if i do an install of EOS. What is the proper way to set up snapper? I have to install snapper, grub-btrfs packages and? I’m just not sure what steps to do all the way through to make it right.

No, snapper creates all the subvolumes it needs automatically.

  • Install snapper
  • Set the default settings in the config to match you preferences
  • Enable snapper-timeline.timer, snapper-cleanup.timer and optionally snapper-boot.timer.
  • Create configs for snapper, like this:
    sudo snapper create-config /
    sudo snapper -c home create-config /home
    

I have never used grub-btrfs but if you want that you would also need to install and configure it.

I did try to enable snapper-boot.timer on that tutorial which he doesn’t mention but for some reason it didn’t want to.

Edit I will try another install in vm and see how i make out. So do you only need the config / and config /home?

You can add whichever you want but in an EOS install where it creates 4 subvolumes, the other 2 are /var/log and /var/cache. Personally, I wouldn’t bother creating snapshots of either of those.

Okay I understand that. Other subvolumes would be created for data or music or something? Also when you say set the default settings in the config to match your prferences you mean the conf file for when to take snapshots?

I mean /etc/snapper/config-templates/default

That file is used as a template whenever you create a new config.

I’ve set it up but it doesn’t show anything saved as a snapshot?

[ricklinux@eos-snapper ~]$ systemctl status snapper-timeline.timer
● snapper-timeline.timer - Timeline of Snapper Snapshots
     Loaded: loaded (/usr/lib/systemd/system/snapper-timeline.timer; enabled; vendor preset: disabl>
     Active: active (waiting) since Sun 2021-08-15 23:02:47 EDT; 49s ago
    Trigger: Mon 2021-08-16 00:00:00 EDT; 56min left
   Triggers: ● snapper-timeline.service
       Docs: man:snapper(8)
             man:snapper-configs(5)

Aug 15 23:02:47 eos-snapper systemd[1]: Started Timeline of Snapper Snapshots.
[ricklinux@eos-snapper ~]$ systemctl status snapper-cleanup.timer
● snapper-cleanup.timer - Daily Cleanup of Snapper Snapshots
     Loaded: loaded (/usr/lib/systemd/system/snapper-cleanup.timer; enabled; vendor preset: disable>
     Active: active (waiting) since Sun 2021-08-15 23:02:47 EDT; 1min 5s ago
    Trigger: Sun 2021-08-15 23:12:47 EDT; 8min left
   Triggers: ● snapper-cleanup.service
       Docs: man:snapper(8)
             man:snapper-configs(5)

Aug 15 23:02:47 eos-snapper systemd[1]: Started Daily Cleanup of Snapper Snapshots.
[ricklinux@eos-snapper ~]$ systemctl status snapper-boot.timer
● snapper-boot.timer - Take snapper snapshot of root on boot
     Loaded: loaded (/usr/lib/systemd/system/snapper-boot.timer; enabled; vendor preset: disabled)
     Active: active (elapsed) since Sun 2021-08-15 23:02:47 EDT; 1min 18s ago
    Trigger: n/a
   Triggers: ● snapper-boot.service

Aug 15 23:02:47 eos-snapper systemd[1]: Started Take snapper snapshot of root on boot.
[ricklinux@eos-snapper ~]$ 

So why am i getting these? Are they correct. I don’t see for root? Are the bottom two root? I see @home

[ricklinux@eos-snapper ~]$ sudo btrfs subvolume list /
[sudo] password for ricklinux: 
ID 257 gen 94 top level 5 path @
ID 258 gen 93 top level 5 path @home
ID 259 gen 83 top level 5 path @cache
ID 260 gen 94 top level 5 path @log
ID 261 gen 30 top level 5 path @swap
ID 264 gen 28 top level 257 path var/lib/portables
ID 265 gen 29 top level 257 path var/lib/machines
ID 271 gen 83 top level 257 path .snapshots
ID 272 gen 66 top level 258 path @home/.snapshots
ID 273 gen 62 top level 271 path .snapshots/1/snapshot
ID 274 gen 66 top level 272 path @home/.snapshots/1/snapshot
ID 275 gen 71 top level 271 path .snapshots/2/snapshot
ID 276 gen 82 top level 271 path .snapshots/3/snapshot
[ricklinux@eos-snapper ~]$ 
[ricklinux@eos-snapper ~]$ 
[ricklinux@eos-snapper ~]$ sudo snapper list
 # | Type   | Pre # | Date                        | User | Cleanup | Description | Userdata
---+--------+-------+-----------------------------+------+---------+-------------+---------
0  | single |       |                             | root |         | current     |         
1  | single |       | Sun 15 Aug 2021 10:59:24 PM | root | number  | boot        |         
2  | single |       | Sun 15 Aug 2021 11:00:27 PM | root | number  | boot        |         
3  | single |       | Sun 15 Aug 2021 11:02:47 PM | root | number  | boot        |         
[ricklinux@eos-snapper ~]$ 

Nothing shows up in the GUI and it say’s i don’t have permissions to change configs. Is that the same thing where Thunar doesn’t have root?

Screenshot_2021-08-15_23-12-47

Nothing is showing in the gui.

Edit: I’m pretty sure you need the grub-btrfs installed? Don’t you?

[ricklinux@eos-snapper ~]$ sudo grub-mkconfig -o /bopot/grub/grub.cfg
[sudo] password for ricklinux: 
/usr/bin/grub-mkconfig: line 261: /bopot/grub/grub.cfg.new: No such file or directory
[ricklinux@eos-snapper ~]$ sudo grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found theme: /boot/grub/themes/EndeavourOS/theme.txt
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/amd-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot:  amd-ucode.img initramfs-linux-fallback.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
[ricklinux@eos-snapper ~]$ 

I installed grub-btrfs because it is not installed in the packages in EOS.

[ricklinux@eos-snapper ~]$ sudo grub-mkconfig -o /boot/grub/grub.cfg
[sudo] password for ricklinux: 
Generating grub configuration file ...
Found theme: /boot/grub/themes/EndeavourOS/theme.txt
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/amd-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot:  amd-ucode.img initramfs-linux-fallback.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
Detecting snapshots ...
Info: Separate boot partition not detected 
Info: snapper detected, using config 'root'
Found snapshot: 2021-08-15 23:02:47 | @/.snapshots/3/snapshot | single | boot
Found snapshot: 2021-08-15 23:00:27 | @/.snapshots/2/snapshot | single | boot
Found snapshot: 2021-08-15 22:59:24 | @/.snapshots/1/snapshot | single | boot
Found 3 snapshot(s)
done
[ricklinux@eos-snapper ~]$ 

Edit: The only thing i don’t understand is why nothing is showing in the gui window?

@dalto
It’s working correctly on the Arch install i did. But it has that other /.snapshots

[ricklinux@archsnap ~]$ lsblk -l
NAME      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda         8:0    0 465.8G  0 disk 
sda1        8:1    0   512M  0 part /boot
sda2        8:2    0    32G  0 part [SWAP]
sda3        8:3    0 433.3G  0 part /var
                                    /home
                                    /.snapshots
                                    /

The GUI works and i also added home.

Screenshot_20210816_000154

Edit: I just don’t have enough understanding. I just followed the tutorial and this where i am. I’m just trying to replicate it on EOS.

Edit2:
@dalto
Thanks for your help. I’m getting more understanding as i go. Even if i have to install it 100X. Eventually I’ll be able to say and that’s how it’s done! :rofl:

1 Like

btrfs subvolume list / shows these for snapshots made on this system

ID 362 gen 50621 top level 344 path .snapshots
ID 363 gen 50589 top level 362 path .snapshots/1/snapshot
ID 365 gen 51251 top level 345 path @arch-budgie-home/.snapshots
ID 366 gen 51103 top level 365 path @arch-budgie-home/.snapshots/1/snapshot

But whenever I run snapper list it says:

The config 'root' does not exist. Likely snapper is not configured.
See 'man snapper' for further instructions.

But then

sudo snapper  list -a

Config: arch-budgie-home, subvolume: /home
 # | Type   | Pre # | Date                     | User | Cleanup | Description    | Userdata
---+--------+-------+--------------------------+------+---------+----------------+---------
0  | single |       |                          | root |         | current        |         
1  | single |       | Sun Aug 15 01:57:37 2021 | root |         | first_snapshot |         

Config: arch-budgie-root, subvolume: /
 # | Type   | Pre # | Date                     | User | Cleanup | Description    | Userdata
---+--------+-------+--------------------------+------+---------+----------------+---------
0  | single |       |                          | root |         | current        |         
1  | single |       | Sat Aug 14 21:25:11 2021 | root |         | first_snapshot |
snapper list-configs
Config           | Subvolume
-----------------+----------
arch-budgie-home | /home    
arch-budgie-root | /

Don’t understand why snapper list complains about a non-existent config ‘root’. Running with sudo make no difference. I skimmed a bit through man snapper but I am not seeing anything related to this. Have I missed something in configuring snapper?

When you omit the -c in the beginning of the command, snapper defaults to look for a config named root. So sudo snapper list is shorthand for sudo snapper -c root list.

However, you don’t have a config named “root”.

If you want to the see the root you should do:

sudo snapper -c arch-budgie-root list

That is showing in lsblk because you have it mounted in that install.

Yes, that is all correct and the bottom 2 are root

No idea. That gui isn’t part of snapper. It is a 3rd party tool

You only need grub-btrfs installed if you want to be able to boot into snapshots.

1 Like