Init is one of the most indispensable programs in Linux system operation. Init process, which is a user-level process initiated by the kernel. The kernel will find it in several places in the past that used Init, and its correct location (for Linux systems) is/sbin/init. If the kernel cannot find Init, it will try to run/bin/sh, and if it fails, the boot of the system will fail.
Linux 7 RunLevel (0: shutdown, shutdown mode,1: single-user mode,2: Multi-user mode,3: full multi-user text mode,4: system unused, reserved for general use, 5: graphical mode,6: restart mode), run level is the functional level that the operating system is currently running. This level is from 0 to 6 and has different functions.
Level specific Description:
0: system shutdown (shutdown) mode, the default operating level of the system cannot be set to 0, otherwise it will not start normally, the power off automatically.
1: single user mode, root permission, for system maintenance, prohibit remote login, just like Windows Safe Mode login.
2: Multi-user mode, no NFS network support.
3: full multi-user text mode, NFS, login to console command line mode.
4: The system is not used, reserved for general use, in some special cases you can use it to do some things. For example, you can switch to this mode to do some setup when your laptop's battery is running out.
5: graphical mode, after landing into the graphical GUI mode or GNOME, KDE graphical interface, such as the X Window System.
6: Restart mode, the default operation level can not be set to 6, otherwise it can not start normally, will always restart the power on the boot restart.
Starting principle Description:
1, under the directory /ETC/RC.D/INIT.D , there are many server scripts, commonly referred to as services (service).
2, under the/ETC/RC.D there are 7 directories named RCN.D, corresponding to the system's 7 operating levels (0-6).
[email protected]/]$ cd/etc/rc.d/ #切换到/etc/rc.d/ directory [[email protected] rc.d]$ ll #查看/etc/rc.d/ file Information total under directory -drwxr-xr-x.2Root root4096Jul to -: theINIT.D-rwxr-xr-x.1Root root2617Nov A -RCDRWXR-xr-x.2Root root4096Jul to Ten: - rc0.ddrwxr-xr-x.2Root root4096Jul to Ten: - rc1.ddrwxr-xr-x.2Root root4096Jul to Ten: - rc2.ddrwxr-xr-x.2Root root4096Jul to Ten: - rc3.ddrwxr-xr-x.2Root root4096Jul to Ten: - rc4.ddrwxr-xr-x.2Root root4096Jul to Ten: - rc5.ddrwxr-xr-x.2Root root4096Jul to Ten: -RC6.D-rwxr-xr-x.1Root root -Nov A -rc.local-rwxr-xr-x.1Root root19892Nov A -rc.sysinit[[email protected] rc.d]$
3, RCN.D directory is a number of symbolic links (that is, soft link) files, these links to the/ETC/RC.D/INIT.D directory of service script files, naming rules for the k+nn+ or s+nn+ service name, where NN is a two-pull number.
4. When the system starts, it will enter the corresponding RCN.D directory according to the specified RunLevel, and retrieve the linked files in the directory according to the file name order: For files starting with K, the system will terminate the corresponding service, and for files beginning with S, the system will start the corresponding service.
5. Check the runlevel: RunLevel
#表示当前系统运行在level 5 mode.
[email protected]/]$ RunLevel # view current system run level 5 [email protected]/]$
6. Enter another runlevel: Init N, if init 3 enters terminal mode, init 5 logs into GUI mode.
7. Additional Init0 for shutdown, init 6 reboot system
Note: When you enter init 0, the system shuts down, and when you enter Init 6, the system restarts automatically. Be very careful with these two commands!
The standard Linux run level is 3 or 5, and if it is 3, the system is in multi-user state, and if it is 5, it is running the X Window System.
Different operational levels have different uses, and should be set according to their own different situations.
To reset the Linux system password method:
For example, root password forgotten, lost, etc., then you can let the machine boot into a single user state to set the new settings.
1. When the system starts, the grub interface is displayed, and the e is pressed directly;
2, the cursor selects kernel that line, again enters E;
3, add "Space single" At the end, enter;
4, press the B key to enter the single user mode;
5, through the passwd root command, modify the root password;
Linux 7 runlevel (0: Shutdown, shutdown mode, 1: Single user mode, 2: Multi-user mode, 3: Full multi-user text mode, 4: System unused, reserved for general use, 5: Graphical mode, 6: Restart mode), reset root password method