Linux boot process

Source: Internet
Author: User

Environment: Debian 7.0

Load BIOS1. Starting with the click of the Power key, first load the BIOS for hardware detection, then read the boot device according to the configuration, then read boot Loader, the main boot Loader in Linux is grub. The boot Loader is installed in the first magnetic area of the boot unit, which is the MBR (the master boot record is the main boot recording area). read the kernel file and start the service2. First read/boot kernel file, after the core loaded, will start the initialization process, first read/etc/inittab see the first line is such a child?
1 id:2:initdefault:
The value of Initdefault is 2, indicating that the operating level is 2 when the system starts. (Linux allows for different occasions, with different startup programs, this is called the RunLevel.) )

The various operating levels in Debian are as follows:?
1234 0 (halt the system) 1 (single-user / minimal mode),2 through 5 (multiuser modes),6 (reboot the system)

The 0,6 respectively indicates shutdown and restart, both of which are reserved by the system, so we cannot set the boot level to these two. Run Level 1 represents the single-player maintenance mode, which is used for maintenance in the case of a system problem. The run level 2~5 represents multi-user mode. Debian has a default operating level of 2. You can also use the RunLevel command to view the current run level.
1 runlevel

The first 3 above represents the previous RunLevel, 2 means that the current runlevel uses the init command to toggle the current runlevel?
1 init 3 

You can also use init 0 and init 6来 to perform shutdown or restart the machine. In addition/etc/inittab set up a series of system start and configuration process. 3. Then execute the initialization program

Each run level under the/etc directory has a corresponding subdirectory that specifies the program to load, and here is a look at the initialization programs that are started under run levels 2.
1 ls/etc/rc2.d
You can see that level 2 is initialized to run those services.
010203040506070809101112131415 S01motd -> ../init.d/motdS13rpcbind -> ../init.d/rpcbindS14nfs-common -> ../init.d/nfs-commonS16rsyslog -> ../init.d/rsyslogS17apache2 -> ../init.d/apache2S18acpid -> ../init.d/acpidS18atd -> ../init.d/atdS18cron -> ../init.d/cronS18mysql -> ../init.d/mysqlS18pptpd -> ../init.d/pptpdS18ssh -> ../init.d/sshS19exim4 -> ../init.d/exim4S20bootlogs -> ../init.d/bootlogsS21rc.local -> ../init.d/rc.localS21rmnologin -> ../init.d/rmnologin
The above s indicates that the start parameter is (start) This s can also be k to indicate that the startup parameter is (stop). Numbers indicate the boot order. These file startup files are actually under/etc/init.d/.    The/ETC/RC2.D directory just places the connection file. That is, if we want to boot a service or shut down a service, modify the file in this directory can be, but it is not recommended to directly modify the files in this directory, you can sysv-rc-conf this software to modify. Under Debian, first install the sysv-rc-conf?
1 apt-get install sysv-rc-conf
After installing the input sysv-rc-conf can see this interface x indicates boot entry, click the space can be canceled or added. If you want to add a new startup item, simply The/etc/init.d/directory adds a startup script and then executes sysv-rc-conf to set it up. Additional startup scripts that need to be aware of must have execute permissions. In addition, note that this service,/etc/rc.d/rc.local, if you need to customize the boot to execute some commands can be added in this piece. User Login4. After the system has verified the user's account password, the login is successful. After the login is successful, it will read into the/etc/profile. If it is a command line login and SSH login, the following three files will be read sequentially?
1 ~/.bash_profile ~/.bash_login ~/.profile
The above three files, if one exists, will not read the following asking price. If the graphical interface is logged in, only the/etc/profile is loaded. and ~/.profile.

Linux boot process

Related Article

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.