Linux Notes-system startup process

Source: Internet
Author: User

Post (POST)-->bios (boot seqvence)-->mbr (boot loader)-->kernel-->initrd-->sbin/init

Kernel design:
Single Core: Linux lightweight threading
Microkernel: Windows supports multithreading
Kernel location:/lib/modules A directory named after the version number

LDD path: Displays the dependencies of the shared library (which the absolute path of the view command)

The services that start are different, and the level of operation is not the same:
0 Halt shutdown
6 reboot Restart
1 Single user mode (can log in directly as Administrator)
2 multiuser, without NFS multi-user mode, but no network file system enabled
3 Full multiuser mode multi-user pattern Text interface
4 Unused retention level
5 X11 Multi-user mode graphical interface

Boot loader: Boot load
GRUB: (First stage) Stagel1 (MBR)--->stagel1.5 (identification file system)---> (phase II) STAGEL2 (/boot/grub/)
/boot/grub/grub.conf:

Default=0 Set the default start title, which defaults to 0 (starting with the first one)
timeout=10 wait for the user to select the length of the second
Splashimage= (hd0,0)/grub/linux.xpm.gz Select the background picture of the menu (the default is splash.xpm.gz you can customize the changes)
# Hiddenmenu Hidden menu, can be commented out, show menu

Title Huishao CentOS 6 (2.6.32-504.el6.x86_64) (title name: Name can be changed)
Root (hd0,0) First partition of first disk
kernel/vmlinuz-2.6.32-504.el6.x86_64 ro root=uuid=f12bd5ee-6514-4bc8-a225-a25aa52e491e
Nomodeset rd_no_luks keyboardtype=pc keytable=us rd_no_md crashkernel=128m lang=zh_cn.
UTF-8 RD_NO_LVM rd_no_dm rhgb quiet where the kernel is located
Initrd/initramfs-2.6.32-504.el6.x86_64.img

You can also add a password to grub, but normal users cannot modify the start level on the start selection menu, so they cannot log in directly as an administrator
First Type: password password
The second type: password--md5 encrypted password (can use Grub-md5-crypt)
[Email protected] ~]# Grub-md5-crypt
Password:
Retype Password:
$1$25qnl$iil4fq1crgaf6t6fwayll0, this is the password after MD5 encryption.
To modify the start level when you enter the boot selection menu again, enter P and enter the password before you can modify

RunLevel command: View current run level
[Email protected] ~]# RunLevel
N 5 (n is the previous level, not just n,5 is the current start level used)
Who-r can also view the RunLevel:
[Email protected] ~]# Who-r
Run Level 5 2015-07-26 07:43
Uname-r Viewing the kernel
[Email protected] ~]# uname-r
2.6.32-504.el6.x86_64 Installing Grub

Kernel initialization process:
1. Device detection
2. Driver initialization (May load driver module from INITRD (INITRAMFS) file)
3. Hanging on the root file system (mount as read-only)
4. Load the first process init (because Init is the first loaded process so the PID is always 1 and is the parent process for all processes)

Rh5.8:/sbin/init (/etc/inittab configuration file)
RH6.2:SYSTEMD can be started in parallel
Rh6.3:upstart (Ubuntu development is based on D-bus configuration/etc/init/init.d/profile Script storage location, equivalent to Inittab configuration file
Only fragmented)
Id:5:initdefault:
ID (identifier) 5 (Run level) Initdefault (under what circumstances) the program to run
Respawn (restarts as soon as the program terminates, such as logout) if no level is specified, indicates at all levels

Tasks completed by/etc/rc.d/rc.sysinit:
1. Activating Udev and SELinux
2. Set parameters according to the/etc/sysctl.conf file
3. Setting the Clock
4. Load Keyboard mapping
5. Enable swap partition
6. Set Host name
7. root file system detection and re-mount as read and write
8. Activating RAID and LVM devices
9. Enable disk quotas
10. Check and hang the system files according to/etc/fstab
11. Purge expired lock and PID files

The/ETC/RC.D/INIT.D directory is a script for the service class:
/etc/rc.d/init.d/a service start/stop/restart/status/reload/configtest with a parameter to turn a service on or off
/etc/rc.d/init.d/** Service Script:
#!/bin/sh
#
# Chkconfig:-91 35
# Description:starts and stops the Samba nmbd daemon \
# used to provide NetBIOS name services.
#chkconfig Start-level Start priority (Service script starting with s) off priority (Service script starting with K)
-Represents a connection that does not have a level that defaults to the beginning of the s* (the service is turned on and off after it is turned on first)
#description user describes the simple function of this script \ Cont.
#chkconfig and #description are still read, although they are comment lines

Chkconfig command:
--list lists the startup settings for viewing all standalone daemons on the current system
--list Service Name specified view
--add Service Name Script name add service but the server will not take effect the next time it starts
Service Service name Start|stop start or stop services
--del Service Name Delete Service All links
[--level] (omitted as 2345) 24 service name On|off turn services on or off at level 2 or 4

A script that was last launched by the/etc/rc.d/rc.local system (some commands can be added)

/etc/rc.d/init.d//etc/rc.d/rc.sysinit/etc/rc.d/rc.local
/ETC/RC.D/RC[0-6].D indicates the service to start at each boot level

Rh5/etc//inittab's mission
1. Set the default run level
2. Run the init script
3. Run a directory script that specifies the opposite level of RunLevel (k* s*)
4. Set the operation of the Ctrl+alt+delete key combination
5. Define the operation after UPS power failure recovery
6. Start the virtual terminal (default is 2345)
7. Start the graphics terminal (only at level 5)

Daemon Type:
Independent daemon: xinetd Super daemon, manage transient daemon process
Transient daemon: No need to correlate to runlevel
When you have access to transient daemon A, xinetd starts a temporarily and shuts down immediately after access.

This article is from the "stupid Bird first-FAI" blog, please be sure to keep this source http://benniaoxianhui.blog.51cto.com/10463960/1679223

Linux Notes-system startup process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.