
In this article, we will guide you through the process of booting into single-user mode from GRUB in Ubuntu. Single-user mode, also known as maintenance mode, is a mode where a multi-user Linux system operates with a single superuser. It’s useful for maintenance tasks and system recovery.
What is GRUB?
GRUB, or the Grand Unified Bootloader, is the default bootloader for Ubuntu and many other Linux distributions. It allows you to select between different installed Operating Systems or specific kernel configurations at boot time.
Booting into Single-User Mode
To boot into single-user mode from GRUB in Ubuntu, follow these steps:
Step 1: Access the GRUB menu
Reboot your computer. As your system restarts, hold down the left Shift key to bring up the GRUB menu.
Step 2: Select the Ubuntu boot entry
In the GRUB menu, select the boot entry for Ubuntu. This is usually the default option.
Step 3: Edit the GRUB boot commands
With the Ubuntu boot entry highlighted, press the “e” key to edit the GRUB boot commands for the selected entry.
Step 4: Modify the boot parameters
In the command list, look for the line starting with “linux” or “linuxefi”. This line contains the boot parameters for the kernel. Find the section that includes “ro quiet splash”.
The “ro” parameter mounts the root filesystem as read-only, “quiet” suppresses most boot messages, and “splash” enables the splash screen.
At the end of this line, after “ro quiet splash”, add the “single” parameter. This parameter tells the system to boot into single-user mode. The line should now look like this: “ro quiet splash single”.
Step 5: Boot into single-user mode
To boot using these modified kernel options, press either Ctrl+X or F10. The system will now boot into single-user mode.
Please note that these changes are not permanent and will only affect the next boot.
Making the Changes Permanent
If you want to make the changes persistent, you can edit the “/etc/default/grub” file. Open it in a text editor with root privileges:
sudo nano /etc/default/grub
Update the “GRUB_CMDLINE_LINUX_DEFAULT” line to include the “single” parameter:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash single"
Save the changes and exit the text editor. Then, run the following command to update the GRUB configuration:
sudo update-grub
Alternative Method: Specifying a Different Init Process
If the above method doesn’t work for you, you can try booting into single-user mode by specifying a different init process.
Follow steps 1 to 3 as described above. Then, in step 4, remove the part that says “ro quiet splash” and add “rw init=/bin/bash” at the end of the line.
The “rw” parameter mounts the root filesystem as read-write, and “init=/bin/bash” specifies that the initial process should be the bash shell.
Press Ctrl+X to boot into the system with these modified boot parameters. This method allows you to access a root shell without the root password, which can be useful for recovering from certain issues.
Conclusion
Booting into single-user mode from GRUB in Ubuntu can be a powerful tool for system recovery and maintenance. However, it should be used with caution, as it provides full root access to the system. Always make sure to backup your data and configuration files before making any significant changes to your system.
Remember that the effectiveness of these methods may vary depending on your Ubuntu version. Always refer to the official Ubuntu documentation or consult relevant forums for the specific version you are using.
Single-user mode, also known as maintenance mode, is a mode in which a multi-user Linux system operates with a single superuser. It is useful for maintenance tasks and system recovery.
To access the GRUB menu in Ubuntu, reboot your computer and hold down the left Shift key. This will bring up the GRUB menu.
In the GRUB menu, use the arrow keys to navigate to the Ubuntu boot entry, which is usually the default option. Press Enter to select it.
With the Ubuntu boot entry highlighted in the GRUB menu, press the "e" key to edit the GRUB boot commands for the selected entry.
Look for the line starting with "linux" or "linuxefi" in the GRUB boot commands. Add the "single" parameter at the end of the line, after "ro quiet splash". The line should now look like this: "ro quiet splash single".
To boot into single-user mode using the modified kernel options, press either Ctrl+X or F10. The system will then boot into single-user mode.
To make the changes persistent, edit the "/etc/default/grub" file with root privileges. Update the "GRUB_CMDLINE_LINUX_DEFAULT" line to include the "single" parameter. Save the changes, exit the text editor, and run the command "sudo update-grub" to update the GRUB configuration.
If the above method doesn’t work, you can try booting into single-user mode by specifying a different init process. Follow steps 1 to 3 as described earlier, remove "ro quiet splash" from the line, and add "rw init=/bin/bash" at the end. Press Ctrl+X to boot into the system with these modified boot parameters.
Yes, it is always important to backup your data and configuration files before making any significant changes to your system, including booting into single-user mode.
You can refer to the official Ubuntu documentation for more detailed information about Ubuntu and GRUB. Additionally, relevant forums and communities can provide valuable insights and support for specific versions of Ubuntu.