91

When booting to the graphical desktop fails we sometimes are recommended to boot into a "root shell" or to boot in "recovery mode".

How do I do that?

1 Answer 1

95

for 12.04.3 LTS and later

During boot, press and hold Shift (for BIOS) or ESC (for UEFI). This will bring up the Grub2 menu from where we can select "Advanced options for Ubuntu".

enter image description here

After that we will be able to select the kernel we wish to boot in "Recovery mode":

enter image description here

This will lead us to the advanced options. By selecting "Enable networking" we gain access to our network and the internet for upgrades or downloads, and we will also mount our hard drives in read/write mode in case we need to edit files.

enter image description here

After the network has loaded, and fielsystems were mounted we will be presented again with the menu, from where we can choose "Drop to a root shell prompt":

enter image description here

Note that we are root in this shell. Hence no sudo is needed for administrative tasks. This also means we have full access to all files, and we may cause irreversible damage to our system if we made a mistake.

If we had not enabled read/write access with "Enable networking" the filesystem will be mounted read only, and we are unable to edit files.

In case we don't have access to a network, or this was not desired, we can remount our filesystem(s) giving write access with the following command:

mount -o rw,remount /

From the root shell type exit to go back to the menu.

for 12.04.0 LTS or earlier

During boot, press and hold Shift (for BIOS) or ESC (for UEFI). This will bring up the Grub2 boot menu from where we can select "recovery mode" (usually the second boot entry).

enter image description here

This will lead to the Grub2 recovery menu:

enter image description here

"Drop to root shell prompt" gives you a command line root environment from where you can access your files as root (no sudo required). After having done your work on your files you can leave the command line shell by

exit

Choose "Resume normal boot" to proceed booting as usual.


Note: see this question for a solution when the Grub recovery menu does not load the shell.


7
  • I just installed 12.04 LTS, and it looks like I have the recovery menu listed under ">= 12.10". So I just followed those instructions instead and everything worked fine.
    – tir38
    Sep 22, 2013 at 16:07
  • @tir38: oh good point, thank you. It has changed with the updated LTS release then.
    – Takkat
    Sep 22, 2013 at 16:47
  • 1
    after enable networking, it doesn't goes back to menu again. Need help Oct 22, 2013 at 19:30
  • @SanjeevKumarDangi: try with exit.
    – Takkat
    Oct 22, 2013 at 21:34
  • 1
    My systems (14.04) hangs when trying to enable network and mounting the filesystem. When I press CTRL+C the systems goes to normal boot. When I go to root access, I can enable read/write with the following command: mount -o rw,remount /, and then I can use the terminal to change whatever I need to change.
    – SPRBRN
    Mar 1, 2015 at 12:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .