Home » Linux

Boot to single user mode in Ubuntu 10.04 Lucid Lynx

20 March 2011 No Comment

Boot to single user mode in Ubuntu 10.04 Lucid LynxThere are occasions when the single user mode comes in handy. Take for example last week. I was messing around with iptables and I added to much restriction on my deny rules. As such, I could not log in to the network and get myself authenticated.

At first, it was very disheartening to find out that you locked yourself out of your own system. On the other hand, it becomes a challenge and you find it a valuable experience. What you find is that whatever you may have done with your system, you can fix it and get it back up and running again.

The way to break out of the iptables fiasco is to log in to single user mode and disable iptables. This is done during boot-up before you log in to the GUI. The steps vary slightly from one version of Linux Ubuntu to another. In this example, I will be assuming you are using Ubuntu 10.04 Lucid Lynx.

  1. Boot up your Linux system and wait for the Grub boot menu. If you have it turned off, you can hold down the Shift key during boot-up.
  2. When the Grub boot entries appear, you will see a list of kernels you can select from such as:

    Ubuntu, with Linux 2.6.32-28-generic-pae

  3. Usually you will be booting from the first entry on the list. If so, press e to edit the entry. Otherwise, use the arrow keys to move up and down from the list and then press e to edit it.
  4. Find the line in the entries that look like

    linux /boot/vmlinuz-2.6.32-28-generic-paeroot=UUID=xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx ro vga=794 quiet splash

  5. Change the line to be

    linux /boot/vmlinuz-2.6.32-28-generic-paeroot=UUID=xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx init=/bin/bash rw

    What you are adding is the bash shell that has read-write access to the operating system.

  6. Hit Ctrl+x to boot this kernel version with the options given.

At this point, your system will boot to single user mode. You will boot as root (#) without being prompted for a password. Make the necessary changes to fix your system such as disabling iptables.

After you are done, you can reboot the system. There is no need to revert the changes in the Grub boot menu. After the reboot, your Grub changes will revert back to the way to its original state.

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.