Creating a restore point before updating like silverblue in fedora workstation

Hi @dalto

Do I need to create a config file ? and also how to I run a snapshot to test it works

Total                                           1.8 MB/s |  96 MB     00:53     
Delta RPMs reduced 99.5 MB of updates to 96.0 MB (3.5% saved)
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
snapper: creating pre_snapshot failed: error.io_error: .snapshots is not a btrfs subvolume
Running transaction

I get that output still where it says the snapshots error

Those commands had you create snapshots. You made the snapshots manually at that point. They are named preupgrade.

If you want to use snapper, you need to do a few things.

  • Delete the .snapshots directories you created.(This is why you are getting the error)
  • Create a config for / with the command sudo snapper create-config /
  • Optionally, if you also want snapshots for home you can create a config for that as well sudo snapper -c home create-config /home
  • Test snapper to see if it is working sudo snapper create and for home sudo snapper -c home create
  • If it worked, sudo snapper list will show the snapshot

As a side note, it has been a while since I set it up but I think I had to make an selinux change along the way somewhere.

1 Like

Great thanks a lot, well the snapper way seems a bit confusing I like your btrfs method better, the only thing is I would just like to have some really simple instructions on how to wind back to a snapshot…for example the pre-upgrade snapshot.

I got this output, so does this mean it will backup now automatically?

Also is this backing up the home directory and the boot system>?

[root@localhost benji]# sudo snapper create-config /
Creating config failed (subvolume already covered).
[root@localhost benji]# sudo snapper -c home create-config /home
[root@localhost benji]# sudo snapper create
IO Error (open failed path://.snapshots errno:2 (No such file or directory)).
[root@localhost benji]# sudo snapper -c home create
[root@localhost benji]# sudo snapper list
IO Error (open failed path://.snapshots errno:2 (No such file or directory)).
[root@localhost benji]# sudo snapper -c home create
[root@localhost benji]# sudo snapper -c home create-config /home
Creating config failed (subvolume already covered).
[root@localhost benji]# sudo snapper list
 # | Type   | Pre # | Date | User | Cleanup | Description | Userdata
---+--------+-------+------+------+---------+-------------+---------
0  | single |       |      | root |         | current     |         
[root@localhost benji]# 

It looks to me like your /home snapshots are working but you can tell for sure by running:

sudo snapper -c home list

You root snapshots are failing though. If they were working, the list command would show more than the current snapshot. Try running these commands in order:

sudo btrfs subvolume create /.snapshots
sudo snapper create
sudo snapper list

Do you mean automatically as in on a regular basis or automatically as in before an update? If you want the former, you need to enable the timeline timer with sudo systemctl enable --now snapper-timeline.timer. If you are looking for the latter, you need to configure that separately but I think you have already done that so you could just test that again once you fix the above.

Once the above is fixed, you should have created manual snapshots of both. Basically the way snapper works is that it by default it uses the root config. So you when you run snapper create it takes a snapshot of your root. If you want to work on any of other subvolume, you need to tell it to that with the -c option. For example, sudo snapper -c home list tells snapper to list all the snapshots for the config named ā€œhomeā€.

Hi @dalto

thanks again for promptly writing back

I ran the commands you mentioned and it appears the ā€œsnapshotsā€ directory is still present

[benji@localhost Calyx OS flasher]$ sudo snapper -c home list
[sudo] password for benji: 
 # | Type   | Pre # | Date                             | User | Cleanup | Description | Userdata
---+--------+-------+----------------------------------+------+---------+-------------+---------
0  | single |       |                                  | root |         | current     |         
1  | single |       | Sat 24 Jul 2021 05:31:19 PM AEST | root |         |             |         
2  | single |       | Sat 24 Jul 2021 05:32:51 PM AEST | root |         |             |         
[benji@localhost Calyx OS flasher]$ sudo btrfs subvolume create /.snapshots
ERROR: target path already exists: /.snapshots
[benji@localhost Calyx OS flasher]$ sudo snapper create
IO Error (.snapshots is not a btrfs subvolume).
[benji@localhost Calyx OS flasher]$ sudo snapper list
 # | Type   | Pre # | Date | User | Cleanup | Description | Userdata
---+--------+-------+------+------+---------+-------------+---------
0  | single |       |      | root |         | current     |         
[benji@localhost Calyx OS flasher]$ 

Can I see the output of sudo btrfs subvolume list / as it exists now?

Also, the output of ls -l /.snapshots

Hi there,

sure the output is below

[benji@localhost ~]$ sudo btrfs subvolume list /
[sudo] password for benji: 
ID 256 gen 722550 top level 5 path home
ID 257 gen 722544 top level 5 path root
ID 514 gen 722478 top level 257 path var/lib/machines
ID 515 gen 717631 top level 257 path .snaps
ID 516 gen 696290 top level 256 path home/.snaps
ID 517 gen 696289 top level 515 path .snaps/preupgrade
ID 518 gen 696291 top level 516 path home/.snaps/preupgrade
ID 519 gen 717619 top level 515 path .snaps/preupgrade2
ID 520 gen 720542 top level 256 path home/.snapshots
ID 521 gen 717648 top level 520 path home/.snapshots/1/snapshot
ID 522 gen 717655 top level 520 path home/.snapshots/2/snapshot
[benji@localhost ~]$ ls -l /.snapshots
total 0
[benji@localhost ~]$

I tried to wipe the directory you mentioned to delete but it wont get cleared. I also went into the folder in the file explorer as root into the file system and it still wont delete.

Sorry If I messed it up

It is good, I just wanted to double check everything before we took a potentially destructive action :slight_smile:

Try this:

sudo rmdir /.snapshots
sudo btrfs subvolume create /.snapshots
sudo snapper create
sudo snapper list
1 Like

Okay great. Sure no sweat,

See below

[benji@localhost ~]$ sudo rmdir /.snapshots
[sudo] password for benji: 
[benji@localhost ~]$ sudo btrfs subvolume create /.snapshots
Create subvolume '//.snapshots'
[benji@localhost ~]$ sudo snapper create
[benji@localhost ~]$ sudo snapper list
 # | Type   | Pre # | Date                             | User | Cleanup | Description | Userdata
---+--------+-------+----------------------------------+------+---------+-------------+---------
0  | single |       |                                  | root |         | current     |         
1  | single |       | Mon 26 Jul 2021 10:52:32 AM AEST | root |         |             |         
[benji@localhost ~]$ 

1 Like

Looks like you successfully took a snapshot with snapper.

Congrats!

2 Likes

Terrific thanks so much for your patience, sincerely appreciated the guidance

1 Like

HI there,

Just a thing I noticed is that the prompt that an automatic snapshot for snapper isnt showing up like it does when I do flatpak updated. I ran a system update and it didnt seem to show up.

Does that mean I should run a snapper update manually before doing a dnf update.? See below:

[benji@localhost ~]$ sudo dnf update
Last metadata expiration check: 3:48:15 ago on Tue 27 Jul 2021 08:07:07 AM AEST.
Dependencies resolved.

 Problem: cannot install the best update candidate for package cjs-1:4.8.2-1.fc33.x86_64
  - nothing provides mozjs78(x86-64) >= 78.12.0-1 needed by cjs-1:4.8.2-2.fc33.x86_64
================================================================================
 Package                     Arch       Version               Repository   Size
================================================================================
Upgrading:
 libsmbclient                x86_64     2:4.13.10-0.fc33      updates      74 k
 libwbclient                 x86_64     2:4.13.10-0.fc33      updates      46 k
 rpmdevtools                 noarch     9.5-1.fc33            updates      91 k
 samba-client                x86_64     2:4.13.10-0.fc33      updates     639 k
 samba-client-libs           x86_64     2:4.13.10-0.fc33      updates     5.3 M
 samba-common                noarch     2:4.13.10-0.fc33      updates     144 k
 samba-common-libs           x86_64     2:4.13.10-0.fc33      updates      99 k
 samba-libs                  x86_64     2:4.13.10-0.fc33      updates     120 k
Installing dependencies:
 koji                        noarch     1.25.1-1.fc33         updates     187 k
 python3-gssapi              x86_64     1.6.9-2.fc33          fedora      463 k
 python3-koji                noarch     1.25.1-1.fc33         updates     297 k
 python3-requests-gssapi     noarch     1.2.2-1.fc33          fedora       27 k
Installing weak dependencies:
 python3-rpmautospec         noarch     0.2.3-1.fc33          updates      36 k
Skipping packages with broken dependencies:
 cjs                         x86_64     1:4.8.2-2.fc33        updates     379 k

Transaction Summary
================================================================================
Install  5 Packages
Upgrade  8 Packages
Skip     1 Package

Total download size: 7.5 M
Is this ok [y/N]: y
Downloading Packages:
(1/13): libwbclient-4.13.9-0.fc33_4.13.10-0.fc3  45 kB/s |  18 kB     00:00    
(2/13): libsmbclient-4.13.9-0.fc33_4.13.10-0.fc  39 kB/s |  19 kB     00:00    
(3/13): rpmdevtools-9.3-3.fc33_9.5-1.fc33.noarc  91 kB/s |  44 kB     00:00    
(4/13): samba-common-libs-4.13.9-0.fc33_4.13.10  22 kB/s |  25 kB     00:01    
[DRPM 1/6] libwbclient-4.13.9-0.fc33_4.13.10-0.fc33.x86_64.drpm: done          
[DRPM 2/6] libsmbclient-4.13.9-0.fc33_4.13.10-0.fc33.x86_64.drpm: done         
[DRPM 3/6] rpmdevtools-9.3-3.fc33_9.5-1.fc33.noarch.drpm: done                 
(5/13): samba-libs-4.13.9-0.fc33_4.13.10-0.fc33  30 kB/s |  34 kB     00:01    
(6/13): python3-requests-gssapi-1.2.2-1.fc33.no  15 kB/s |  27 kB     00:01    
(7/13): python3-gssapi-1.6.9-2.fc33.x86_64.rpm  225 kB/s | 463 kB     00:02    
(8/13): samba-client-libs-4.13.9-0.fc33_4.13.10 111 kB/s | 555 kB     00:05    
[DRPM 4/6] samba-common-libs-4.13.9-0.fc33_4.13.10-0.fc33.x86_64.drpm: done    
[DRPM 5/6] samba-libs-4.13.9-0.fc33_4.13.10-0.fc33.x86_64.drpm: done           
(9/13): python3-rpmautospec-0.2.3-1.fc33.noarch  51 kB/s |  36 kB     00:00    
(10/13): python3-koji-1.25.1-1.fc33.noarch.rpm  101 kB/s | 297 kB     00:02    
(11/13): koji-1.25.1-1.fc33.noarch.rpm           55 kB/s | 187 kB     00:03    
(12/13): samba-common-4.13.10-0.fc33.noarch.rpm 453 kB/s | 144 kB     00:00    
(13/13): samba-client-4.13.10-0.fc33.x86_64.rpm 188 kB/s | 639 kB     00:03    
[DRPM 6/6] samba-client-libs-4.13.9-0.fc33_4.13.10-0.fc33.x86_64.drpm: done    
--------------------------------------------------------------------------------
Total                                           153 kB/s | 2.4 MB     00:16     
Delta RPMs reduced 7.5 MB of updates to 2.4 MB (67.7% saved)
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Running scriptlet: samba-common-2:4.13.10-0.fc33.noarch                  1/21 
  Upgrading        : samba-common-2:4.13.10-0.fc33.noarch                  1/21 
  Running scriptlet: samba-common-2:4.13.10-0.fc33.noarch                  1/21 
  Upgrading        : samba-common-libs-2:4.13.10-0.fc33.x86_64             2/21 
  Upgrading        : samba-client-libs-2:4.13.10-0.fc33.x86_64             3/21 
  Upgrading        : libwbclient-2:4.13.10-0.fc33.x86_64                   4/21 
  Upgrading        : samba-libs-2:4.13.10-0.fc33.x86_64                    5/21 
  Upgrading        : libsmbclient-2:4.13.10-0.fc33.x86_64                  6/21 
  Installing       : python3-gssapi-1.6.9-2.fc33.x86_64                    7/21 
  Installing       : python3-requests-gssapi-1.2.2-1.fc33.noarch           8/21 
  Installing       : python3-koji-1.25.1-1.fc33.noarch                     9/21 
  Installing       : koji-1.25.1-1.fc33.noarch                            10/21 
  Installing       : python3-rpmautospec-0.2.3-1.fc33.noarch              11/21 
  Upgrading        : rpmdevtools-9.5-1.fc33.noarch                        12/21 
  Upgrading        : samba-client-2:4.13.10-0.fc33.x86_64                 13/21 
  Running scriptlet: samba-client-2:4.13.10-0.fc33.x86_64                 13/21 
  Cleanup          : rpmdevtools-9.3-3.fc33.noarch                        14/21 
  Running scriptlet: samba-client-2:4.13.9-0.fc33.x86_64                  15/21 
  Cleanup          : samba-client-2:4.13.9-0.fc33.x86_64                  15/21 
  Running scriptlet: samba-client-2:4.13.9-0.fc33.x86_64                  15/21 
  Cleanup          : libsmbclient-2:4.13.9-0.fc33.x86_64                  16/21 
  Cleanup          : samba-libs-2:4.13.9-0.fc33.x86_64                    17/21 
  Cleanup          : samba-client-libs-2:4.13.9-0.fc33.x86_64             18/21 
  Cleanup          : samba-common-libs-2:4.13.9-0.fc33.x86_64             19/21 
  Running scriptlet: libwbclient-2:4.13.9-0.fc33.x86_64                   20/21 
  Cleanup          : libwbclient-2:4.13.9-0.fc33.x86_64                   20/21 
  Cleanup          : samba-common-2:4.13.9-0.fc33.noarch                  21/21 
  Running scriptlet: libwbclient-2:4.13.10-0.fc33.x86_64                  21/21 
  Running scriptlet: samba-common-2:4.13.9-0.fc33.noarch                  21/21 
  Verifying        : python3-gssapi-1.6.9-2.fc33.x86_64                    1/21 
  Verifying        : python3-requests-gssapi-1.2.2-1.fc33.noarch           2/21 
  Verifying        : koji-1.25.1-1.fc33.noarch                             3/21 
  Verifying        : python3-koji-1.25.1-1.fc33.noarch                     4/21 
  Verifying        : python3-rpmautospec-0.2.3-1.fc33.noarch               5/21 
  Verifying        : libsmbclient-2:4.13.10-0.fc33.x86_64                  6/21 
  Verifying        : libsmbclient-2:4.13.9-0.fc33.x86_64                   7/21 
  Verifying        : libwbclient-2:4.13.10-0.fc33.x86_64                   8/21 
  Verifying        : libwbclient-2:4.13.9-0.fc33.x86_64                    9/21 
  Verifying        : rpmdevtools-9.5-1.fc33.noarch                        10/21 
  Verifying        : rpmdevtools-9.3-3.fc33.noarch                        11/21 
  Verifying        : samba-client-2:4.13.10-0.fc33.x86_64                 12/21 
  Verifying        : samba-client-2:4.13.9-0.fc33.x86_64                  13/21 
  Verifying        : samba-client-libs-2:4.13.10-0.fc33.x86_64            14/21 
  Verifying        : samba-client-libs-2:4.13.9-0.fc33.x86_64             15/21 
  Verifying        : samba-common-2:4.13.10-0.fc33.noarch                 16/21 
  Verifying        : samba-common-2:4.13.9-0.fc33.noarch                  17/21 
  Verifying        : samba-common-libs-2:4.13.10-0.fc33.x86_64            18/21 
  Verifying        : samba-common-libs-2:4.13.9-0.fc33.x86_64             19/21 
  Verifying        : samba-libs-2:4.13.10-0.fc33.x86_64                   20/21 
  Verifying        : samba-libs-2:4.13.9-0.fc33.x86_64                    21/21 

Upgraded:
  libsmbclient-2:4.13.10-0.fc33.x86_64                                          
  libwbclient-2:4.13.10-0.fc33.x86_64                                           
  rpmdevtools-9.5-1.fc33.noarch                                                 
  samba-client-2:4.13.10-0.fc33.x86_64                                          
  samba-client-libs-2:4.13.10-0.fc33.x86_64                                     
  samba-common-2:4.13.10-0.fc33.noarch                                          
  samba-common-libs-2:4.13.10-0.fc33.x86_64                                     
  samba-libs-2:4.13.10-0.fc33.x86_64                                            
Installed:
  koji-1.25.1-1.fc33.noarch                                                     
  python3-gssapi-1.6.9-2.fc33.x86_64                                            
  python3-koji-1.25.1-1.fc33.noarch                                             
  python3-requests-gssapi-1.2.2-1.fc33.noarch                                   
  python3-rpmautospec-0.2.3-1.fc33.noarch                                       
Skipped:
  cjs-1:4.8.2-2.fc33.x86_64                                                     

Complete!
[benji@localhost ~]$

Did you do sudo snapper list to see if it took a snapshot?

1 Like

So I got this output:

[benji@localhost ~]$ sudo snapper list
[sudo] password for benji: 
 # | Type   | Pre # | Date                             | User | Cleanup | Description                                                                                                                      | Userdata
---+--------+-------+----------------------------------+------+---------+----------------------------------------------------------------------------------------------------------------------------------+---------
0  | single |       |                                  | root |         | current                                                                                                                          |         
1  | single |       | Mon 26 Jul 2021 10:52:32 AM AEST | root |         |                                                                                                                                  |         
2  | pre    |       | Mon 26 Jul 2021 10:59:30 AM AEST | root | number  | /usr/bin/dnf update                                                                                                              |         
3  | post   |     2 | Mon 26 Jul 2021 10:59:35 AM AEST | root | number  | /usr/bin/dnf update                                                                                                              |         
4  | pre    |       | Mon 26 Jul 2021 01:28:02 PM AEST | root | number  | /bin/dnf -y install --disablerepo=* /tmp/akmods.HE7lGHPO/results/kmod-VirtualBox-5.13.4-100.fc33.x86_64-6.1.22-1.fc33.x86_64.rpm |         
5  | post   |     4 | Mon 26 Jul 2021 01:28:10 PM AEST | root | number  | /bin/dnf -y install --disablerepo=* /tmp/akmods.HE7lGHPO/results/kmod-VirtualBox-5.13.4-100.fc33.x86_64-6.1.22-1.fc33.x86_64.rpm |         
6  | pre    |       | Tue 27 Jul 2021 11:55:45 AM AEST | root | number  | /usr/bin/dnf update                                                                                                              |         
7  | post   |     6 | Tue 27 Jul 2021 11:55:50 AM AEST | root | number  | /usr/bin/dnf update                                                                                                              |         
[benji@localhost ~]$ 

I wish I knew what this means,

My update history says this:

[benji@localhost ~]$ sudo dnf history
ID     | Command line                                    | Date and time    | Action(s)      | Altered
------------------------------------------------------------------------------------------------------
   132 | update                                          | 2021-07-27 11:55 | I, U           |   13   
   131 | -y install --disablerepo=* /tmp/akmods.HE7lGHPO | 2021-07-26 13:28 | Install        |    1   
   130 |                                                 | 2021-07-26 13:27 | Install        |    5   
   129 | update                                          | 2021-07-26 10:59 | Upgrade        |    8   
   128 | update                                          | 2021-07-24 17:43 | Upgrade        |    9 EE
   127 | install timeshift                               | 2021-07-24 17:16 | Install        |    1   
   126 | remove timeshift 

Looks like it is working. It seems to be taking snapshots immediately before and after your updates.

Using these two lines as an example. It means you have a pre-update(#2) snapshot taken before executing /usr/bin/dnf update. Then you have a post-update snapshot taken after that same command.

Comparing the snapshots to the history. You got snapshots for operation 129, 131 and 132 but not 130. I am not sure what was without seeing the detail around the history for that item.

1 Like

Thanks very much again. I am just looking over the literature here :

https://wiki.archlinux.org/title/Snapper

and I cannot seem to see a clear way to rollback, in case of an error

There are actually a lot of ways you can do this, one way is to use snapshots, like this:

First, mount the true root of your filesystem on /mnt/btrfs

sudo mkdir -p /mnt/btrfs-root
sudo mount <btrfs-device> /mnt/btrfs-root

Replace with the device your btrfs filesystem is on.

Next, make a snapshot of the current broken root just in case, you can delete it later if you determine you need it.

sudo btrfs subvolume snapshot -r /mnt/btrfs-root/root /mnt/btrfs-root/broken-root

Next we can delete it and replace it with a snapshot. For this example, lets say you wanted to restore snapshot 5.

sudo btrfs subvolume delete /mnt/btrfs-root/root
sudo btrfs subvolume snapshot /mnt/btrfs-root/.snapshots/5/snapshot /mnt/btrfs-root/root

It is worth noting that if you do it this way, you probably need to boot off of something else. Either a live usb or a different btrfs subvolume.

Alternatively, there is btrfs-grub but I am not familiar with how that works.

1 Like

terrific thanks so much.

Okay now I am ready to upgrade to Fedora 34, or perhaps wait for fedora 35 as its already running in beta it may be released sooner than later.

I’m curious about the KDE spin, it looks quite complicated.