This is a reference file for rolling back a snapshot the manual (Arch?) way. Check to see if your system has a Snapper-Rollback.py script installed. If so, use the script instead. If not, follow this guide. Directions for the python script can be found here.
My system uses the BTRFS subvolume layout suggested here.
Read the guide fully before you begin, as you will want to know what each command is doing. I am not liable for any damage done to your system. This is simply a command reference guide, so many commands will have to be modified to match the uniqueness of your system compared to mine.
- Bootable Arch Installer
- Snapshot Number to rollback to
If you are not sure which snapshot number is your most recent, I will include a command later in this guide to help you find it.
If you have an encrypted drive, this command will prompt for your passphrase and will decrypt the drive.
[root@host ~]# cryptsetup luksOpen /dev/nvme0n1p2 cryptdrive
[root@host ~]# mount -o subvolid=5 /dev/mapper/cryptdrive /mnt
In my case, the subvolume ID is
5. If it was not specified0is usually the default.
[root@host ~]# grep -r '<date>' /mnt/@snapshots/*/info.xml - Take note of the snapshot numbers found at the asterisk
[root@host ~]# mv /mnt/@ /mnt/@.broken
You can move this root to any temporary location you want. I chose this location (@.broken) for simplicity.
This new root directory will have read-write permissions while the snapshot is originally read-only.
[root@host ~]# btrfs subvolume snapshot /mnt/@snapshots/<number>/snapshot /mnt/@
Check your fstab file and bootloader that can be found here:
| File | Path |
|---|---|
| fstab | /mnt/@/etc/fstab |
| bootloader | /mnt/boot |
The subvolid can also be found by running the following command: btrfs subvolume list /mnt | grep @$
Remember: the default should be
subvolid=0. The bootloader can be checked a later point when the ESP is mounted here at that path.
[root@host ~]# umount /mnt
[root@host ~]# mount -o subvol=@ /dev/mapper/cryptdrive /mnt
[root@host ~]# mount -o subvol=@home /dev/mapper/cryptdrive /mnt/home
[root@host ~]# mount -o subvol=@var_pkgs /dev/mapper/cryptdrive /mnt/var/cache/pacman/pkg
[root@host ~]# mount -o subvol=@var_log /dev/mapper/cryptdrive /mnt/var/log
[root@host ~]# mount -o subvol=@srv /dev/mapper/cryptdrive /mnt/srv
[root@host ~]# mount -o subvol=@root /dev/mapper/cryptdrive /mnt/root
[root@host ~]# mount -o subvol=@snapshots /dev/mapper/cryptdrive /mnt/.snapshots
[root@host ~]# mount /dev/nvme0n1p1 /mnt/boot
[root@host ~]# arch-chroot /mnt
[root@host ~]# mkinitcpio -p linux
[root@host ~]# exit