Single user mode, also referred to as maintenance mode and runlevel 1, is a way of running Linux or another Unix-like operating system that uses minimal system resources and provides only minimal functionality. Single user mode can be useful for checking and repairing operating systems, particularly those that have been damaged and will not allow booting (i.e., starting up) into the default GUI (graphical user interface) or console (i.e., text-only) multi-user mode. For example, it is used for running fsck (which is used to check and repair filesystems) on a /usr partition because this requires that the partition be unmounted (i.e., not logically attached to the system). A partition is a logically independent section of a hard disk drive (HDD). A runlevel is any of several operating states of a computer, each allowing the operation of a different set of services. By default Linux boots into either runlevel 3 or runlevel 5. The former permits the system to run all services except for a GUI. The latter allows all services including a GUI. The previous and current runlevels can be found at any time by running the runlevel command as follows:
There are several ways to change into single user mode. It is easiest to do while the computer is already in operation. All that is necessary is for the root (i.e., administrative) user to run the init command, which is used to change the runlevel, using the number the letter s or the number 1 as an option as follows:
It will be obvious when single user mode has been entered. This is particularly true in the likely case that the user was working in a GUI, as the GUI will be shut down and the computer will be in console mode. Also, there will typically be a change in the shell from bash (the default on Linux) to sh, which features a small size and minimal functionality, and this will be indicated by a change in the command prompt (i.e., the short text message at the start of each line). A shell is a program that provides a text-only user interface and reads and executes commands that are typed in.
It is also possible to boot directly into single user mode, although this is slightly more complicated. If the GRUB (grand unified boot loader) is used (as is typical on modern versions of Linux), the first step is to wait for the GRUB splash screen (i.e., full-screen image) to appear and then (1) enter the letter
The second step is to (2) select the desired operating system or version of the desired kernel (i.e., the core of the operating system) for booting using the up and down arrow keys and then type the letter
The third step is to (3) select the line that starts with the word kernel and type
The next step is to (4) type a space followed by the word
The final step is to (5) type the letter It is very easy to return to the previous runlevel or continue booting into the default runlevel after the checks and/or repairs have been made. One way is to use the init command again, followed by the runlevel desired, as follows:
Another way is to simultaneously press the CONTROL and d keys. In addition, a computer should return to its former runlevel when rebooted, although this can take substantially more time, which can be an important consideration on enterprise systems. Created July 13, 2006. |