Linux startup and troubleshooting

Source: Internet
Author: User
Detailed process of linux operating system startup: Step 1: first initialize the hardware device and the basic hardware driver. Detection core hardware settings

Detailed procedures for linux operating system startup:

Step 1: first initialize the hardware device and the basic hardware driver. Checks the status of the core hardware device. if the device is good, it detects boot programs from usb, cdrom, and hard disk. The boot program is loaded into the memory and the control is handed over to the MBR master boot record. The MBR size is 446B.

Step 2: MBR further directs the first boot program stage00005 in the grub boot program located in the 0th cylindrical 0th track. Grub boot programs are divided into three parts: stage1, stage1_5, and stage2. These three files are located under/boot/grub. Stage1 is actually an MBR backup, and stage00005 is located on the MBR track. Stage00005 under/boot/grub is also a backup on the track. * _ Stage1_5 is about 15 k in size. MBR loads the second part of the boot program * _ stage00005 into the memory.

Step 3: * _ stage1_5 can identify the linux file system and load stage2 to the memory through the physical absolute path. at this point, all grub boot programs are loaded into the memory, then grub loads the configuration file/boot/grub. conf. Click ESC to view the boot menu. The boot menu is set in the configuration file.

Step 4: The grub boot program loads the/boot/initr *. img virtual file image and/boot/vmlinuz kernel into the memory. The virtual image file contains some basic system drivers and tools. The kernel mounts the root file system read-only. (Read-only mounting is because the kernel only needs to load all the system drivers stored on the root. it is dangerous to generate some files on the root if the read/write mounting is performed ).

Step 5: the kernel loads all the drivers, loads the system's first init process, and temporarily gives control to init. Now the welcom to linux interface is displayed.

Step 6: init load all system configuration files. /Etc/init/rc. conf/etc/inittab/etc/init/rc. conf/etc/rc ?. D/*/etc/init/tty. conf/etc/serial. conf and other files.

Step 7: init starts the mingetty process and reads the configuration file/etc/init/tty. conf to enter the character terminal interface or graphical interface. The entire system has been started.

First-stage Troubleshooting:

1. the MBR master boot record is damaged and enters rescue mode. open a shell run command grub-install/dev/sda1 to fix MBR, and stage1_5 all writes again.

2. the Superblock is damaged and enters rescue mode. run fsck/dev/sda1 to fix the issue.

3. if stage1_5 and stage2 are deleted, grub can still perform full boot, because MBR contains the physical addresses of stage1_5 and stage2.

Phase 2 Troubleshooting:

1. enter the password in the grub boot menu to enter rescue mode. modify the configuration file/etc/grub. conf and remove the password line. You can also add an option number 1 or the letters s 1 and s to the kernel parameter project to indicate entering the single-user level.

Phase 5 Troubleshooting:

1. if the configuration file of the init process is missing, edit the menu option kernel field of the grub boot program and add the init =/bin/bash parameter to the kernel parameter. In this way, the first loaded process can be directly changed to bash rather than init. Then repair the defect file. You can reinstall the init Program. At this time, the root file system is read-only, so you must read and write the mount again, mount-o remount, rw.

2. commands can be placed in the/etc/rc. local file loaded by the init process. commands in the file can be executed during the init loading process. in this case, you should pay attention to malicious exploitation of the commands.

3. the default entry mode is determined in the configuration file/etc/inittab file loaded by the init process. The unique statement in the file is id: 5: initdefault:

Number 5 indicates that multiple users enter the graphic interface, 0 indicates that the server is shut down, 1 indicates a single user, 2 users do not have the network file system function to enter, and 3 indicates the multi-user character interface, 4 for unused 5 for X11 6 for reboot. therefore, you can enter init {0, 1, 2, 3, 4, 5, 6} in the command line to enter different modes.

4. init configuration file loading sequence:

/Etc/inittab --->/etc/rc. d/rc. sysinit ------->/etc/rc. d/rc ------->/etc/rc? D /*.

|

Confirm entry level |

Configure net and fsck detection filesystem |

Re-read and write the root file system | load or terminate the corresponding service

Configuration file of the corresponding level

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.