If you mess up (or are going to mess up) some config files or drivers, it is always good to have a fallback point. The de-facto standard for doing this on Linux is
Timeshift.
Timeshift for Linux is an application that provides functionality similar to the System Restore feature in Windows and the Time Machine tool in Mac OS. Timeshift protects your system by taking incremental snapshots of the file system at regular intervals. These snapshots can be restored at a later date to undo all changes to the system.
Install
The package, timeshift, is available on all flavors of linux. Follow your distributions instructions to install a program.
For Debian/Ubuntu based systems:
$ sudo apt install timeshift
Create a Backup
While going through the initial setup, make sure to:
- Select RSYNC as the snapshot type
This will allow you to have your backups stored on a different drive/partition. BTRFS should be selected only if you are on a btrfs system and are making backups and snapshots in the same drive. - If you have multiple drives or a network share, you can choose the desired location for backups and snapshots.
- Enable backups for home directory
You can also set-up automatic backups as shown below:
Create a Snapshot
Before making a significant change to the system you can manually create a snapshot as a fallback in case you break something:
Restore
You can simply open Timeshift and click on the desired snapshot and restore it. The system will reboot during the restore process.
To restore a backup if the GUI doesn’t work or if you can’t boot:
- Boot into a Live Linux environment, say Ubuntu
- Install Timeshift in the Live Environment
- Open Timeshift, it should show snapshots that are in the main drive
- Select the desired snapshot and click on restore
- If needed, you can also restore the bootloader (GRUB2 Only)