Linux system startup Debug test Set

Source: Internet
Author: User

CENTOS6 system Start-up process

1. Post power-on self-test check hardware environment

2. Select a hardware type boot boot MBR 446 bytes Grub Stage1

3. Loading boot partition file system driver hangs in/boot directory grub stage1.5

4. read/boot/grub/grub.conf load kernel boot menu Grub STAGE2

5. Load the Vmlinuz kernel to load the driver of the root partition file system by loading the operating system with the kernel/need/boot/initramfs.img mate

6. Start the first process under the operating system root/sbin/init

7. Run the Rc.sysinit (System initialization) script by starting the first process

8. Read the/etc/inittab configuration file and set the system boot level

The difference in each boot level is essentially the set of services that need to be started when the operating system starts, and which services do not need to be started. (various combinations of different services)

9. Script to run/etc/rc[0-6].d/[s,k]----> link/etc/init.d/

10. Running/etc/rc.local

11. Display the login screen

The files in the experiment 1:boot directory are all deleted

1. Start the symptom:

2. When rebooting the system, press F2, set the boot from CD and enter rescue mode.

3. Start the rescue system and open a shell window

1. Chroot/mnt/sysimage && Mkdir/mnt/cdrom

2. Mount/dev/sr0/mnt/cdrom

Method 2:rpm-ivh/mnt/cdrom/packages/kernel-2.6.32-el6.x86_46.rpm--root=/mnt/sysimage/--force

This command automatically generates the kernel file and the pseudo file system in the/boot directory

Then execute the GRUB-INSTALL/DEV/SDA and create the grub.conf file to

3.cp/mnt/cdrom/isolinux/vmlinuz/boot

4. Cd/boot && mkinitrd initramfs.img ' uname-r '

5.grub-install/dev/sda

6.cd/grub && Create a grub.conf configuration file

In the Grub folder/represents the partition where the boot directory resides, not the root partition of the operating system.

7.exit Exit Cutting root status

8.exit Exit Shell window

9. Select Restart System

10. The following menu appears

Conclusion: The file name of kernel and pseudo-root system in boot directory can not be added with version number, GRUB-INSTALL/DEV/SDA cannot generate grub.conf

File, this file must be created manually

Implementation 2: Delete both the boot directory and the Etc/fstab file

Phenomenon: After entering rescue mode, there will be a/to/mnt/sysimage directory that cannot mount the operating system

1.fdisk-l viewing the details of a partition

2. Mount each partition manually and view the data in the partition until you find the partition where the root of the system is located

3. Repairing the/etc/fstab configuration file in the root partition

4. Restart the system and re-enter rescue mode, so that the rescue system can automatically mount the root partition

5. Repair the boot directory

Experiment 3:/sbin/init file is corrupted

Failure phenomena:

Enter Rescue mode system

1. Mkdir/mnt/cdrom

2. Mount/dev/sr0/mnt/cdrom

3.rpm2cpio/mnt/cdrom/packages/upstart-0.3.el6.x86_64.rpm | Cpio-idv./sbin/init extract to current directory

4.CP./sbin/init/mnt/sysimage/sbin

5.exit

6.reboot

Lab 4: Background service startup exception

Switch the startup mode to single-user mode and then modify the corresponding service script

Lab 5: Customizing Linux Systems

1. Assign a new disk partition Fdisk must be at least two extents

2. Create a file system for the newly created partition MKFS.EXT4/DEV/SDB1

3. Mount Boot

Mkdir/mnt/boot Sub-directory must be boot

Mount/dev/sdb1/mnt/boot

4. Installing Grub

Grub-install--root-directory=/mnt/dev/sdb

5. Copy kernel and Initramfs files

cp/boot/vmlinuz-2.6.32-642.el6.x86_64/mnt/boot/

Cp/boot/initramfs-2.6.32-642.el6.x86_64.img/mnt/boot

6. Create grub.conf write kernel menu information

Vim/mnt/boot/grub.conf

Title Yxhlinux

Root (hd0,0)

Kernel/vmlinuz-2.6.32-642.el6.x86_64 Root=/dev/sda2

Selinux=0

Init=/bin/bash

Initrd/initramfs-2.6.32-642.el6.x86_64.img

7. Create a first-level catalog

Mkdir/mnt/sysroot Mount/dev/sdb2/mnt/sysroot

Mkdir–pv/mnt/sysroot/{etc,lib,lib64,bin,sbin,tmp,var,usr,sys,proc,opt,home,root,boot, Dev,mnt,media}

Copy bash and related library files

Copy related commands and related library files such as: Ifconfig,insmod,ping,mount,ls,cat,df,lsblk,blkid, etc.

Lab 6: Kernel compilation

Kernel components:

Kernel: Kernel core, typically bzimage, usually in the/boot directory with the name Vmlinuz-version-release

Kernel object: Kernel objects, generally placed in/lib/modules/version-release/[]: N [m]: M [*]: Y

Auxiliary files: RAMDisk initrd Initramfs

Lab 7: Logical Volume Boot profile corruption

1. Reboot into rescue mode

2. Logical volumes cannot be mounted directly like partitions The rescue mode cannot automatically activate logical volumes, and all logical volumes are inactive.

3. Lvdisplay view the logical volume details on the current system

4. Vgchange-ay to activate all logical volumes

5. Mount/dev/volgroup/lv_root/mnt/rootfs logical volume is only activated to be successfully mounted

6. Repair the relevant configuration files in the/mnt/rootfs directory

Centos7 SYSTEMD Introduction

POST > Boot Sequence > Bootloader > Kernel + Initramfs > Rootfs >/sbin/init

POST > Boot Sequence > Bootloader > Kernel + Initramfs > rootfs These and CENTOS6 start in the same way

/sbin/init made a soft link on centos7 and pointed/sbin/init to SYSTEMD.

The reason why the first process must have a name of/sbin/init after system startup is because it is written as a fixed string in the kernel source code.

SYSTEMD new Features:

System boot time to implement service parallel boot

Start the daemon on demand

Automated Service Dependency Management

Simultaneous socket-and d-bus-bus activation services

System State Snapshot

Linux system startup Debug Experiment Collection

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.