Linux boot process notes

Source: Internet
Author: User

Linux boot process

1. Start process (bios->mbr:boot code-> boot grub-> load kernel, execute init->runlevel)

2,/boot/grub/There are multiple files where stage1 is MBR mirroring (512 bytes) Stage2 as the bootloader
3./boot/grub/grub.conf as the boot configuration file
default=0# which system is loaded by default timeout=3# boot wait time splashimage= (hd0,1)/boot/grub/splash.xpm.gz# boot interface background map hiddenmenu# Hide Menu Title CentOS (2.6.32.279.el6.i686) #系统名称    root (hd0,1) #系统位置    kernel/boot/vmlimuz-2.6.32.279.el6.i686 ro root=uuid=* *  Lang=en_us. UTF-8 #内核及参数    initrd/boot/initramfs-2.6.32.279.el6.i686.img# image file

4, Linux in order to maintain kernel lite will be some of the less common drivers, functions compiled into modules, when needed to dynamically load, and these

Module is packaged and saved as a Initramfs file
Earlier versions of Linux use the Initrd file, Initramfs is an alternative optimized version of INITRD, more space-saving and more flexible than before


5, DMESG View the output information of the kernel (see kernel-level failure, device drivers need to look at the kernel information), the final information

exists in the/VAR/LOG/DMESG file
6. Init is the first process in the Linux system (PID 1 in top), the parent process for all processes
Call/etc/rc.d/rc.sysinit at system startup is responsible for initializing the system, mounting the file system, and starting the corresponding service according to the basic operation
Operating level:
0: Turn off the machine
1: Single-user mode
2: Multi-user mode without network
3: Plain text multi-user mode
4: Not used
5:XLL graphical multi-user mode
6: Restart
Modifying the default level with/etc/inittab
Each level is saved under/ETC/RC.D (RC0.D, rc1.d, rc2.d ... )
The file inside the/etc/init is the system initialization configuration file (such as the start Ctrl Alt Del combo key)

RunLevel display current and previous RunLevel
N 5 (n indicates no previous, 5 represents a graph)

Init 3 means switch to Level 3

single-User change root passwordPass the parameter "1" (number 1) or "single" to the kernel at boot time (press E in boot mode, select kernel and then press E, append "1" to start)
No services are enabled in single-user mode
Single-user mode logs in directly to the root user and does not require a password
You can use passwd to modify the root password

Grub Encryptiongrub can be encrypted by adding the following parameters to the boot configuration in grub.conf:
Password--MD5 $1$ao---Here's the code.

The encrypted password can be generated by the Grub-md5-crypt command, replacing the resulting password with the password on the top


Rc.local file Explanation

Many people do not know rc.local and RC? D, Rc.local is executed after the system initialization level script runs, so you can safely add scripts that you want to execute after the system starts. The common scenario is that you can add NFS mount/mount scripts inside again. In addition, you can also add some debugging script commands. For example, I've come across a situation where samba services always fail to work, and the check finds that Samba is executing during system startup, which means that the Samba daemon configuration ensures that this functionality should be performed correctly. In this similar situation, I usually do not bother to spend a lot of time to find out why, I just need to simply add this line in the/etc/rc.local script:

/etc/init.d/samba start

This successfully solves the problem of samba service anomalies.



Linux boot process notes

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.