There are two common ways to boot Ubuntu into recovery mode:
Using the GRUB Menu at Boot:
Reboot Your System: Restart your computer.
Show the GRUB Menu:
On most BIOS systems, as soon as the computer starts up, hold down the Shift key.
On UEFI systems, you might need to press the Esc key repeatedly.
Select Recovery Mode:
In the GRUB menu, you’ll typically see an entry called “Advanced options for Ubuntu”. Select that entry, and then choose one of the kernels with (recovery mode) appended to its name.
Recovery Menu:
Once selected, Ubuntu will boot into recovery mode and display a menu with additional recovery options (such as dropping to a root shell, repairing broken packages, etc.).
Booting into Recovery Mode from the Shell:
If you’re already logged into Ubuntu and want to arrange for your next boot to be in recovery mode, you can instruct GRUB to boot a specific entry using the grub-reboot command. Note that this method only affects the next boot; after that, GRUB will revert to its default entry.
Steps:
a. List GRUB Menu Entries:
To know exactly which entry corresponds to recovery mode, list the menu entries. Run:
The recovery mode entries are usually under the Advanced options for Ubuntu submenu and will look like:
code
menuentry 'Ubuntu, with Linux 5.xx.xx-xx-generic (recovery mode)' ...
b. Determine the GRUB Entry Identifier:
GRUB counts entries starting at zero. When the menu has submenus (like Advanced options for Ubuntu), you need to specify the path using a notation such as "X>Y", where:
X is the index of the submenu (often the Advanced options for Ubuntu entry).
Y is the index within that submenu corresponding to the recovery mode kernel you want.
For example, if:
The first entry (index 0) is the standard boot option,
The second (index 1) is Advanced options for Ubuntu, and within that submenu the recovery mode entry is, say, the third option (index 2, since submenu indices also start at 0),
then you would use the identifier "1>2".
Note: The exact numbers can vary depending on your system and updates. It’s important to check your GRUB menu entries as shown above.
c. Set the Next Boot Entry and Reboot:
Use grub-reboot (you’ll need sudo privileges) and then reboot:
bash
sudo grub-reboot "1>2"
sudo reboot
The system will use the recovery mode entry for the next boot only.
Additional Notes:
If you’re not sure about the exact numbering, you might want to reboot and manually check the GRUB menu once by holding down Shift (or Esc for UEFI) during boot.
Make sure the GRUB configuration is up-to-date (it normally is), but if you recently made changes, you may run:
bash
sudo update-grub
Using grub-reboot is handy if you’re administering a remote machine or want to script a recovery-mode boot.
By following either of these methods, you can boot Ubuntu into recovery mode as needed.