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 XWindow6: system restart can be seen from the above 7 levels, we can set the running level to only 1, 2, 3, and 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/etc/in.
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:
- Description "System V initialisation compatibility"
- Author "Scott James Remnant<Scott@ Netsplit.com>"
- 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
- EnvDEFAULT_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
- EnvRUNLEVEL=
- 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
SeeEnv DEFAULT_RUNLEVEL = 3This line does not exist, right. Here is the default running level of the system. 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...