Linux operating level 7: 0: direct system shutdown 1: Single User Mode 2: consistent with Level 3, but no NFS service 3: complete Plain text mode with network functions 4: System reserved function 5: similar to running level 3, but using XWindow6: system restart from above 7... capital
Linux has a total of 7 levels:
0: the system shuts down directly.
1: Single-user mode
2: Same as level 3, but no NFS service
3: Complete Plain text mode with network functions
4: System retention
5: similar to running level 3, but using X Window
6. system restart
We can see from the above 7 levels that we can set the running level only to set 1, 2, 3, 5. I don't need to explain the values 0 and 6. if it is set to 4, the system will continue to shut down or restart automatically.
By default, to modify the default running level, modify the/etc/inittab file. However, ubuntu does not have this file. But you need to change the/etc/init/rc-sysinit.conf file:
View plain
Description "System V initialisation compatibility"
Author "Scott James Remnant "
Start on filesystem
Stop on runlevel
# Default runlevel, this may be overriden on the kernel command-line
# Or by faking an old/etc/inittab entry
Env DEFAULT_RUNLEVEL = 3
# There can be no previous runlevel here, but there might be old
# Information in/var/run/utmp that we pick up, and we don't want
# That.
#
# These override that
Env RUNLEVEL =
Env PREVLEVEL =
Task
Script
# Check for default runlevel in/etc/inittab
If [-r/etc/inittab]
Then
Eval "$ (sed-nre's/^ [^ #] [^:] * :( [0-6sS]): initdefault :. */DEFAULT_RUNLEVEL = "\ 1";/p'/etc/inittab | true )"
Fi
# Check kernel command-line for typical arguments
For ARG in $ (cat/proc/cmdline)
Do
Case "$ {ARG}" in
-B | emergency)
# Emergency shell
[-N "$ {FROM_SINGLE_USER_MODE}"] | sulogin
;;
[0123456sS])
# Override runlevel
DEFAULT_RUNLEVEL = "$ {ARG }"
;;
-S | single)
# Single user mode
[-N "$ {FROM_SINGLE_USER_MODE}"] | DEFAULT_RUNLEVEL = S
;;
Esac
Done
# Run the system initialisation scripts
[-N "$ {FROM_SINGLE_USER_MODE}"] |/etc/init. d/rcS
# Switch into the default runlevel
Telinit "$ {DEFAULT_RUNLEVEL }"
End script
The line "env DEFAULT_RUNLEVEL = 3" is not displayed. By the way, the default running level of the system is displayed. You can modify the running level by modifying the value here.
View the running level of the system: runlevel
Switch system running level: init 0 ~ 6
========================================================== ======================================
I directly set env DEFAULT_RUNLEVEL to 1, that is, after entering the single-user mode, the system will not be able to move to the selection user interface. The solution is to restart the system. press the shirt key to go to the boot loader selection page, select the first boot menu, and press the e key, then press ctrl + X as prompted to use root to enter the command-only mode. Change the previously modified value back to the original value, restart, OK !!
By default, the boot/grub/menu. lst file is modified for the bootstrap loader, but Ubuntu does not. Instead, the file/boot/grub. cfg is modified...
From: Java, go's