Life hack

How to restore your ubuntu linux system to its previous state

Problem I Faced

  • I installed something that crashed my Wifi drivers that I compiled earlier.
  • Un-installing the same package doesn’t helped.
  • Finally, I re-compiled my wifi drivers and things are good.

My Question

But, is there anything like System Restore or System Rollback in Ubuntu/LinuxMint?

  • Is there anything that can undo an apt-get install package command?

6 Answers 6

There is a software for Linux called Timeshift exactly for this purpose. Using Timeshift you can take snapshots of your Linux system regularly and restore them whenever you need.

This software brings System Restore feature of Windows to your Linux distribution.

A short description from its official website:

TimeShift for Linux is a 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 later to bring your system to the exact state it was in at the time when the snapshot was taken.

Snapshots are taken using rsync and hard-links. Common files are shared between snapshots which saves disk space. Each snapshot is a full system backup that can be browsed with a file manager.

How to restore your ubuntu linux system to its previous state

Actually, there are few things in Ubuntu et al. that will allow you to roll-back changes. Brief below:

  1. /var/backups/dpkg.status.* : this directory keeps a set of log of the last system state prior to an install as follows; /var/backups/dpkg.status.0 is the most recent log prior to a state change (e.g. package install/remove/update . etc); /var/backups/dpkg.status. gz are compressed, archived versions of the logs at various points in time, rotated monthly.
  2. /var/lib/dpkg/status : this is the current state of installed packages. Manually backing this up, or providing a logrotate script in /etc/logrotate.d will ensure schedule snapshots of your system state to your liking.

Roll-back: the corner stone is your previous state /var/backups/dpkg.status.0 . Here is a brief step-wise procedure to restore previous package state (note brief and not exhaustive).

a. cp /var/backups/dpkg.status /var/lib/dpkg/status (will revert back the package state one version back).

b. dpkg -l | grep ii (will give you a list of supposedly installed packages based on the rolled-back /var/lib/dpkg/status file achieved in step a. above).

c. dpkg -l | grep ii | awk ‘‘ > /tmp/reinstall && sh /tmp/reinstall (will create a simple one-liner shell script and runs that to reinstall packages determined to have been on the system prior to an apt-get operation)

d. apt-get –reinstall install ucf (will take care of sanitising /etc config files et. al)

e. Repeat step c. if/as necessary

With a minimal bit of luck, you should be OK.

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 Features

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:

How to restore your ubuntu linux system to its previous state

2. Then import the GPG signing key of this PPA by running the following command in Terminal:

3. After adding PPA, update your local apt repository by running the following command in Terminal:

4. Run the following command in terminal to install systemback Advertisement

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.

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.

  1. Restore points – Contains a list of restore points with the most recent at the top
  2. Highlighted restore points- Contains a list of restore points that are marked as important
  3. Point operations – Create, highlight, rename or delete restore points
  4. Storage directory – The location where the restore points are stored. The default storage directory of Systemback for storing backup is /home.
  5. 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:

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.

  • ← How to make Viewnior your default Image Viewer in Ubuntu
  • How to Flash/burn an OS Image with Etcher on Ubuntu →

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn

Ubuntu in particular doesn’t have an official way to reset the OS to default state, unlike Windows 10 which comes with a recovery partition or external recovery drive. However there are unofficial ways to do this on Ubuntu, though these methods are not as effective as Windows’ implementation.

Restoring Ubuntu to factory state can mainly be broken into two parts: finding and installing any missing software shipped with the OS and reverting the desktop to default settings. This tutorial will explain both methods, the first one will work with Ubuntu and all of its derivatives while the second one will only work with Ubuntu and other GNOME based derivatives like Ubuntu MATE. Both these methods have some caveats though, which are explained below.

Installing Missing Packages Shipped with the OS

To find and install missing default packages, you will need the installation ISO image, again. If you have an installation image stored somewhere or have access to previously made installation media, it will do the job. Otherwise you will have to download a fresh ISO from distribution’s website.

Now the question is: why do we need the ISO again? The answer is simple, we need a way to find out what packages were shipped by default. Every Ubuntu ISO contains a few “manifest” files. These manifest files tell default installer which packages to install and which to remove once the first run installation finishes.

Difference between these manifest files (diff) will give us exactly what we need: a list of default packages for the current installed version of Ubuntu. Before we move ahead, take heed of the following:

Your ISO image should have the same version and architecture as your installed OS, otherwise a wrong choice may further break your system. For a 64-bit desktop, you need to have a 64-bit ISO image. Example: A 64-bit installation of Ubuntu 19.10 will require Ubuntu 19.10 64-bit ISO only.

To create the diff list, extract Ubuntu ISO image using file or archive manager. In the extracted folder, you will find a “casper” directory that contains our required manifest files. These files are:

  • filesystem.manifest
  • filesystem.manifest-remove

How to restore your ubuntu linux system to its previous state

Create a working project directory named “packagelist”.

Manually copy the two manifest files: “filesystem.manifest” and “filesystem.manifest-remove” to “packagelist” folder.

Launch a terminal inside “packagelist” directory and run the command below to create a diff file:

Using the “diff.txt” file obtained from above, we can now finally run command that finds and installs missing default packages:

Ideally a factory reset should reinstall missing and downgrade all packages to stock shipped versions. I have attempted to do that by manipulating above diff.txt file, but the process fails when a required package version simply doesn’t exist in the online archive. It seems Ubuntu sometimes removes oldest version of a package from archive when too many versions pile up or when it becomes outdated. Downgrading all packages to stock versions may also cause multiple dependency conflicts. So it is safe to say that reverting every package to default version is not possible in Ubuntu at this time.

Reverting Ubuntu Desktop to Default Settings

As stated earlier, this method will only work with desktop environments based mostly on GTK and GNOME. The following command will revert all “gsettings” to their default values:

Gsettings works similar to Windows Registry, it acts as a centralized store for application settings. I have personally tested this command with stock Ubuntu (GNOME Shell) and Ubuntu MATE (MATE Desktop). It works like a charm on both.

Apps using other methods to store settings, won’t be affected by the above command. For instance, many third party apps store config files in .config or home directory. Both these desktop environments are fully GTK3 though and settings for stock applications are stored in gsettings only. So you are covered.

The Last Resort

While the methods explained above help in fixing system breakage, some bits and pieces are always left. The only foolproof way to factory reset Ubuntu is to do a fresh install. Just backup your home folder and other required files, make a bootable USB and you are ready to go. Reinstalling Ubuntu probably will be much faster than say Windows 10 doing a factory reset, which can drag on for hours.

Linux users however do need an easier, hassle free way to factory reset or rollback their devices. File systems like BTRFS and ZFS have snapshot and rollback features (somewhat similar to System Restore in Windows, but more sophisticated). Ubuntu 19.10 has added ZFS on root as an experimental installer option for desktop, but widespread adoption for both BTRFS and ZFS is yet to be seen.

About the author

How to restore your ubuntu linux system to its previous state

Nitesh Kumar

I am a freelancer software developer and content writer who loves Linux, open source software and the free software community.

New Linux users are often faced with problems due to accidental changes in their system that eventually result in unstable system performance. But what about resetting the entire operating system to its factory default settings without re-installing it using a Live CD/DVD image. That means to return your system back to the original state when it was installed the first time.

In Ubuntu-based distributions, there is a way to do this. Resetter is an open-source application that is used to reset Ubuntu to factory defaults. It detects all the applications that are installed in the system after a fresh install and removes them. Not only applications but it also removes users and their Home directories. However, if you want to prevent some applications and users from deletion, you can do that by using custom settings. The good thing about the Resetter application is that it only deletes applications and users, not the data. The reset process consists of the following processes.

  • Loading installed packages
  • Removing installed packages
  • Cleaning up
  • Installing any missing packages
  • Removing old kernels
  • Deleting users

In this brief guide, we are going to look at how to reset Ubuntu operating system to its factory default settings by using the Resetter application. Resetter offers two methods to reset the OS to its default factory settings i.e. using Custom Reset and Automatic Reset. Here I will describe the custom reset method. However, we will see a little about what is automatic reset and how to use the automatic reset mode to reset the system.

Resetter supports these Linux Distributions:

  • Elementary OS 5.0
  • Deepin OS 15.8, 15.9, 15.10
  • Debian Gnome 9.6, 9.7, 9.9, 10.0, 10.1
  • Debian KDE 10.0
  • Linux Mint Cinnamon 18.3, 19, 19.1, 19.2
  • Linux Mint 18.3 Mate
  • Ubuntu Gnome 18.04, 18.10, 19.04, 20.04
  • Ubuntu Unity 16.04
  • Parrot OS Mate 4.7
  • BunsenLabs 10.4 XFCE

I will use Ubuntu 20.04 LTS for describing the method mentioned in this article.

Download Resetter Ubuntu Package

First, we will need to download Resetter from official GitHub repository that is currently the latest version of the Resetter.

Installing Resetter

After the download is completed, the next step is to install it. The downloaded setup is in .deb format. There are two ways to install it. The first is to simply double click the setup and install it. The second way is to install it using dpkg command. I will use the second way.

Press Ctrl+Alt+T to launch the Terminal application in Ubuntu. Then run the following command in Terminal to install it.

Then run the following command:

After the installation is completed, type following command in the Terminal to launch the Resetter application.

Here is default interface of Resetter looks like: Advertisement

Reset Ubuntu using Resetter

As discussed earlier, you can reset your Ubuntu OS using two options:

  • Custom Reset
  • Automatic Reset

Reset using Custom Reset option

Custom reset allows you to decide on which applications to remove for reset and which to keep. You can also decide to keep your existing user or to create a new one. While resetting, you can choose which user to delete, and to delete only user or delete both user and its home directories. You also have the option to remove old kernels.

To start with custom reset, click on Custom Reset option in the Resetter window. It will list all packages that you can select to remove. You can also choose to remove kernels by selecting the checkbox below. Select any package that you want to remove and click on Next button.

While configuring for custom reset, it lists some packages that are missing from your system and gives you the option to install them. Select packages that you want to install and click on Next.

In custom reset, it gives you the option to keep your existing users with their Home directory or to delete them. You can choose to select one or all users from the list. When the checkbox under Delete User and Home column is checked, it will remove the user with its Home directory. Now if you want to remove the user, select it and then click Next.

When you are done with all the configurations, click on Finish to apply the changes.

Then it will ask you if you want to create a new user account. Click on Yes to create a new account, otherwise, click No.

Here I am creating a new user account.

Set your username and password for the new account and click OK.

Now it will start the reset process.

In the Terminal, you can also view the ongoing reset process.

When finished, click on Yes to reboot the system.

Reset using Automatic Reset

Use the automatic reset option to reset the Ubuntu OS completely to its default factory settings. It detects and removes all applications from the system which are installed or added after the fresh installation like Applications and the users with their home directory. However, it creates a new user during reset. Usually, it is not a recommended method for reset unless you want to reinstall the system from the very start.

To start with automatic reset, follow the below steps:

  1. Click on Automatic Reset option in the Resetter window. It will reset the system to its default settings and delete user accounts with their home directories. Click on Yes to continue.
  2. Then it will list all the packages that it will be going to remove. If you want to keep some packages, uncheck them. Then click on Ok to continue.
  3. It will start the reset process and creates a default user and will provide you with credentials. You will use these credentials to log in to your system next time.
  4. When finished, reboot your system.

So this was all about the installation and usage of Resetter in order to reset your Ubuntu OS to its factory default settings using the custom reset method. We have also discussed a little about the Automatic reset mode. You can easily use this method for reset however, it is not much recommended as it wipes out everything from the system.

  • ← How to deactivate or disable a user account in Ubuntu 20.04 LTS
  • How to Install CMake on Ubuntu 20.04 LTS →

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn

This brief tutorial describes how to restore broken Arch Linux and its variants like EndeavourOS, Manjaro Linux to previous working state.

The other day, I did a full system upgrade using command “sudo pacman -Syu” , and ended up with a broken Arch Linux system.

My Arch Linux refused to boot into graphical mode, and kept displaying the error messages: “dependency failed multi-user system” and “dependency failed for graphical interface” .

The only option I had is to login to single user mode and try to rollback the updated packages to their previous versions.

From the single user mode, I tried the following:

  • I tried to install packages from official repositories, but I couldn’t. Because my Network card is not recognized in single user mode, so Internet didn’t work.
  • The “downgrade” command doesn’t work. I have no idea why. So, I couldn’t downgrade any packages to their previous versions. It simply displayed an error message “sudo pacman command is not found” .
  • So, tried again to downgrade all packages to a specific date. It didn’t help either. I got the same error as above i.e. “sudo pacman command is not found” .

I was helpless. All I have is a Tablet PC with an Internet connection. After extensive search on Arch Linux wiki and forums, I thought to give a one-last try.

I decided to downgrade all the packages which are previously updated one by one. Because, the “pacman -Syu” command updated many packages, so I couldn’t confirm exactly which package is causing the problem.

If you’re in this similar situation, this guide might be help you to restore your broken Arch Linux to previous working state.

Restore broken Arch Linux to previous working state

1. First, login in single user mode. To do so, enter “e” when you see the Grub menu.

2. Then, find the line that starts with word linux :

At the end of the above line, type the following line:

See the following screenshot for your reference.

3. Then, press F10 or CTRL+X to continue. After couple seconds, you will be landed into single user mode.

4. Type the following command to mount your root (/) file system in read/write mode.

5. Now, you need to find when you did the full system upgrade. You can easily find this by looking at your pacman.log file. This file saves all pacman entries you did in the past.

Here, -n 200 will display the last 200 lines in your pacman.log file. Because, my pacman.log file has so many entries.

As you may know, tail command will display the last 10 entries only. So, replace 200 with your own number to go through the pacman.log file. And I piped the output of “tail” command to “less” command to display the results page by page.

6. After going through the pacman.log file, I found the exact time of the full system upgrade. Check the timestamp in the below screenshot (Sorry for the low quality image).

I had run “sudo pacman -Syu” command at 12:06 pm.

As you can see, “pacman -Syu” command has updated 40+ packages.

7. Since, I can’t use “downgrade” command and downgrade all packages to any specific date, I had no choice but to downgrade all updated packages one by one using “pacman -U” command from the cache. As you already know, pacman saves all downloaded packages in /var/cache/pacman/pkgs/ folder.

8. I noted down all updated packages from the screenshot and downgraded them one by one to earlier version from the cache like below.

The above command will install qt5-base package from the cache folder. It took me nearly half an hour to downgrade all packages.

9. If you cleared the cache folder already, you have no choice. Reinstallation might be the only option. So, I recommend you to keep at least two old versions in the cache, so you can restore them if there are any problems in the new packages.

10. After downgrading all packages, type the following command to apply the changes and start your Arch Linux in to normal mode.

11. Now, I can be able to login to my Arch Linux desktop without any problems. I think I should hold a couple of days and then try to update again when this is fixed.

If you have time and patience, downgrade one package and run “exec /sbin/init” to boot your system into normal mode and check if it solves the problem.

If not, try another package. Repeat this until you find the problematic package. Then simply leave the problematic package and update all other packages.

Some of you may find this method is not so efficient and complicated. But this is how I recovered my broken Arch Linux system.

You might know some other easy ways than this method. If you know any such easy methods, please let me know in the comment section below. I will check and update the guide accordingly.

Other useful Arch Linux tutorials on this blog:

Today, I have stumbled upon an interesting and useful tool called Resetter, which is used to reset Ubuntu to factory defaults. That means, your Ubuntu system will go back to the state when you installed it in the first time. It finds all applications which are installed after Ubuntu fresh installation and delete them. Not just applications, it also deletes the users too. You don’t have to reinstall everything from the beginning. Just reset your Ubuntu to its factory defaults and start installing the required applications. Don’t worry about your data, Resetter won’t touch them. It just removes the applications and the users. To put this simply, Resetter will detect and remove packages that have been installed after the initial system install.

Resetter is completely free and open source. It is built with python and pyqt. It is not just for Ubuntu, It will also work on Ubuntu derivatives like Linux Mint, Elementary OS. It currently supports the following distributions (only 64 bit).

  • Elementary OS 5.0
  • Deepin OS 15.8
  • Debian Gnome 9.6
  • Linux Mint Cinnamon 18.3, 19, 19.1
  • Linux Mint 18.3 Mate
  • Ubuntu Gnome 18.04, 18.10
  • Ubuntu Unity 16.04

In this brief guide, I will explain how to install and how to use Resetter to reset Ubuntu system to its factory settings.

Install Resetter

Download the latest version from here. As of writing this guide, the latest version was 2.2.0.

Then, install it using commands:

Reset Ubuntu To Factory Defaults

Once installed, launch it either from Unity dash or Menu.

How to restore your ubuntu linux system to its previous state

The default interface of Resetter will look like below.

How to restore your ubuntu linux system to its previous state

As you see, it has two options namely “Automatic Reset” and “Custom Reset”.

Automatic Reset (Not Recommended)

As the name implies, Automatic Reset will reset your Ubuntu system completely to its factory defaults automatically. It detects all applications which are installed after Ubuntu fresh installation and delete them including the Users. If there is no important data in your Ubuntu system, You can use option to wipe every applications installed after Ubuntu fresh installation.

Click Automatic Reset to proceed.

How to restore your ubuntu linux system to its previous state

Please BE MINDFUL that this option will remove all applications including the users after Ubuntu fresh installation. Also, it will create a new user called “default” automatically.

Click OK to continue.

How to restore your ubuntu linux system to its previous state

If you want to keep any applications from removal, just uncheck them.

Now, Resetter will detect and delete all applications including the existing users.

How to restore your ubuntu linux system to its previous state

After few minutes, it will automatically create a new user. You need to use these credentials the next time you log in.

How to restore your ubuntu linux system to its previous state

Finally, reboot your Ubuntu system.

How to restore your ubuntu linux system to its previous state

Now, log in with new user credentials.

How to restore your ubuntu linux system to its previous state

Congratulations! Your Ubuntu system has been reset to its factory defaults. Start installing the applications you want to use.

Custom Reset (Recommended option)

This is the recommended method. Using this option, you can decide which applications to remove and which applications to keep. Also, you can have an option to keep your existing user or create a new user of your choice. The automatic method doesn’t allow you to create your own user of your choice. It will simply delete the existing user and create an user called ‘default’.

Click Custom Reset button in the Resetter home screen. Choose the applications to remove.

How to restore your ubuntu linux system to its previous state

Next, you will be asked whether you want to remove or keep the existing. You can choose whether you just want to remove the user or user with its home directory. Be careful while you choosing this option. If you choose the option that labeled “Choose User and Home”, all data on your HOME directory will be deleted.

How to restore your ubuntu linux system to its previous state

Click Finish button to apply the changes.

How to restore your ubuntu linux system to its previous state

Click Yes to create your own new account. Or, click No to to create a default account.

How to restore your ubuntu linux system to its previous state

Enter the username and password of your choice if you had chosen Yes in the previous wizard.

How to restore your ubuntu linux system to its previous state

Now, Resetter will find and delete all applications/users installed/created after Ubuntu fresh installation.

How to restore your ubuntu linux system to its previous state

Once its done cleaning, it will show you the user credentials to use to login next time.

How to restore your ubuntu linux system to its previous state

Finally, select Yes to reboot your Ubuntu system.

How to restore your ubuntu linux system to its previous state

Done! Log in with your new user and start using it.

How to restore your ubuntu linux system to its previous state

If you messed up with your Ubuntu system, Resetter will give you an easy way to reset Ubuntu to its initial state. You don’t have to re-install Ubuntu. It really deserves a space in your arsenal. Give it a try. You won’t be disappointed.

I have a black screen on my PC, and I’ve somehow got in the terminal the terminal is all black and I can only do commands.

Is there a command to factory reset your PC through the terminal?

How to restore your ubuntu linux system to its previous state

How to restore your ubuntu linux system to its previous state

3 Answers 3

Follow these steps:

Try configuring unconfigured packages:

Update the contents of the repositories

Try to fix missing dependencies:

Update all packages with new versions available:

Reinstall Ubuntu desktop:

Remove unnecessary packages:

Delete downloaded packages already installed:

Reboot the system to see if the issue was resolved:

How to restore your ubuntu linux system to its previous state

How to restore your ubuntu linux system to its previous state

Running this command will reset, among other things: the apps pinned to the Unity launcher or Ubuntu Dock ; panel applets and/or indicators; monitor resolution and interface scaling; keyboard shortcuts; fonts, GTK and icon theme; window button placement, launcher behaviour; and so on.

This command will also reset any application that uses dconf to store its settings. This includes core desktop apps like Rhythmbox, Evince, Shotwell and Nautilus.

This latter point is important to keep in mind as this command may reset library settings, delete accounts, disable plugins, and/or require you to re-authenticate with online services.

On the flip it means this command is the perfect one to run when you want to reset GNOME 3 settings.

Systemback makes it easy to create backups of system and users configuration files. In case of problems you can easily restore the previous state of the system. There are extra features like system copying, system installation and Live system creation. More information can be found on Systemback website.

Installing Systemback

To install Systemback in Ubuntu 16.04 you only have to add it’s repository to the system and use apt-get to install it like this:

How to restore your ubuntu linux system to its previous state

To install systemback on Ubuntu 18.04/19.10/20.04

Systemback is not supported in 18.04/19.10/20.04. Its binary for Ubuntu 16.04 is compatible so we can run the following command to install Systemback on the newer versions on Ubuntu.

First remove the nemh PPA if you already installed:

Now import the GPG signing key which is available in launchpad as follows:

To add the PPA, type:

Next update the system and install systemback:

Restore points

Restore points work similar to the restore points in Windows, the application will create a snapshot of the current system and save it to disk, so you can restore it any time if it is needed.

To create a restore point you need to open Systemback GUI by running the systemback command:

And it will look like this:

How to restore your ubuntu linux system to its previous state

Now you simply have to press the “Create New” button (marked with blue in the screenshot) to create a system restore point. It will open a window that it will look like this:

How to restore your ubuntu linux system to its previous state

After it’s finished, when you need to restore the system to that point, all you have to do is select the point from the left side and click “System Restore” button on the right side (both marked with yellow on the above screenshot) and it will restore your system to that point.

The system restore window will look like this:

How to restore your ubuntu linux system to its previous state

As you can see you have a few options, to either restore the full system or just restore the system files or user configuration files, depending on what you need to get back.

Note: You can also use the Schedule button from the main menu to automatically create restore points at a set interval.

Live system create

You can use the “System Copy” button to create a full copy of your system in case you needed, but the really nice feature it’s the “Live system create” feature, this will create a live image of the current system that you can burn on a DVD or copy to a usb disk and boot it on a computer directly from that device.

To create one you need to click the “Live system create” and it will open the following dialog:

How to restore your ubuntu linux system to its previous state

From here all you need to do is select the destination directory and click the “Create new” button. Conveniently after the Live image is created you can click the “Write to USB” button to copy the content on a USB stick that you can use to boot from or “Convert to ISO” that will create a ISO file that you can burn on a CD or DVD to boot from.

Systemback is a nice little utility that makes backups easy and convenient to set up.

4 Comments. add one

Where does Systemback keep its files?

I wanted to save the backed-up system to a volume on an external USB drive, /dev/sdf6. I tried to change Systemback’s Storage location from /home to this volume, but the closest I can come to it,from browsing in Systemback, instead instead produces /sdf6/dev — I don’t know what this means.

The utility produced a restore point when asked, and it’s displayed by the utility, but from the file manager (Dolphin) I can’t see where these points are being stored. In other words,there are no new files visible in the volume /dev/sdf6.

Systemback also offered me the possiblity of setting the location as just /sdf6 (no /dev) but with the same result: points appear to be made, but there’s nothing created in the storage location. I also looked for hidden files, but that didn’t change the result.

Can anyone familiar with the operation of Systemback give me a clue as to what’s happening?
Linux Mint Quiana / KDE

You can can’t use devices in /dev directly. You will have to first mount that device with mount that device to a directory using the mount command like this:

# mount /dev/sdf6 /mnt/usb-drive
# mount /dev/sdf6 /media/usb-drive

Be sure that the directory already exists and also depending on distribution it might get auto-mounted when you plug it in, to check that run:

You should then be able to use that directory to save the Systemback data.

Trying to install systemback on my Mint pc but I get this,

$ sudo add-apt-repository ppa:nemh/systemback
Cannot add PPA: ”This PPA does not support focal”.
Is this the end of it or is there something I can do? Appreciate your help, thanks.

Ubuntu 18.04/19.10/20.04 not supported. You can still use the old version, the article is updated.

How to restore your ubuntu linux system to its previous state

Have you experienced times when you need to just scrap all that you’re doing and start afresh? There’s a reason why a clean OS installation usually sounds good to the ears – you want to reset to default.

When I was new to Ubuntu I often found myself stuck at points wherein I had forgotten the configurations I altered and searching online to rectify the affected system errors was too technical for me to spend my time on.

At those times performing a clean installation seemed to be my only solution. But what happens if you don’t need to perform a clean installation any longer? But now, thanks to relatively new python app, Resetter, I now have a choice.

Resetter is a python and pyqt app developed to facilitate resetting your Debian-based Linux (Ubuntu or LinuxMint) system to default while keeping the latest updated packages alongside your local files. It pretty much eliminates the need to re-install from cd/dvd images.

To use Resetter you can either allow the app to automatically detect and remove installed apps (automatic reset) or choose to have it uninstall only the app items you select (custom reset). The process is pretty straightforward.

How to restore your ubuntu linux system to its previous state

Automatic Reset Ubuntu to Default

How to restore your ubuntu linux system to its previous state

Resetter – Resetting Ubuntu to Default

Features in Resetter

Resetter’s two main features include the option to either perform an automatic restore to stock or a custom restore (which allows you select what you want uninstalled); and its simplistic UI.

Here is a comparison table showing its options feature list:

How to restore your ubuntu linux system to its previous state

Resetter Options Comparison

Mind you, Resetter is available for only 64-bit systems and being in beta stage, it has support for only:

  • Linux Mint 18.1
  • Linux Mint 18
  • Linux Mint 17.3
  • Ubuntu 17.04
  • Ubuntu 16.10
  • Ubuntu 16.04
  • Ubuntu 14.04
  • Elementary OS 0.4

Unless you want to figure out a techy way around this support issues, you will have to wait for your turn to give it a try.

Install Resetter to Reset Linux System to Default

Resetter is yet to be added to the PPA, but its .deb package is available for download. You can use a Software Center or alternative like gdebi to install .deb packages.

If you don’t already have gdebi installed then simply open a new Terminal window and run:

Have you used Resetter before or do you use an alternative whenever you need to restore your workstation to its stock settings? Feel free to comment and share your opinions on the app with us.

Last updated September 12, 2021 By Aquil Roshan 242 Comments

Brief: This tutorial shows you how to backup and restore Linux system easily with Timeshift application.

Be it a beginner or an advanced coder, a Linux user will, at some point find the need for a backup solution. All it takes is just one sudo command to go wrong and you’ll be sent back to the Stone Age. Linux shows you no mercy when you don’t have a solid a backup.

How to restore your ubuntu linux system to its previous state

There are lots of impressive backup software available for Linux. Almost all distros come with an easy to use backup tool too. They back up and keep your docs, music and other important stuff safe.

But, it’s reinstalling all the software, drivers and configuring the system that turns out to be a nightmare. Although there are software like Aptik which do backup all your installed packages, They still don’t just cut it.

Easily backup and restore Linux system settings desktop with Timeshift

Well, when you are trying to get Nvidia drivers to work on your Linux installation or getting that new Gnome to work on your system, there is a good chance that your system won’t log into a graphical environment at all depending on your distro and the instructions you followed.

Maybe you skipped a step and you realized it a little too late. In any case, your next action would be to scavenge the web for repair instructions which can be real frustrating. Maybe you are just having some regression in the system after you installed something and want it to run smoothly like before.

Bought a new computer and want to shift your entire OS with all its settings and customizations to the new PC?

What does Timeshift do?

See Timeshift doesn’t backup your regular files in the home folder. You can do that with Deja Dup.

Timeshift is for backing up system files and settings. So that when you are configuring your system and making some customization and messed it up, you could revert to the older system snapshot.

Installing Timeshift in Linux

Let’s see how to install Timeshift in various Linux distributions.

1. For Ubuntu and Linux Mint

Timeshift is available in the Universe repository of Ubuntu 20.04 and higher versions. This means you can install it on Ubuntu 20.04 and Linux Mint 20 using the apt command.

Open the terminal in Ubuntu and enter the following command:

For Ubuntu 18.04 and Linux Mint 19 series, you’ll have to add a PPA.

Enter the below commands one by one:

2. For Arch Linux, Antergos, Apricity and Manjaro

The latest version of Timeshift backup solution in available in the Arch User Repository. Enable AUR and get Timeshift with the following command.

How to use Timeshift to backup and restore a Linux system

Now that you have it installed, let’s see how to use it.

A. Making a backup of your Linux system

Well, there’s no command line hassle here. Launch Timeshift from the menu. Put in your sudo password when asked. Click on create. Quickly watch this video while Timeshift does its thing. Done.

How to restore your ubuntu linux system to its previous state

You may choose to alter the parameters of backup such as backup location from the menu.

” data-medium-file=”×241.jpg” data-large-file=”×643.jpg” loading=”lazy” width=”800″ height=”643″ src=”” alt data-lazy-srcset=” 800w,×241.jpg 300w,×617.jpg 768w” data-lazy-sizes=”(max-width: 800px) 100vw, 800px” data-lazy-src=”″ srcset=”data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7″>

You may even schedule daily or weekly backups. Automated backups so that if shit goes south, you got a recent rollback ready every time.

B. Restoring your Linux system

1. From the same OS

When you can still log onto to your OS and want to go back to a previous state of your PC, just launch Timeshift from Menu or Dash and select a Restore Image and hit restore. That’s all.

How to restore your ubuntu linux system to its previous state

2. Restoring when you can’t log into your Linux system

This section is for systems which can’t log into a Graphical Environment, are completely formatted or damaged beyond repair.

You’ll need a Live USB. I very highly recommend you to always keep either a Ubuntu Live USB or an Ubuntu DVD with you as this can be a lifesaver. There is no excuse for not having this.

Anyway, boot into a live session and download and install Timeshift using the same above install instructions (yes, you can install applications in live sessions).

After installation, launch the application and browse to your backup location and select restore (yes, you can access your hard drive using a live session).

I recommend you let timeshift install the bootloader again.

Wrapping up

Can backup and restore Linux system get any easier? This program gives you the ability to tinker around, mess up, try new stuff without any fear or regret. This tool is invaluable for new Linux converts who might break stuff. But the thing about Linux users, they never stop tinkering. I mean never. So you still must get it even if you are an expert in handling the Penguin.

What is your view on the amazing Timeshift? How do you backup Linux system?

Also, do tell us situations where you messed up real bad and timeshift could have been or has been useful. Don’t forget to share. You might save a Linux life 😀

Like what you read? Please share it with others.

Chris Hoffman is Editor-in-Chief of How-To Geek. He’s written about technology for over a decade and was a PCWorld columnist for two years. Chris has written for The New York Times and Reader’s Digest, been interviewed as a technology expert on TV stations like Miami’s NBC 6, and had his work covered by news outlets like the BBC. Since 2011, Chris has written over 2,000 articles that have been read nearly one billion times—and that’s just here at How-To Geek. Read more.

How to restore your ubuntu linux system to its previous state

Ubuntu includes Déjà Dup, an integrated backup tool, but some people prefer Back In Time instead. Back In Time has several advantages over Déjà Dup, including a less-opaque backup format, integrated backup file browser, and more configurability.

Déjà Dup still has a few advantages, notably its optional encryption and simpler interface, but Back In Time gives Déjà Dup a run for its money.


Back In Time is available in Ubuntu’s Software Center. Unlike Déjà Dup, Back In Time also has a GUI that integrates with KDE. If you’re using Ubuntu’s default Unity desktop, install the GNOME version.

How to restore your ubuntu linux system to its previous state

Back In Time is also available in Fedora, Mandriva, and other Linux systems’ repositories.

Backing Up Files

Back In Time installs two shortcuts – “Back In Time” and “Back In Time (root).” The root version runs with root permissions, which are required to access and back up certain system files. If you’re just backing up your personal files, select the “Back In Time” shortcut.

How to restore your ubuntu linux system to its previous state

You’ll see the Settings window after you launch Back In Time. This window is more complex than Déjà Dup’s, but it also offers greater configurability. For example, Back In Time lets you create different profiles with separate backup settings, a feature Déjà Dup lacks.

How to restore your ubuntu linux system to its previous state

You’ll have to specify a location for your backup snapshots in the “Where to save snapshots” box on the General tab and a list of files or folders you want to back up on the Include tab. The other options in the Settings window are optional.

How to restore your ubuntu linux system to its previous state

Unlike Déjà Dup, Back In Time allows you to configure when your backups are automatically removed. Déjà Dup only removes older backups when the storage space fills up, while Back In Time offers much finer-grained control on the Auto-remove tab.

How to restore your ubuntu linux system to its previous state

Once you’re done configuring your backups, click the OK button and use the “Take snapshot” button to take your first snapshot. Back In Time uses rsync as its backend, which offers incremental backups – future backups will only copy changes and will complete quickly.

How to restore your ubuntu linux system to its previous state

Restoring Files

Unlike Déjà Dup, which uses a Duplicity-based, opaque backup format, Back In Time uses rsync directly. Your backup snapshots are stored as files and folders on your hard disk, allowing you to browse them directly. You could perform a backup to a removable hard drive, plug it directly into Windows, and access your files without converting or extracting anything. Unfortunately, this does mean that Back In Time doesn’t offer the same encrypted backup feature Déjà Dup does.

How to restore your ubuntu linux system to its previous state

Back In Time offers a graphical snapshot browser that makes it easy to browse your backup snapshots and restore individual files, while Déjà Dup offers no such browser. Déjà Dup’s Nautilus integration allows you to restore individual files from a file browser window, but only if you know the folder they were originally contained in. There’s no way to browse a snapshot without restoring the entire thing to another folder.

How to restore your ubuntu linux system to its previous state

Back In Time is a more powerful, configurable tool with a less opaque backup format. Déjà Dup still wins when it comes to encrypted backups and the simplest possible interface, though.

Do you use Déjà Dup, Back In Time, or another solution to back up your Linux system? Leave a comment and let us know.

I’ve had a lot of problems lately and now I’m having problems logging in at the login screen. I’m giving up and just want to reset and start over. How can I “factory reset” Ubuntu, in this situation, or, for future reference, in general?

How to restore your ubuntu linux system to its previous state

4 Answers 4

I can see a couple of options but they depend on you being able to get to a command prompt with a working internet connection.

  1. Install another desktop.
  2. Burn a new USB installer from command line.

Install another desktop

This does not guarantee a working desktop though. Your problem might be something related to video card and also present in other desktops. Drop to a command line and start of with this:

and then pick ONE of these (to install that specific desktop):

I only listed a few (you could also install kUbuntu but for just getting a desktop to be able to make an installation disk might be overkill).

Burn a new USB installer from command line

Download Ubuntu from command line with

(change the url to a release you want. see and the directories below that for what you need). It will show something like this:

and then “dd” the ISO to the USB flash drive. Pay extra attention to the device name. If you mess this up you could overwrite your current install. I tend to use dmesg :

So that would be “sdc”. This will burn it (skip the 1st one if you are still in Downloads, skip the 2nd one if it is already installed):

and an image of the freshly created USB ISO:

How to restore your ubuntu linux system to its previous state

Computer factory resets will restore the computer to the computer’s original operating system and delete all of the user data stored on the computer.

This can be achieved either by re-installation of the OS or using a factory reset option. But in Linux, there is no option for factory reset inbuilt. So, it is required to look for alternatives which can achieve above said things.

While re-installation of the OS is the preferred method in order to remove users, user files and user applications but it is somewhat a tedious task. There is a tool called Resetter which would make “resetting Ubuntu” easier and will do what factory resets usually do.


Resetter is a tool which is used to reset Ubuntu installation to factory default. The Ubuntu system will go back to the state when it was installed for the first time. It finds all applications which are installed after Ubuntu fresh installation and delete them. Not just applications, it also deletes the users too. Deleting users means deleting their home too which means all user files and configurations. You don’t have to install everything from the beginning. Just reset your Ubuntu to its factory defaults and start installing everything else.


Download the latest release of Resetter and add-apt-key_versionX.deb from GitHub or use wget to direct download. At the time of posting this answer v3.0.0 was the latest release. To download using wget use:

Install some dependencies:

Install downloaded .deb packages:

Using Resetter:

Open Resetter from Dash and authenticate. Authentication is required to perform administrative tasks.

How to restore your ubuntu linux system to its previous state

To reset Ubuntu, click on Automatic Reset. But if you want to remove multiple packages at once click on custom reset.

How to restore your ubuntu linux system to its previous state

Click “Yes” to confirm. You’ll get a dialog which would list all the packages which would be removed.

How to restore your ubuntu linux system to its previous state

Click “OK” to start. The factory reset will begin:

How to restore your ubuntu linux system to its previous state

A new user will be created to access the system using administrative privileges. A dialog will appear which would show details about that newly created user. After that confirmation for Reboot will appear.

How to restore your ubuntu linux system to its previous state

How to restore your ubuntu linux system to its previous state

If your Ubuntu boots into TTY mode (command line/console mode), login with the credentials of new user and install desktop environment again.

Use previously provided password to login.

How to restore your ubuntu linux system to its previous state

Modify Username and Password as per convenience.

How to restore your ubuntu linux system to its previous state

Ever wonder how you can reset Ubuntu to default settings easily? As we all know, sometimes we get really fed up with using the customised Ubuntu we use, and wish to revert to the default desktop with factory settings, so here’s your solution to it.

In this article, we will discuss resetting any Ubuntu or Debian-based distribution to its default factory settings, without needing to reinstall Ubuntu.

Table of Contents

Steps to Reset Ubuntu to Default Settings Using the dconf Command

We can easily reset our Ubuntu to default settings using the dconf command. You can check out its man-pages by running the following command in terminal:

For quick reference, here is how my customised and tweaked Ubuntu desktop looked before resetting to default settings.

How to restore your ubuntu linux system to its previous stateMy Desktop Before Restoring

To reset Ubuntu to default settings, just open your terminal from the menu or using the keyboard shortcut CtrL+Alt+T, and run the following command –

This command will reset your system settings and desktop to factory settings. After running the command, your Ubuntu will revert to default factory settings, in a blink of an eye.

Your Ubuntu will look as good as new, like mine does. Everything from system settings, wallpaper, dock size, pinned icons got reverted to factory settings.

How to restore your ubuntu linux system to its previous stateUbuntu Restored To Default Settings

This command resets all the changes that you did to the system UI, like wallpaper, pinned applications, icon themes, screen resolution, fonts, dock, panel applets, system settings, keyboard shortcuts, menu behavior etc., to default factory settings.

It will not affect any application that you have installed. It won’t affect or delete your downloaded applications or data either. It will only affect only those applications that use dconf like the system settings.

For purpose of ease, we have added a GIF below especially for you. It will help you to understand the entire process pretty easily.

How to restore your ubuntu linux system to its previous stateResetting Ubuntu To Default Settings


  • You can also use dconf to backup and restore your system settings


In this article, we discussed that how we can easily reset Ubuntu to default settings with help of a single command dconf .

Here’s a handy command line tip you can use to reset Ubuntu back to its default settings without reinstalling!

The command works on both the Unity desktop shipping in Ubuntu 16.04 LTS and the GNOME Shell desktop featured in Ubuntu 18.04 and above.

This command can even reset MATE desktop to its stock settings too, should you have it installed, of course!

But why might you want to reset Ubuntu in the first place?

You might move between different desktop environments often. You might extensively tweak your desktop. Or you might have run into conflicts and other technical issues you want to “undo”.

Or perhaps you just want that “first start” feeling without the hassle that comes from needing to do a reinstall.

Whatever the reason, using one command you can:

  • Reset Ubuntu Unity desktop to default settings
  • Reset GNOME desktop to default settings
  • Reset MATE desktop to default settings

…all at the the same time.

The command to run is:

This command resets the apps pinned to the Ubuntu Dock; panel applets and/or indicators; monitor resolution and interface scaling; keyboard shortcuts; fonts, GTK and icon theme; window button placement, launcher behaviour; plus any settings you may have changed.

This command will reset all applications that uses dconf to store settings. This will therefore includes core desktop apps like Rhythmbox, Evince, Shotwell, Nautilus, and File Roller.

Keep that in mind before running the command that it may reset library settings, delete accounts, disable plugins, and/or require you to re-authenticate with online services.

How I Reset my Ubuntu Desktop

Here’s a tweaked Ubuntu desktop. I’ve moved the Ubuntu Dock to the bottom, rearranged the window controls, applied a different GTK theme and icon set, customised the wallpaper, and tweak various other desktop settings:

I open a terminal and ran the command above to restore Ubuntu back to its default settings.

A mere 1.5 seconds and a screen blink later my desktop was transformed back to this. It’s a ‘factory settings’ style default set up with everything in the right place, as it should be, as if this was a fresh install.

Pretty impressive, huh?

A single command to reset GNOME Shell settings, reset Ubuntu theme, reset the Ubuntu desktop, and more. Using this will save you from needing to hose down your home folder, create a new user account, or — worse — perform a fresh install.

Just Be Careful, Ok?

As the dconf reset command will reset more than just the Unity, GNOME Shell and MATE desktop you should not run it idly — oh, and do make a backup of your existing desktop beforehand, especially if you’ve made extensive customisations and tweaks to any of you the desktops mentioned above.

How? Run dconf dump .

Keep in mind that this command will only affect applications and desktop settings that are stored using dconf/gsettings. It will not reset other apps (e.g., Thunderbird, Google Chrome, Clementine, and so on), affect low-level settings (e.g., drivers, kernel versions, grub), nor will it reset other desktop environments (e.g., KDE Plasma).

  • Tweet
  • Post
  • Share
  • Send

Home » Pro User » How to Reset Ubuntu to Default Settings

restore command in Linux system is used for restoring files from a backup created using dump. The restore command performs the exact inverse function of dump. A full backup of a file system is being restored and subsequent incremental backups layered is being kept on top of it. Single files and directory subtrees can easily be restored from full or partial backups. Restore simply works across a network. Other arguments which need to be pass to the command are file or directory names specifying the files that need to be restored.


restore -C [-cdHklMvVy] [-b blocksize] [-D filesystem] [-f file] [-F script] [-L limit] [-s fileno] [-T directory]

Example: It will be going to print the general syntax of the command along with the various options that can be used with the restore command.

How to restore your ubuntu linux system to its previous state


  • restore -a: In -i o -x mode, restore will ask the user for the volume number on which the files needs to be extracted. The -a option simply disables this behavior and reads all the volumes starting with 1.
  • restore -c: Normally, restore will try to determine dynamically whether the dump was made out of an old or from a new format file system. The -c flag simply disables this check, and it only allows reading a dump with the method of the old format.
  • restore -d: The -d (debug) flag causes the restore to print all the debug information.
  • restore -f: This option read the backup from the file that can be a special device file like /devfffrrr5/st0, /dev/sda1 (a disk drive) etc.
  • restore -h: Extract the actual directory, rather than the files which is being referencing. This prevents the hierarchical restoration of complete subtrees from the dump.
  • restore -C: This flag allows comparison of files from a dump. Restore command reads the backup and compares it’s with the contents of files present on the disk.
  • restore -i: This flag allows the interactive restoration of files from a dump. After reading the directory information from the dump, restore command provides a shell-like interface which simply allows the user to move around the directory tree selecting files to be extracted.
  • restore -P file: Restore creates a new Quickly File Access file from an existing dump file without any kind of restoring its contents.
  • restore -R: Restore requests a particular tape of the multi-volume set to restart a full restore (see the -r flag below). This is proven useful if the restore has been interrupted.
  • restore -r: Restore a file system. The target file system needs to be made pristine with mke2fs(8), mounted, and the user cd’d into a pristine file system before starting the restoration of the initial level 0 backup.
  • restore -t: The names of the specified files are being listed if they occur on the backup. If no file argument is already given, the root directory is listed by default.
  • restore -x: The names of the files are read from the given media. If a named file matches a particular directory whose contents are on the backup and the -h flag is not specified, the directory is then recursively extracted.
  • restore -k: Uses the Kerberos authentication when contacting the remote tape server (Only available if this option was already enabled when restore was compiled).
  • restore -l: When we are doing remote restores, then assume the remote file is a regular file (instead of a tape device). If you’re supposed to be restoring a remote compressed file, then you will need to specify this option or restore will fail to access it correctly.
  • restore -m: Extracted by the inode numbers rather than by file name. This is proven useful if only a few files are being extracted, and one wants to avoid the regenerating to be completed pathname to the file.
  • restore -m: Simply enables the multi-volume feature (for reading dumps made using the -M option of dump). The name must be specified with -f which is treated as a prefix and restore tries to read in the sequence from 001, 002 etc.
  • restore -N: The -N flag causes the restore to perform a full execution as requested by one of the -i, -R, -r, t or x command without actually writing any file on the disk.
  • restore -o: The -o flag causes the restore to automatically restore the current directory permissions without asking for the operator whether he needs to do so in one of -i or -x modes.
  • restore -Q file: Use the file in order to read the tape position.
  • restore -u: Whenever certain types of files are created, restore may generate a warning diagnostic if they already exist in the target directory. To prevent this, the -u (unlink) flag can causes restore to remove the old entries before attempting to create new ones.
  • restore -v: Normally restore does his work silently under the hood. The -v (verbose) flag causes it to type the name each of file it simply treats preceded by its file type.
  • restore -V: Enables reading a multi-volume non-tape mediums like CDROMs.
  • restore -y: Do not ask for the user whether to abort the restore in the event of an error. It always tries to skip over the bad block and then continue.


    Let’s create a dump

Dump in progress.

How to restore your ubuntu linux system to its previous state
Let’s restore from the dump file

Restore under progress.

I’m a new Linux user. I’ve reinstalled my Wubi from scratch at least ten times the last few weeks because while getting the system up and running (drivers, resolution, etc.) I’ve broken something (X, grub, unknowns) and I can’t get it back to work. Especially for a newbie like me, it’s easier (and much faster) to just reinstall the whole shebang than try to troubleshoot several layers of failed “fixing” attempts.

Coming from Windows, I expect that there is some “disk image” utility that I can run to make a snapshot of my Linux install (and of the boot partition!!) before I meddle with stuff. Then, after I’ve foobar’ed my machine, I would somehow restore my machine back to that working snapshot.

What’s the Linux equivalent of Windows disk imagers like Acronis True Image or Norton Ghost?

How to restore your ubuntu linux system to its previous state

12 Answers 12

dd is the low level utility that you can use to accomplish this task. It’s essentially a low level byte-for-byte copy utility. If you want the “UNIX” way of accomplishing this, then read on.

All references to the file system and hard disks are located locally on the virtual /dev/ filesystem. There are a multitude of “nodes” in /dev/ that are interfaces to almost all the devices on your computer. For example, /dev/hda or /dev/sda would refer to the first hard drive in your system (hda vs sda depends on the hard drive), and /dev/hda1 would refer to the first partition on your hard drive.

The most straight forward way to make a raw image of your partitions is to use dd to dump the entire partition to a single file (remember the OS access the partitions /dev/sda1 through a file interface). Make sure you are on a larger partition or on a secondary drive and perform the following command:

dd if=/dev/hda1 of=./part1.image to backup(repeat for different partitions) dd if=./part1.image of=/dev/hda1 to restore

You can use the exact same command to back up the entire hard disk (replace hda1 with hda ). You can then use any compression program (gunzip, zip, bzip) to compress the file for storage. You can use this same technique to make rote copies of entire partitions to make clones of your computer.

There is one limitation though, when restoring the backup: The partition needs to be the same size (or bigger) as the partition you took the image from, so this limits your options in case of a restore. However, you can always expand the partition after you’ve restored the backup using gparted or parted . The picture gets even muddier when you are trying to restore entire disk copies. However, if you are restoring the backup to the same exact hard drive, you don’t need to worry about this at all.

However, if you want a “friendlier” utility à la Norton Ghost then this suggestion might not be for you.

I modified a .txt file and saved it. When I opened it again, I saw that I deleted one thing from the last version I saved. So I would like to know if I can recover what I deleted?

This file is very important to me. You have to help me! My life is on this file.

I didn’t delete anything, I only edited the file. When I tried to save I had get an error saying that it could not read some characters so I closed the editor and when I opened it again some lines just disappeared.

3 Answers 3

If you used GEdit and you havent disabled the backup function, then there must be a hidden file with name similar to your file but with

appended to it. So if your file name is somefile.txt then look for somefile.txt

in the same directory. This is the backup file and will give you your files state before last save.

binW’s solution is the only solution for a problem like this where you have no backup or other versioning software in place. It is a one-time rescue that may help you this one time. If you save again, that backup will be replaced and you lose anything from before that backup. I hope this works for you.

Generally speaking, if you need version control or backup, use backup or version control software. You say this is a critical file so you should treat it like one. Look at version-control tools like git or bzr and RabitVCS to tie them into the normal user interface.

But that is not enough. If this file is as critical to your existence as you suggest, please do some backups once in a while. There’s no excuse these days not to. They take (at most) an hour to set up and using tools like DropBox or Amazon S3, are extremely cheap to store quite a lot of data off-site. Take a look at the available backup tools.

Neither of these systems will provide you with complete peace of mind. You want both a VCS for short-term and long-term histories and an off-site backup for long term data integrity.

In most Ubuntu and similar Linux distributions, the systemctl tool has replaced power management commands that were used in previous releases. The following commands for instance have been replaced by systemctl as shown below :

halt → systemctl halt

poweroff → systemctl poweroff

reboot → systemctl reboot

For compatibility reasons however, the old commands are still available in the system, but it is recommended to rely on systemctl.

Shutting Down

Using ‘systemctl’ command

The systemctl tool allows users to shut down the system either immediately or at a scheduled time via a time argument. This comes in handy for scheduled maintenance for instance when users are warned that a system shutdown has been programmed. Canceling the shutdown option of systemctl might also have some advantages.

In order to shut down the system, .i.e. power off the computer, type in the following command in your terminal as root:

systemctl poweroff [linux shutdown command line]

Make sure to save your work and back-up your changed documents since this command does not prompt you to proceed.

To shut down without powering off the machine, .i.e halt the system, execute the following command as root otherwise it will ask you for the password:

Note that running either of the commands above, by default, will cause the systemd utility to send an information message to all currently logged-in users into the system. In order to avoid the sending of this message by systemd, execute the command with the –no-wall switch as follows :

systemctl –no-wall poweroff

Using ‘shutdown’ command

The shutdown command has the following syntax :


  • Options – Shutdown options like power-off (default), halt or reboot the system.
  • Time – The time argument indicates when the shutdown process will occur.
  • Message – This specifies the message which will be sent to all logged-in users.

In order to power off the machine and therefore shut down the system at a specific time, run the command below as root:

shutdown –poweroff hh:mm

Where hh:mm is a placeholder for the time (in 24 hour format) at which you would want to shut down the system. See example in the snapshot below :

The file /run/nologin is created by systemd few minutes before the shutdown event in order to prevent other users from logging in.

In order to halt or shut down the system after a specific delay, run the following command as root:

shutdown –halt +m

Where +m designate the delay time in minutes. An example of a scheduled shutdown is shown below :

You could set the +m to the ‘now’ keyword which means an immediate shutdown will be performed as shown below :

I had to press Cancel on the authentication window in order not to shut down.

In order to cancel a pending shutdown , run the command below as root:

It is not possible to specify a time argument when canceling a scheduled shutdown. It is however possible to still send a message to all logged-in users by invoking the command :

sudo shutdown -c “system back to normal – canceling the reboot”

You could also perform a scheduled shutdown using the -h option as follows :

This will shutdown the system after 60 minutes.

Restarting the System

Using ‘systemctl’ command

Restarting the system is achieved by the following Ubuntu restart command :

systemctl reboot [restart ubuntu command line]

This command, by default, causes the systemd tool to send a friendly message to all currently logged in users into the system. In order to prevent the broadcasting of this message, invoke the command with the –no-wall switch as follows:

systemctl –no-wall reboot

Using ‘shutdown’ command

Using the shutdown command, rebooting can be achieved via the following command :

It is also possible to specify a time argument as well as a custom message like the following command shows:

shutdown -r +20 “Garbage collection”

This will cause the system to be rebooted after 20 minutes and also broadcast the informative message “Garbage collection” .

Suspending the System

In order to suspend the system, type in the command below as root:

systemctl suspend [linux suspend]

The suspension command, will enable the current system state (complete context) to be saved on the RAM. The RAM, will not be powered off unlike most of the devices in the computer. Once the machine is turned on, the state saved on the RAM will be restored automatically. This operation is much faster than restoring the state from hibernation since the system state was not saved on the hard disk. A suspended system is prone to power outages however since the system state is on the RAM.

Hibernating the System

Hibernating the system can be carried out using the following command :

systemctl hibernate [linux hibernate]

Contrary to the suspension operation, the command above will save the system state on the hard disk and not on the RAM, before powering off the computer.

The system will be restored to its previous state once the machine is turned back on.

Since the system state is not saved on the RAM, but rather on the hard disk, a power outage will not have any consequences on the data availability, i.e. data loss will not occur unless the hard disk is damaged. If the hard disk is not an SSD, the drawback would be a slow data restoration operation.

In order to both hibernate and also suspend the system, execute the following command as root:


The ‘systemctl’ and the ‘shutdown’ commands allow you to power-off, halt, reboot, suspend and hibernate your Linux system. To learn more about these commands, feel free to visit their respective ‘man’ pages.

If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.

This tutorial helps you to reset Gnome Desktop settings to its original state on an Ubuntu 18.04 LTS Linux system.

Login to your Ubuntu 18.04 Bionic Desktop system and follow the instructions given below. After that reboot your system to complete the steps.

Reset Gnome Desktop on Ubuntu 18.04

First, open the Tweaks settings on your system. To open tweak settings search for the string “Tweaks” or “GNOME Tweaks” on your system. You will see an option with the icon like below screenshot.

Click the icon to launch settings.

How to restore your ubuntu linux system to its previous state

Open the drop-down of Tweaks menu at the top bar of your Desktop. You will get an option “Reset to defaults” and click on it.

How to restore your ubuntu linux system to its previous state

This will prompt for the final confirmation to complete Gnome reset to its original settings. Click the OK button to complete your task. This will take a few seconds to complete.

How to restore your ubuntu linux system to its previous state

After completion, this will show a message on the screen with a successful message and ask you to reboot the system to complete this operation. Just restart your system and login again.

Your submission was sent successfully! Close

1. Getting started

Running Ubuntu directly from either a USB stick or a DVD is a quick and easy way to experience how Ubuntu works for you, and how it works with your hardware. Most importantly, it doesn’t alter your computer’s configuration in any way, and a simple restart without the USB stick or DVD is all that’s needed to restore your machine to its previous state.

With a live Ubuntu, you can do almost anything you can from an installed Ubuntu:

  • Safely browse the internet without storing any history or cookie data
  • Access files and edit files stored on your computer or USB stick
  • Create new office suite documents and save them remotely
  • Fix broken configurations to get a computer running again


All you need is either a USB stick or DVD with Ubuntu pre-installed. For instructions on how to create these, take a look at one of the following tutorials:

  • Create a bootable USB stick on Windows, Ubuntu or macOS
  • Burn a DVD on Windows, Ubuntu or macOS

How to restore your ubuntu linux system to its previous state

2. Boot from DVD

It’s easy to boot Ubuntu from a DVD. Here’s what you need to do:

  1. Put the Ubuntu DVD into your optical/DVD drive.
  2. Restart your computer.

A few moments later you’ll see the language selection menu followed by Ubuntu’s boot options. Select the top entry, Try Ubuntu without installing, and press return.

If you don’t get this menu, take a look at the community DVD guide for help.

How to restore your ubuntu linux system to its previous state

3. Boot from USB flash drive

Most computers will boot from USB automatically:

  1. Insert the USB flash drive
  2. Restart your computer

You should see the same language selection menu and boot options we saw in the previous ‘Boot from DVD’ step. Select the top entry, Try Ubuntu without installing, and press return.

If your computer doesn’t automatically boot from USB, try holding F12 when your computer first starts. With most machines, this will allow you to select the USB device from a system-specific boot menu.

F12 is the most common key for bringing up your system’s boot menu, but both Escape and F2 are typical alternatives. If you’re unsure, look for a brief message when your system starts – this will often inform you of which key to press to bring up the boot menu.

4. Choose your preferred language

After the desktop has loaded, you’ll see the welcome window. From here, you can select your language from a list on the left and choose between either installing Ubuntu directly, or trying the desktop first. Select Try Ubuntu to launch into the full desktop experience.

How to restore your ubuntu linux system to its previous state

5. Enjoy Ubuntu

Your live desktop will appear. Have a look around, check out the new features, and enjoy the simplicity of Ubuntu’s intuitive interface.

You can still choose to install Ubuntu after passing the Welcome pane by clicking on the Install Ubuntu icon on the desktop background.

How to restore your ubuntu linux system to its previous state

Finding help

Finally, if you get stuck, help is always at hand:

How to restore your ubuntu linux system to its previous state

Ubuntu’s support for ZFS isn’t new in the 20.04 LTS version. What is new is how easy it is to use one of ZFS’s most essential features – snapshots. Thanks to snapshots, you can revert your operating system to an earlier state before any problems occurred. Learn here how to use ZFS snapshots in Ubuntu 20.04.

Install with ZFS

To be able to use ZFS’s features, you must also be using ZFS. This means that during Ubuntu’s installation, during the “Installation type” step, instead of going with the default “Erase disk and install Ubuntu,” you should click on “Advanced features … “

How to restore your ubuntu linux system to its previous state

In the window that pops up, select “EXPERIMENTAL: Erase disk and use ZFS” and click OK.

How to restore your ubuntu linux system to its previous state

With “ZFS selected” showing next to “Advanced features … “, you can proceed with the rest of the installation as usual.

How to restore your ubuntu linux system to its previous state

Automatic Snapshots

With Ubuntu 20.04, you don’t have to do anything to take advantage of ZFS’s snapshot feature. You may notice the feature in action when installing new packages in your favorite terminal, creating symlinks to alternate versions of files, and updating the GRUB menu.

How to restore your ubuntu linux system to its previous state

When you do need them, though, to revert your system to an earlier state, they’ll be there for you. Let’s do a test run. Install a package you’d like to try with:

After you’ve tried your new package, you can uninstall it again with apt. For this tutorial, though, you’ll see in the steps that follow how you can revert your whole system to the point before its installation.

Restoring to an Earlier State

Whenever you decide you want to revert your file system to an earlier state, do a restart. After the initial boot screen, you will have to press a different key to access GRUB, depending on your computer’s firmware.

If your computer uses BIOS, you have to keep the Shift key pressed. If it uses UEFI, you must hit Escape after the initial system boot but before the operating system starts loading.

How to restore your ubuntu linux system to its previous state

Move to the third entry, “History for Ubuntu 20.04 LTS,” and press Enter.

How to restore your ubuntu linux system to its previous state

Choose the snapshot you want to revert to from the list that appears.

How to restore your ubuntu linux system to its previous state

Choose if you want to revert only the system files to an earlier state, but keep your personal data intact, or if you’d like to turn back time on everything.

How to restore your ubuntu linux system to its previous state

Wait a while for the different versions of files to “remap” in the filesystem. When you next enter your desktop, it will be back to where you left it before the selected snapshot.

Do you like the ZFS snapshots feature in Ubuntu 20.04? Or do you prefer using a combination of Ext4 and a backup tool with similar functionality? Tell us in the comments section below.

Our latest tutorials delivered straight to your inbox

Your submission was sent successfully! Close

1. Overview

In this tutorial we cover device recovery fundamentals on Ubuntu Core and show you how to use the different recovery modes offered by Ubuntu Core for restoring a device to a safe system.

Bear in mind, Ubuntu Core is production-friendly, not necessarily developer-friendly. We recommend you use Ubuntu Core for “fire and forget” purposes where you won’t want to iterate on the software.

With Ubuntu Core, you are able to execute remote updates and patches for your appliances and devices, but for development and prototyping, we recommend Ubuntu Server. Let’s start!

What you’ll learn

  1. Recovery mode fundamentals
  2. How to use recovery mode

What you’ll need

  • A device with an installed and configured Ubuntu Core image
  • A monitor with HDMI interface
  • An HDMI cable
  • A keyboard

2. Understanding Recovery Mode

Ubuntu Core 20 is inherently robust. But if data-corruption issues do occur, either on boot or on data partitions, Ubuntu Core can still access recovery mode to help repair, restore or reinstall on an impaired device.

The following booting modes are currently available on boot:

  • Run mode: Normal boot mode
  • Recovery mode: reboot into recovery mode for maintenance or repairing the system
  • Reinstall mode: initialise the device from an onboard system image

These functions can be used with any of the following methods:

  • Recovery hidden menu on boot
  • Snap reboot command from console
  • Snapd REST API

After a clean Ubuntu Core installation, a first recovery system is created so that it is possible to recreate a clean factory system at any time with the Reinstall mode.

Run mode

When booting in run mode, the device attempts to boot normally, with no option to recover or reinstall the system.

Recovery mode

In recovery mode, the device boots to a temporary system and operates as it would from a pristine initial installation, including its snaps. This allows you to log in to the system using prior credentials to recover your data, either via SSH or locally after setting up a password for the user.

Modifications done to the system during recovery mode are temporary and are lost once the device is rebooted.

Reinstall mode

In reinstall mode, all existing user data on the device is removed and the device is initialised from the recovery system image.

The full process of installation and configuration is followed in a similar way to a first boot after Ubuntu Core installation.

3. Using recovery hidden boot menu

Accessing recovery hidden boot menu

If you prefer to recover the system when booting or if the system is no longer accessible via the network, you can use the recovery hidden menu:

Start or reboot the device with the ‘1’ key held on a connected keyboard. In some systems or with some keyboards it is necessary to press the key repeatedly.

After the initial boot process completes, a status screen appears to show “System mode selection triggered. Proceed to select one of the available systems and actions.”. Press OK.

How to restore your ubuntu linux system to its previous state

On the next screen, select with TAB or cursor keys the desired action and press ENTER.

How to restore your ubuntu linux system to its previous state

A message indicating the selected mode is displayed. Press CONFIRM to proceed.

How to restore your ubuntu linux system to its previous state

If “Run normally” has been selected, the system boots in run mode.

If “Recover” has been selected, the system boots in recovery mode.

If “Reinstall” has been selected, the system boots in reinstall mode.

4. Using console

SSH in

First you have to log into your device using SSH. Run the ssh command which will be something like:

And you should be welcome to Ubuntu Core:

How to restore your ubuntu linux system to its previous state

Listing recovery points

Once you are in the device console, you can check the list of recovery systems that can be used for recovering.

Which should show a list of labels like this

Recovery mode from console

The snap reboot command allows you to boot in the different booting modes (run, recovery, install) from the console. The procedure is as simple as just typing the following command:

The system shows a message on the console indicating that it is going to reboot with the system indicated in the label.

How to restore your ubuntu linux system to its previous state

This process takes some time. The device will be accessible via SSH but the snaps take some time to install and update.

You can check by running the command “snap list” until the full list of packages is up to date.

How to restore your ubuntu linux system to its previous state

5. Using Recovery mode

Once the system has booted in recovery mode, you can access via SSH with your prior credentials, and have a clean system where the desired maintenance action can be performed.

For exiting recovery mode, you can use any of the following options:

  • Enter the following command
  • Power off and on the system

Either method returns the system to run mode, and all changes done to the temporary system are lost.

Alternatively, if a normal reboot is done with the command sudo reboot , the system eventually stops on the next boot showing the ‘Recovery chooser’ menu, so this method is not recommended.

6. Wrapping up

Ubuntu Core offers the ability to repair, recover or reinstall the system, should any corruption happen to the device. Recovery modes described in this tutorial guarantee that the system can always be restored to a safe or known state.

How to restore your ubuntu linux system to its previous state

We recently published an article on how to backup and restore a Google Chrome profile on Linux, now, our concentration is on Firefox.

Like I did in the Chrome article, I’ll list the steps required to backup and restore your Firefox Profile. The listed commands are for you to copy and paste in your terminal after you may have edited them to suit your needs e.g. your preferred directory path. None of the terminal commands requires root access.

A backup of your Firefox profile enables you to save all your browser data (extensions, history, settings, etc.) on your local machine or any other storage medium so that you can restore it at a later time in case of a system failure, fresh installation, or migration. What’s cool about this method is that you don’t need to be connected to the Internet.

Firefox Profile Backup

1. Launch your terminal and navigate to the

/.mozilla directory from your home folder with the following command.

2. Use tar command to compress your entire

/.mozilla directory into a GZip archive with the following command.

3. Once the compression is complete, move the archive file to any safe location of your choosing. This time around, let’s move the archive to the desktop folder.

That’s it. You can now back the profile archive to secondary storage devices or your preferred cloud service to restore it whenever.

Firefox Profile Restore

1. Remove entire Mozilla’s configuration directory.

2. Next, unzip the

/.mozilla folder in your home directory with the following command:

Now you can run Firefox with all of your bookmarks, history, extensions, etc. back in place.

Encrypt Firefox Profile Backup

You already know by now that it is important to back up your profile with encryption because it restricts your data to you and users with the key as the file will be virtually useless to anyone without the rights to decrypt the archive.

It takes a couple more steps to complete but we can easily complete them with GnuPG. If it’s not installed, you can install it using following command.

After you have created the backup, enter the following terminal command from the directory containing the backup.

Enter a secure password when gpg -c prompts you for one. Once done with the encryption, save the firefox-browser-profile.tar.bz2.gpg file and delete the unprotected firefox-browser-profile.tar.bz2 file.

You can decrypt the archive at any time with:

Do you have any comments or questions to contribute? Drop them below in the comments section.

How to restore your ubuntu linux system to its previous state

Sometimes things go wrong, even on Linux systems, and you need a way to get your computer back to full functionality. On Windows, Safe Mode is usually the first choice to get back in and fix a problem. However, on Linux, there really isn’t a direct counterpart.

On most Linux distributions i, the solution involves using a Live CD to access files on your hard drive or even using a chroot. Ubuntu has come up with a clever solution in recovery mode. It lets you perform several key recovery tasks, including booting into a root terminal to give you full access to fix your computer.

Note: this will only work on Ubuntu, Mint, and other Ubuntu-related distributions.

Also read: How to Use the ps Command in Linux to Kill Process

Boot to Recovery Mode in Ubuntu

As you’re booting your computer, wait for the manufacturer logo to flash from the BIOS. If your computer boots too quickly, you’re going to need to do this immediately after powering it on. Quickly press either the Shift or Escape key. On newer computers, it’s probably Escape . The timing has to be near perfect on some computers, so you may have to press it repeatedly. If you miss the window, reboot and try again.

How to restore your ubuntu linux system to its previous state

With any luck, you’ll arrive at Ubuntu’s GRUB boot menu. Just below your regular boot option, you’ll see an entry for “Advanced Options.” Select it and press Enter.

How to restore your ubuntu linux system to its previous state

GRUB will take you to a new menu. Toward the bottom you’ll see one of the entries with “Recovery” listed in parentheses.

How to restore your ubuntu linux system to its previous state

You’ll arrive on a simple screen with a blue background and a box containing a series of recovery options. This is the main recovery menu for Ubuntu; it allows you to do many of the common tasks required to fix a broken system.

Understanding Recovery Options

As you can tell, you now have seven options to help recover Ubuntu. Depending on the issue you’re facing, you’ll want to choose the right one for your needs.

Each option does the following:

  • Resume – If you somehow got to this menu accidentally, just use “resume” to continue booting normally.
  • Clean – If you’re have space issues, opt for the “clean” option. It helps you free up valuable space to avoid a variety of system glitches.
  • Dpkg – If you’re installing a new package and something went wrong, it can cause Ubuntu not to work properly. Use “dpkg” to try to repair any broken packages.
  • Fsck º While it won’t always work, “fsck” is useful in troubleshooting hard drive issues. You can also use it to configure graphics drivers. If you suspect your hard drive may be corrupted or failing, use this tool.
  • Grub – This is used just to automatically update the installed Grub bootloader.
  • Network – If you’re having network issues, use the “network” option to help set things up again. Since networking is usually disabled unless you manually set it up, this can help with the process.
  • Root – This is for more advanced troubleshooting. As you may notice, the Recovery Menu opens the system in a read-only state. The root tool helps you get write access (more on that below).
  • System-summary – Get a basic overview of your system. In most cases, this isn’t the most useful option unless you want to ensure Ubuntu is recognizing different parts of your system.

The Root Terminal

How to restore your ubuntu linux system to its previous state

Many problems can only be solved as root, and they require more manual intervention than what the default options in the recovery menu provide. When it looks like you’re dealing with one of these cases, select “Drop to root shell prompt” to boot into a root terminal.

How to restore your ubuntu linux system to its previous state

As soon as you select it, you’ll see the bottom of your screen switch to a terminal and log in as root. Before you can do much, you’re going to need to remount the root partition of your drive. By default, it’s mounted read-only for safety purposes, but you’ll probably need to modify something to fix whatever issue’s going on. To remount it with write permissions, run the following command.

If you have additional partitions you need to work on, you’ll need to remount them as well. That includes when your “/home” directory is on a separate partition. You can remount them all at once simply with:

Now you’re ready to dig around in your system and resolve the problem that’s preventing you from booting normally. You’ll have access to everything on your system as root, so be careful not to damage anything in the process. Making backups, even just copies of the files you modify, is a great idea. Once you’ve uncovered and remedied the problem, reboot your system and boot normally.

Can’t Access GRUB Boot Menu

If for any reason you can’t access Ubuntu’s GRUB boot menu, you won’t be able to boot into recovery mode in Ubuntu. This usually means the bootloader and/or your Ubuntu system has been corrupted somehow. The easiest solution is to reinstall Ubuntu using a Live CD. There are a variety of reasons to have a Live CD on hand, and this is just one of them.

This method allows you to usually keep your files (as long as the hard drive isn’t corrupted beyond use). Plus, you’ll be able to repair whatever is going on with a fresh installation.

In most cases, booting into recovery mode in Ubuntu should be your first step for troubleshooting many issues you encounter. And, hopefully, you won’t need to reinstall Ubuntu at all.

Our latest tutorials delivered straight to your inbox


Learn how to enable the SysRq functions, and how to use invoke them by using command keys.


  • Root permissions
  • Linux Kernel compiled with the “CONFIG_MAGIC_SYSRQ” option enabled


  • # – requires given linux commands to be executed with root privileges either
    directly as a root user or by use of sudo command
  • $ – requires given linux commands to be executed as a regular non-privileged user


The SysRq key combination can be used to send commands directly to the Linux kernel in some specific circumstances: the kernel will respond to commands sent with command keys immediately, unless it is completely locked. Various command keys achieve specific tasks, and they can be combined to restore the system to a safe state, or to obtain a clean reboot when nothing else works: this is what we can obtain with the reisub sequence.

In this tutorial we will see how to enable all SysRq functions using a standard installation of Ubuntu 18.04 – Bionic Beaver as a base.

The SysRq magic key

The SysRq key combination consists of three keys to be pressed together: ALT + SysRq + command key . You may be wondering what is the SysRq key on your keyboard. Assuming you are using a QWERTY keyboard, the SysRq key corresponds to the print key.

Finally, a command key is a key on the keyboard that when pressed on this special mode, will immediately send a command to the kernel. We will see some of these keys and the functions associated with them in a moment, but before proceeding we must be sure that the kernel we are using has been compiled with the needed option enabled.

The CONFIG_MAGIC_SYSRQ kernel option

As said above, for the SysRq key combination to work, the kernel must have been built with the CONFIG_MAGIC_SYSRQ option enabled. This is usually the case in all major distributions, nonetheless it can be useful to know how to check its state. Here is how we can do it. The first thing we want to know is the version and the name of the kernel we are using. Obtaining this information is very easy, we just run:

As you probably know, the uname command is used to retrieve some system information. In this case we used it with the -r flag, as we only wanted to know about the kernel release .The result of the command has been 4.13.0-25-generic : that is the name of the kernel used by our system. We can now look inside the /boot directory for the corresponding configuration file: this file contains all the options the kernel has been compiled with. We can search for the value used for CONFIG_MAGIC_SYSRQ in it:

As expected the file is present: config- is what we are looking for. We now have everything we need, let’s do the check:

As you can see in the first line, the option CONFIG_MAGIC_SYSRQ has y as its value, meaning that it was set as built-in when the kernel was configured. What does the other lines stands for? The CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE option does specify the default functions enabled: the value is expressed in hexadecimal form, in this case 0x01b6 which does correspond to 438 in decimal form.

As we will see later in this tutorial, this value means that most of the functionalities are enabled by default. However most distributions disable their invocation via key combination for for security reasons. The third option is not very important for us now: it is about enabling the SysRq key over serial.

Checking the current SysRq value

The majority of distributions disable the access to some of SysRq functions via key combinations for security reasons (all functionalities are however always available if invoked via /proc/sysrq-trigger with root privileges). To check what are the available functions in our system we can just run:

The command returned a value of 176 . How this value is obtained, and what does it stands for? Every value corresponds to a certain function, As you can see in the list below:

While a value of 0 disables all SysRq functions and a value of 1 enables all of them, providing values bigger than 1, we can enable the specific ones. As verified above, we have a SysRq value of 176 . This is obtained from the sum of 128 (which allows reboot and poweroff) + 32 (ability to remount filesystems in read-only mode) + 16 , which enables sync command. In the same way, the value of 438 is obtained from the sum of 2 + 4 + 16 + 32 + 128 + 256, so all the corresponding functions are enabled.

How to change the SysRq value

We now know what the SysRq value is, but how can we change it? To immediately change this value we just have to write the wanted one to the /proc/sys/kernel/sysrq file, by running:

This way, the change will be immediately effective but it will not survive a reboot. How to make it persistent? That is very simple. A generic solution, which works in all linux distributions, is to put the value of kernel.sysrq in the /etc/sysctl.d/99-sysctl.conf file:

Please notice how we used the >> redirection operator: this will append the text to the file and will not override other settings it could already contain.

The reisub sequence

Of all command key sequences, reisub is probably the most famous. To better remember this sequence, it is often used as an acronym for “raising elephants is so utterly boring”. What does this sequence accomplishes? Holding alt+sysrq key , we proceed pressing the command keys in sequence, and this is what happens:

First of all r switches the keyboard from raw to XLATE mode, then, e sends a SIGTERM signal to all processes, so that they can be closed in a graceful way if possibile. After that we send a SIGKILL signal by pressing i , to terminate remaining process which didn’t respond to the previous signal. With s we try to sync all mounted filesystems and flush all changes from cache to the disk immediately. By using u we remount all filesystems in read only mode, and finally by pressing b , we perform a system reboot.

The reisub sequence can be used in certain situations when the system becomes very unresponsive, and other solutions are not enough to fix things. The command keys composing this sequence are, however, only a subset of the available ones: for a complete list, you can take a look at the SysRq kernel documentation.

When the updated kernel won’t let you use your computer, it’s time to downgrade.

How to restore your ubuntu linux system to its previous state

Linux lives and dies by the kernel. If you’re familiar with how GNU/Linux works, Linux is the kernel. Everything else is just tools that interface with it. These tools let you get actual work done, but they couldn’t do a thing without the kernel.

The kernel of an operating system is kind of like your cardiovascular system. You tend to forget about it until something goes wrong. It isn’t all that often, but kernel upgrades can and do go wrong. When the updated kernel won’t let you use your computer, it’s time to downgrade.

Also read: How to Build and Install a Custom Kernel on Ubuntu

Boot into an Older Kernel

The good news if you’ve recently updated your kernel is that this process almost never gets rid of the old kernel. The only case where that may happen is if you immediately uninstalled the older kernel, which isn’t a great idea.

To boot into an older computer, you’ll need to restart your computer. When the computer loads GRUB, you may need to hit a key to select non-standard options. On some systems, the older kernels will be shown here, while on Ubuntu, you’ll need to select “Advanced options for Ubuntu” to find older kernels.

Once you select the older kernel, you’ll boot into your system. Everything should work as it used to. If you’re still having trouble, the kernel may not be the issue.

Remove the Problem Kernel

If you’ve booted into your computer and everything is working as intended, the upgraded kernel is likely the problem. You could technically just do this every time you boot your computer, but it makes more sense to remove the problematic kernel.

How to restore your ubuntu linux system to its previous state

You can do this using your distribution’s package management tools. This is going to differ based on the system you’re using. You’ll also need to know the version of the kernel you want to remove. This can be found during bootup at the GRUB screen. For Ubuntu and other apt-based distributions, you can use a command like the following:

You’ll need to replace VERSION above with the exact version number of the problem kernel you’re looking to remove. If you just wish to hold them back for a time, you can use the following command:

How to restore your ubuntu linux system to its previous state

Avoiding Future Issues

One of the easiest ways to avoid this type of problem is to avoid updating right away. This will give you a chance to see whether any reports of users having kernel trouble will pop up. You should especially keep an eye out for users with similar hardware to you.

If stability is key to you, you can also opt to use LTS distributions. These update less frequently, aside from security updates. This means you can count on these being more stable than your average distro.

Frequently Asked Questions

Will downgrading my kernel break anything?

When you’re dealing with such a core part of the operating system, this is always a possibility. That said, if you’ve only upgraded, reverting back to an older kernel shouldn’t cause too many problems.

Drivers and other software that interfaces directly with the kernel may have errors. If the older versions of this software have been removed or updated, you may need to downgrade this as well.

Can I tell if a kernel update is going to work on my system?

As mentioned above, it’s always handy to check user reports before undertaking a major upgrade. Make sure to look at user forums based on the Linux distribution you use to see if there are any users experiencing major problems. If you see a significant number of users having issues, you may want to wait until they’re resolved before you upgrade.

How can I check the installed kernels on my system?

There are multiple commands to see which kernels are installed, depending on the Linux distribution you’re running. The following will work on most versions:

On Arch Linux and distributions based on Arch, you can use the following:

On Ubuntu, Debian, and systems based on either of them, you can use the command below:

On Red Hat, Fedora, and other similar distributions, you can use the command below:

This isn’t an exhaustive list, but it covers a fair number of distributions. If you use another distribution, check the documentation.

How can I tell which kernel I’m currently using?

You can accomplish this with a simple command. Open a terminal and type the following command.

You’ll see a string with the version information of the running kernel. It will look something like this:

A Look Under the Hood

While downgrading is the easiest way to deal with kernel-related issues, it isn’t the only way. The kernel isn’t the only part of the system that can cause problems with booting up. If your system won’t start, it can be incredibly frustrating.

Searching the internet for your problems can be useful, but it helps if you understand what’s going on under the hood, so to speak. To get a better idea about what’s happening when you start your system, check out our guide to understanding the Linux boot process.

Our latest tutorials delivered straight to your inbox