Sometimes the system becomes corrupted after installing an application or driver. Whatever the cause, you will definitely want to get back to the state where your system worked perfectly. Restoring the system to its previous state can help you restore the system to a normal state. It works by creating a backup of a Ubuntu system in its current state, so that in any case something goes wrong, you can undo all changes and restore the system with this backup.
For Linux users, there is an open source tool called Systemback, which backs up the system and restores it to its previous state. With Systemback you can create backups or restore points from system files, user configuration files and even the entire current state of the system. In the event of a problem, you can restore your system to its previous state.
In this article we will see how to restore Ubuntu OS to its previous state using the System Back Utility. We will see both GUI and CLI versions.
We will use Ubuntu 18.04 LTS to describe the procedure mentioned in this article.
Systemback includes the following features:
- Create a System restore point date-wise
- Restore System to any restore point
- Copy the current system state
- System install
- Create a Live system
- Repair a fault System
- Handle System upgrade
Installing Systemback in Ubuntu
Follow the below steps to install Systemback in Ubuntu 18.04 LTS:
1. To install Systemback, we will first need to add its PPA. Press Ctrl+Alt+T to launch the Terminal and then type the following command:
$ sudo add-apt-repository "deb http://ppa.launchpad.net/nemh/systemback/ubuntu xenial main"
2. Then import the GPG signing key of this PPA by running the following command in Terminal:
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 382003C2C8B7B4AB813E915B14E4942973C62A1B
3. After adding PPA, update your local apt repository by running the following command in Terminal:
$ sudo apt update
4. Run the following command in terminal to install systemback
$ sudo apt install systemback
Wait for a while until the installation is completed.
5. After the installation is finished, you can launch it form the Ubuntu dash menu or simply type the following command as sudo in terminal to launch Systemback.
$ sudo systemback
Using Systemback via GUI
When the Systemback launches, following dialog box will appear, enter your password and press OK.
Following is the default view of Systemback application in Ubuntu. Application is divided into following sections.
- Restore points – Contains a list of restore points with the most recent at the top
- Highlighted restore points- Contains a list of restore points that are marked as important
- Point operations – Create, highlight, rename or delete restore points
- Storage directory – The location where the restore points are stored. The default storage directory of Systemback for storing backup is /home.
- Function menu – Contains various options such as System copy, restore, install, live system create, system repair, system upgrade, and exclude.
Creating a restore point
To create a restore point, click on Create new under the Point operations section. It will start creating the backup of the system at default directory /Home. However, you can change its location from under the Storage directory section. If you want, you can also exclude some configuration files from the backup by clicking on the Exclude under the Function menu.
After performing the above step, a dialog box will appear showing the progress of the process.
Above process may take a while depending upon your system. Once the backup is finished, you will see it listed under the Restore points section. The name of the backup will reflect the date when it was created.
Restore Ubuntu to the previous state
After creating a restore point, you can easily restore your Ubuntu to the previous state. To restore Ubuntu to a previous state, follow the below steps:
1. Select the desired restore point if you have multiple by using the checkbox to the right of the corresponding field. Select only the one restore point.
2. Then click on System restore option under the Function menu section.
3. System restore window will appear. Select the restore type. You can select Full restore option that will restore the complete backup. Alternatively, you can just restore the system using the System files restore or just the configuration files from User(s) configuration files restore option.
After selecting the restore type, click on Next.
4. It will prompt for confirmation, click on Start. It will start the restore process.
5. When the above process is finished, reboot your system. After reboot, your system will be in the previous state.
Using Systemback via Command line
We can also run Systemback by just using the command line.
1. To launch Systemback in command line mode, run the following command in terminal:
$ sudo systemback-cli
You will see the following CLI. In the main screen, it will list the available restore points (if any).
2. Select a restore point. Use the letter on the left of the corresponding restore point to select it. For instance, in our case, we will press B.
3. Now it will show the selected restore point. Below, you will see the three options. In order to delete the restore point, press 1, to restore press 2, and to go back to the main menu, press B. As we are going to restore, we will press 2.
4. Then select the restore type from the available options Full restore, System files restore or the User(s) configuration files restore. For instance, we want to only restore system files, we will press 2 to select the System files restore option.
5. Next, it will ask whether you want to keep the current fstab file and to reinstall the GRUB 2 bootloader. Press Y or N keys for yes or No correspondingly. Finally Press Y for starting the restore process.
6. Once the process is finished, press the Enter key to reboot the system. After reboot, our system will be in the previous state.
That is all there is to it. I hope it will be helpful if you ever need to restore your Ubuntu system to its previous state. However, save the restore points in a secure external location so that you can access them if something goes wrong.