The Ubuntu operating system comes with a “recovery mode.” With this feature, users can access the command-line of a broken system, fix a misconfigured file, test if system memory isn’t working, and a lot more. Although “recovery mode” exists, a lot of Ubuntu Linux users are unfamiliar with how it works, and what they can do with it. So, in this guide, we’ll walk you through how to use recovery mode on Ubuntu.
Note: to access the recovery mode on Ubuntu Linux, you must be running the Grub bootloader. If you’re using an alternative bootloader, there’s a chance this feature will not be accessible for you.
Recovery mode on Linux
Recovery mode is an option in the Grub boot-loader. So, to access it, reboot your Linux PC. The process of restarting on Ubuntu is quickly done in many different ways, including clicking the “Reboot” option on your desktop, pressing the hard-reset button on the PC itself, or using the reboot or systemctl reboot commands in a terminal window.
Or, if your operating system disallows the ability to access reboot, run:
sudo systemctl reboot
When your Ubuntu PC restarts, the Grub bootloader will appear on screen, with several options. On a majority of Linux operating systems, you’ll see quite a few entries. These entries include:
- The latest release of the Ubuntu Linux kernel for your OS (default entry)
- Advanced booting options for your Linux OS (often called Advanced options for Ubuntu)
- Memory test (memtest86+)
- Memory test (memtest86+, serial console 115200)
Look through the selection menu for the “Advanced options” entry. Then, once you’ve located it, use the Down Arrow to move the selection to it. Then, press Enter to access the “Advanced options” sub-menu in the Grub bootloader.
Inside of the “Advanced options” sub-menu, a couple of options will appear on the list. At the top of it, the last kernel that your operating system was using before it was updated to the one you’re using now will be there (though not every Linux OS does this). Following the fall-back kernel, there is a “recovery” kernel.
The “recovery” kernel is a normal Linux kernel, with a minor Grub tweak that allows users to quickly boot into “Recovery mode” on their system, so that they may access the command-line to fix something, and recover a broken system.
To load up the “recovery” kernel through Grub, press the Down Arrow and move the Grub selector to the top of it. After that, hit the Enter key to force the system to load it up.
Once you’ve chosen the “recovery” kernel in the Grub menu, you’ll see a window labeled “Recovery Menu.” In this menu, there are several tools and options that you’ll have access to.
For information on how to use each of these recovery options, follow along below.
Recovery Mode – Clean
The “Clean” feature in Recovery Mode for Ubuntu will allow you to free up space on your system partition quickly.
To use the “Clean” feature, load up Recovery Mode. Then, use the Down Arrow to highlight the “clean” option and press Enter.
After pressing the Enter key on “clean,” a terminal window will appear. Follow the instructions on screen, and Ubuntu will do it’s best to make some free space.
Recovery Mode – Dpkg
The “Dpkg” option available to Ubuntu users in Recovery Mode allows for the ability to fix and uninstall any potentially broken packages that are causing problems on your system.
Note: this feature requires internet connectivity. Select “Network” in the Recovery Mode list to get online before attempting to use it.
To use it look, through the Recovery Mode list for “Dpkg” using the Down Arrow. Then, press Enter to start it up. Read the on-screen prompts and allow Ubuntu to purge any problematic packages.
Recovery Mode – Fsck
The Fsck feature in Recovery Mode can quickly fix a corrupted hard drive by scanning it for dirty bytes and removing them. This feature is very useful, as dirty bytes on drives can cause Ubuntu to fail to load.
To use the “Fsck,” highlight it in the Recovery Mode menu using Down Arrow, then press Enter to start it up. After that, sit back and let it remove corrupted data, automatically.
Recovery Mode – Grub
“Grub” in the Recovery Mode window lets Ubuntu scan your system and update the bootloader automatically, by re-setting the Grub system.
To run a bootloader update, find “Grub” in the menu and select it with the Down Arrow. Press the Enter key to start the update.
Recovery Mode – Root
Sometimes, your Ubuntu Linux system may refuse to boot, due to a misconfiguration, system error, etc. If the other recovery options we talked about don’t do it, the “Root” one will.
To gain Root access through Recovery Mode, you won’t need to remember the password. Instead, select “Root,” with Down Arrow, followed by Enter, then Enter a second time.