Ubuntu Recovery Mode

If our computer fails to boot for any reason, it might be helpful for booting it into recovery mode. This mode loads a few common services and drops us into the command line mode. Then, we are logged in as the superuser (root) and can repair our system with the help of the command line tools. We can still use our installation CD if the 'booting into recovery mode' option doesn't work.

Ubuntu Core is robust inherently. But if data corruption problems occur, even on data partitions or boot, it can still use a recovery mode to aid reinstall, restore, or repair a damaged device.

The recovery modes can be used in three manners:

  • Boot into the system mode selection mode
    Reboot or start this device using the '1' key held over a connected keyboard.
  • Snapd REST API
    Apply the REST API for calling either the reboot, factory-reset, install, or recover functions.
  • Snap reboot
    Execute snap reboot on the system with either --install or --recover arguments.

Note: On Ubuntu Linux, we must be using the Grub boot-loader for accessing the recovery mode. If we are using any other bootloader, there is a chance that this aspect will not be available for us.

Ubuntu Boot into Recovery Mode

All devices provide the Recovery Mode aspect which includes the capability to implement several operations. These operations contain junk data cleaning, update installations, device reset, backup, and data restoration.

Similarly, we have the accessibility of the aspect, i.e., Recovery Mode as well in Linux distributions. It permits the user to restart the system and bring it with a fresh setup.

We may require the recovery mode aspect in the system at any time. There can be several possibilities, i.e., if we see any glitch, it fails to begin for any reason, or when the system slows down, it means that our system requires recovery. Also, we can recover some broken files and inspect when the memory is correctly working or not.

  • We will access the option, i.e., Grub boot-loader for getting the recovery mode feature. We need to restart our system to get the Grub menu.
  • To do so, we can either reboot the Ubuntu machine or enter the following command inside the terminal window:
    $ sudo reboot
  • The system will reboot after entering the password. We need to quickly click the "Esc" button for getting a Grub menu; when BIOS loading has completed, a group menu window will appear with some options as displayed in the following screenshot:
    Ubuntu Recovery Mode
  • We need to choose the option, i.e., "Advanced Options for Ubuntu" from the menu by using the arrow keys and clicking on the "Enter" button:
    Ubuntu Recovery Mode
  • We will have the sub-menu window of the entry, i.e., "Advanced Options for Ubuntu" after selecting.
  • We will use the arrow keys for navigating to the "Ubuntu, with Linux 5.8.0-50-generic (recovery mode)" and click the "Enter" button.
  • This recovery mode permits the user to transform the boot system in the recovery mode to quickly resolve issues.
  • Inside the recovery mode, we will see many options. We need to choose the option according to the problem we are facing.
    Ubuntu Recovery Mode

Let's explain all options that might aid us to choose:

  • Resume- When we select this option, we will exit from the recovery mode. It permits the system to again boot.
  • Clean- This option will aid us to free up space through the system. The clean option will aid in getting free space if the storage of the system is going to end.
  • Dpkg- We need to choose the dpkg option if the package we installed fails and would not permit the system to properly work. Moreover, if we have broken packages inside the system, this option will add resolve it.
  • Fsck- It is used for the graphics driver's configuration, or it might aid if our hard drive is corrupted.
  • Grub- We can use this option for updating the Grub boot loader. The Grub option will scan our system and automatically upgrade the Grub boot loader.
  • Network- It aids to activate networking which is by default deactivated in the computer.
  • Root- The system sometimes fails to boot because of a few errors. The "root" option is used for this purpose. It permits the system to start the write mode and fix the problems with the help of the commands.

The below booting modes are available on boot:

Ubuntu Recovery Mode
  • Run mode: It is a normal mode of the boot. The device tries to normally boot with no option for reinstalling or recovering the system when booting in this mode.
  • Recovery mode: It reboots into recovery mode for repairing or maintenance of the computer. The device starts a temporary system and implements it as it will from a pristine starting installation such as its snaps in recovery mode. It permits us to log into the system with prior credentials for recovering our data, either locally or via SSH after setting up the user password. At the time of recovery mode, changes done to the system are temporary and can be lost when the device is restarted.
  • Reinstall mode: It starts the device through an onboard system image. In reinstall mode, every existing user data over the device is deleted and the device is started from the system image of recovery. The complete configuration and installation process is pursued in the same way as the initial boot after the installation of Ubuntu Core.

Benefits of Recovery Mode

Ubuntu Recovery Mode

Avoid Annoyance and Costs

In the field, having to repair manually an IoT device often can increase the device cost itself. Dispatching any operator to a remote location for performing maintenance or intervention may illustrate some significant costs, relying on the device's accessibility and distance to the site. The final downtime may illustrate some extra losses, even more so when the device is mission-critical. A liable device recovery system is necessary to add ignore these annoyances and costs.

Low touch system maintenance

In the field, device recovery must be low touch. The IoT devices might be expanded at a very big scale with several devices. The maintenance operations turn into a significant cost driver at this scale. Remote and automation access is essential for low touch maintenance. Repetitive and basic maintenance tasks can be autonomously performed by the operating system. It frees up the operators of the device from implementing easy maintenance actions repeatedly on many devices which saves time.

Only complicated maintenance tasks need to be mounted on the device operators while doing it. Allowing device operators along with remove access to implement complicated software-related actions of maintenance, ignored substantial costs and permits every device within the field to be centrally maintained- decreasing the risks.

Snapshots

More than one snapshot for a similar device could be backed up inside the recovery system. The snapshots reflect both snap collection and configuration settings installed in the system. The device operators can save, name, and create such snapshots within the recovery system. It enables the desired system state swift recovery when required. Recovery can manually happen from a dedicated UI or by an API call remotely.

Reinstalling Ubuntu while keeping Programs and Files

We can still boot up an Ubuntu USB drive or live CD if there is an issue with our installed Ubuntu system. We need to boot to live media and begin installing the Ubuntu system. Ubuntu should search our previous installation and provide us an option, i.e., "Reinstall Ubuntu".

  • The installer will keep our personal settings and files when we implement a reinstall.
  • If possible, it will also keep our installed application packages.
  • The Reinstall option will clean up our system-wide settings and then return them to the defaults.
  • We need to choose this option and proceed through the process for reinstalling Ubuntu on our system.
  • Also, the installation process will reinstall the GRUB2 boot loader with Ubuntu so it will solve any GRUB problems as well.

It is always a better idea for having backups if we are worried about losing our files. We can use the option, i.e., "Try Ubuntu" on the Ubuntu installation media for accessing a graphical desktop. We need to start the file manager and authenticate the files saved on our Ubuntu system drive from here. Connect a few sorts of external storage like an external hard drive or USB flash drive to the system and utilize the graphical file manager for baking up our files.

In the sidebar, we will see the Ubuntu drive upon Devices. We will see our personal files in our /home/NAME directory. Ensure to remember our hidden configuration files if we also wish to back those up.


Next TopicWoeUSB Ubuntu




Latest Courses