2

I have btrfs filesystem on my Debian Bullseye box and I have set btrfs to make snapshots of my system. Recently I changed something that broke my cinnamon desktop and I want to recover from last known working snapshot.

Some background:

$ sudo snapper --version
snapper 0.8.14
flags btrfs,lvm,no-ext4,xattrs,rollback,btrfs-quota,no-selinux
$ cat /etc/fstab 
UUID="12345678-1337-c0d3-1111-deadbeef0abc"     /boot       btrfs   rw,noatime,nodiratime,subvol=@boot_debian               02
UUID="12345678-1337-c0d3-1111-deadbeef1abc"     /           btrfs   rw,noatime,nodiratime,subvol=@root_debian           01
UUID="12345678-1337-c0d3-1111-deadbeef1abc"     /.snapshots btrfs   rw,noatime,nodiratime,subvol=@root_debian/.snapshots    0       1
$ sudo btrfs subvolume list /
ID 256 gen 6 top level 5 path @
ID 257 gen 59305 top level 5 path @root_debian
ID 258 gen 8 top level 5 path @root_kali
ID 362 gen 59301 top level 257 path .snapshots
ID 363 gen 53701 top level 362 path .snapshots/1/snapshot
ID 365 gen 53800 top level 362 path .snapshots/2/snapshot
ID 380 gen 54783 top level 362 path .snapshots/13/snapshot
ID 382 gen 54810 top level 362 path .snapshots/14/snapshot
[...]
ID 465 gen 59247 top level 362 path .snapshots/84/snapshot
ID 466 gen 59301 top level 362 path .snapshots/85/snapshot
$ sudo snapper list
  # | Type   | Pre # | Date                            | User | Cleanup  | Description            | Userdata     
----+--------+-------+---------------------------------+------+----------+------------------------+--------------
 0  | single |       |                                 | root |          | current                |              
 1  | single |       | Sat 19 Dec 2020 02:16:27 PM CET | root |          | Fingerprint working.   |              
 2  | single |       | Sat 19 Dec 2020 03:00:04 PM CET | root | timeline | timeline               |              
13  | single |       | Sun 20 Dec 2020 10:16:35 AM CET | root | timeline | timeline               |              
14  | pre    |       | Sun 20 Dec 2020 10:23:36 AM CET | root | number   | apt                    |              
15  | post   |    14 | Sun 20 Dec 2020 10:23:56 AM CET | root | number   | apt                    |              
16  | pre    |       | Sun 20 Dec 2020 10:58:37 AM CET | root | number   | apt                    |              
17  | post   |    16 | Sun 20 Dec 2020 10:58:57 AM CET | root | number   | apt                    |              
[...]
57  | pre    |       | Tue 22 Dec 2020 08:29:33 PM CET | root | number   | apt                    |              
58  | post   |    57 | Tue 22 Dec 2020 08:29:37 PM CET | root | number   | apt                    |              
59  | single |       | Wed 23 Dec 2020 04:54:59 PM CET | root | timeline | timeline               |              
60  | single |       | Wed 23 Dec 2020 05:00:00 PM CET | root | timeline | timeline               |              
61  | pre    |       | Wed 23 Dec 2020 05:01:06 PM CET | root | number   | apt                    |              
62  | post   |    61 | Wed 23 Dec 2020 05:02:48 PM CET | root | number   | apt                    |              
63  | single |       | Wed 23 Dec 2020 05:18:54 PM CET | root | number   | boot                   |              
64  | pre    |       | Wed 23 Dec 2020 05:24:14 PM CET | root | number   | apt                    |              
65  | post   |    64 | Wed 23 Dec 2020 05:24:20 PM CET | root | number   | apt                    |              
66  | pre    |       | Wed 23 Dec 2020 05:24:26 PM CET | root | number   | apt                    |              
67  | post   |    66 | Wed 23 Dec 2020 05:24:29 PM CET | root | number   | apt                    |              
68  | single |       | Wed 23 Dec 2020 05:28:00 PM CET | root | number   | boot                   |              
69  | single |       | Wed 23 Dec 2020 05:47:26 PM CET | root | number   | boot                   |              
70  | single |       | Wed 23 Dec 2020 06:00:02 PM CET | root | timeline | timeline               |              
71  | pre    |       | Wed 23 Dec 2020 06:05:08 PM CET | root | number   | apt                    |              
72  | post   |    71 | Wed 23 Dec 2020 06:05:14 PM CET | root | number   | apt                    |              
73  | pre    |       | Wed 23 Dec 2020 06:26:24 PM CET | root | number   | apt                    |              
74  | post   |    73 | Wed 23 Dec 2020 06:26:28 PM CET | root | number   | apt                    |              
75  | single |       | Wed 23 Dec 2020 06:59:10 PM CET | root | number   | boot                   |              
76  | single |       | Wed 23 Dec 2020 07:01:38 PM CET | root | number   | boot                   |              
77  | single |       | Wed 23 Dec 2020 07:26:49 PM CET | root | number   | boot                   |              
81  | single |       | Wed 23 Dec 2020 07:30:08 PM CET | root |          | writable copy of #58   |              
82  | single |       | Wed 23 Dec 2020 07:39:01 PM CET | root | number   | rollback backup of #57 | important=yes
83+ | single |       | Wed 23 Dec 2020 07:39:01 PM CET | root |          | writable copy of #57   |              
84  | single |       | Wed 23 Dec 2020 07:41:19 PM CET | root | number   | boot                   |              
85  | single |       | Wed 23 Dec 2020 08:00:11 PM CET | root | timeline | timeline               |

My grub entry boots with rootflags=subvol=@root_debian by default. I want to replace @root_debian with snapshot 58. How do I do that? Thx!

1
  • I've tried: $ sudo snapper rollback 83 Ambit is classic. Creating read-only snapshot of current system. (Snapshot 86.) Creating read-write snapshot of snapshot 83. (Snapshot 87.) Setting default subvolume to snapshot 87. But it still boots to cripled system.
    – AreYouLoco
    Dec 23, 2020 at 19:07

1 Answer 1

0

You might want to boot into a live CD. From there, you can manipulate your btrfs subvolumes to replace @root_debian by your target snapshot:

# mount <yourDefaultBtrfsSubVolume> /mnt
# btrfs subvol snapshot /mnt/@root_debian/.snapshots/58/snapshot /mnt/@root_debian

See https://www.linuxsecrets.com/archlinux-wiki/wiki.archlinux.org/index.php/Snapper.html#Restoring_.2F_to_a_previous_snapshot_of_.40

Also, if you went for:

$ sudo snapper rollback 83

as you stated in your comment, you might simply need to refresh your grub installation as this suggests: https://wiki.archlinux.org/index.php/User:I2Oc9/Root_on_Btrfs_with_LUKS_full_disk_encryption#Rollback_root_filesystem

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .