Linux system repair

Source: Internet
Author: User
Tags network function

in boot We can set some startup options according to our own needs, and we'll look at the Linux boot process and the boot options today.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/87/35/wKiom1fXmpOgvkf1AAFXG-vVIDs288.png "title=" Boot.png "alt=" Wkiom1fxmpogvkf1aafxg-vvids288.png "/>



    1. Load the BIOS hardware information to get the first boot device.

    2. read the first boot device Boot loader (GRUB) information for the MBR

    3. Core operating system is loaded, the core begins to decompress and attempts to drive all hardware devices.

    4. The kernel executes the init program and obtains the running information.

    5. Init executes the/etc/rc.d/rc.sysinit file.

    6. launch core plug-in module (/etc/modprobe.conf) .

    7. Init executes the individual batch files (scripts) that are running .

    8. Init executes the/etc/rc.d/rc.local.

    9. executes the/bin/login program, waiting for the user to log in.

    10. after logging in, start with Shell control the host.



POST:power-on-self-test, Power -on self-test is a major part of the BIOS function . Responsible for the completion of CPU, motherboard, memory, hard disk subsystem, display subsystem, serial parallel port, keyboard, CD -ROM drive and other hardware conditions detection.

ROM: BIOS, basic Inputand output system, holds the most important basic input and output program about the computer system, System Information setting, power-on and self-test programs and The system initiates the bootstrap program and so on.

RAM: CMOS Complementary metal oxide Semiconductor, save the settings of the parameters in order to find the boot device, the first device with a boot program for this boot device bootloader: boot loader, boot program

Boot Loader: Key feature recognition. Load the core files in the operating system and commit them to run in memory to start the corresponding operating system, each operating system has its own boot Loader, only the use of their own boot Loader can be loaded into their own core files 。 Another major feature of boot loader is the provision of menu information (which can provide different startup items to the user to load different operating systems), and will start the management function

Transferred to other loader programs.

Linux: Feature rich, provide menus that allow users to choose which system to boot or different internal cores, load the user-selected kernel into a specific space in memory, unzip, expand, and Transfer control of the system to the kernel

Stage1: The program running boot loader and configuration item loading is divided into three stages (stage) to run, MBR space is limited, so only the minimum main program of boot loader is installed in MBR, and the relevant configuration file of boot loader is not installed.

Stage1_5: stored in the subsequent sector of the MBR, primarily for interaction with the filesystem of the partition where the stage2 resides.

Stage2: Loads all configuration files and related environment parameter information via boot loader, which are stored on the/boot directory on the disk partition.

Grub: The most important part is the identification of disk information, and Grub recognizes the hard drive in the following ways:

(hd0,0)

1. The hard drive code is enclosed in parentheses ();

2. The hard drive is in HD, followed by a set of numbers, separated by commas between the numbers;

3. Use the search order as the number of the disk, rather than the line number of the disk (in case of multiple drives, the order of the search is based on the boot order set in the BIOS, not the slot number);

4. The first found disk number is 0, the second is 1, and an analogy.

5. The first partition number on each disk is 0, the second partition is 1, and so on.

#: therefore (hd0,0) represents the first partition on the first disk.

Default=0

Represents the default startup entry, if there are multiple operating systems installed at the same time, 0 represents the first title system defined, 1 represents the second title system defined, and so on

Timeout=5

Represents the waiting time to choose, if more than 5 seconds, the default startup entry is used to define the

Splashimage= (hd0,0)/grub/splash.xpm.gz

Define background picture information at startup

Hiddenmenu

Whether to display the menu at startup, by default the menu information is not displayed, if you want to display the menu, you can make the configuration note;

Comment Menu:

Title: Define the name of the operating system

Root: Represents the location where the kernel files are stored, where the partition location is specified, not the root directory.

Kernel: The name of the kernel and some core parameters at startup, because the root directory needs to be mounted during boot, so you need to specify the partition where the root is located, RHGB represents the color display, and quiet represents the silent mode load kernel.

INITRD: Specifies that the RAMDisk file path for the secondary kernel to complete the system boot is again in the memory cache


Default boot level:

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/87/37/wKiom1fXu5TAfTjHAACSE2UUE-8455.png "title=" ee[ 8w7g (_]~ay{m[iy ' qu}7.png "alt=" Wkiom1fxu5taftjhaacse2uue-8455.png "/>

0: Turn off all services;

1: Maintenance mode, single user mode, Sigle mode, this level allows root users to log in directly without authentication.

2: Maintenance mode, multi-user mode, requires user authentication, will start the network function, but does not support the use of NFS.

3: Normal level: Full multi-user mode, text interface.

4: Reserved Level:

5: Normal level: Full multi-user mode, graphical interface.

6: Close all services; restart

#: Usually with more default levels of 3 or 5, the server basically uses 3 levels, the text interface, by default.

#: Check the level of the current run can use RunLevel or who-r

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/87/37/wKiom1fXv4SirhdrAAANLaqb-50098.png "title=" 1.png " alt= "Wkiom1fxv4sirhdraaanlaqb-50098.png"/>

#: Disable ctrl+alt+delete restart; (CentOS 6)

1.cp-v/etc/init/control-alt-delete.conf/etc/init/control-alt-delete.override

2.vim/etc/init/control-alt-delete.override

3. Change Exec/sbin/shutdown-r Now "Control-alt-delete pressed" to exec/usr/bin/logger-p authpriv.notice-t Init "Ctrl-alt-del was pressed and ignored "

Destruction and Repair:

Stage1: Destruction

[[email protected] ~]# dd If=/dev/zero OF=/DEV/SDA Bs=1 count=446

[Email protected] ~]# hexdump-cv/dev/sda-n 446

Stage1: Fix

1. Restart and enter rescue mode

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/87/37/wKioL1fX49awI9ZPAAaPweiQpDs109.png "style=" float: none; "title=" 1.png "alt=" Wkiol1fx49awi9zpaaapweiqpds109.png "/>

2. Select a language

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/87/39/wKiom1fX49eAO2vXAAAgZ9F8xuY564.png "style=" float: none; "title=" 2.png "alt=" Wkiom1fx49eao2vxaaagz9f8xuy564.png "/>

3. Set Network Selection No

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/87/37/wKioL1fX49fAhxldAAAQtj1BbWU326.png "style=" float: none; "title=" 3.png "alt=" Wkiol1fx49fahxldaaaqtj1bbwu326.png "/>

4. Enter continue

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/87/39/wKiom1fX49jzcJ0oAAA4dlILxeU534.png "style=" float: none; "title=" 4.png "alt=" Wkiom1fx49jzcj0oaaa4dlilxeu534.png "/>

5. Open the shell terminal and switch to the root directory, chroot/mnt/sysimage/

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/87/39/wKiom1fX49jCVy3vAAAt24xGrcM164.png "style=" float: none; "title=" 5.png "alt=" Wkiom1fx49jcvy3vaaat24xgrcm164.png "/>

6. Error output information can be ignored, see the device information can be set.

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/87/37/wKioL1fX49jiaqbPAABMH7Cz1YA450.png "style=" float: none; "title=" 6.png "alt=" Wkiol1fx49jiaqbpaabmh7cz1ya450.png "/>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/87/39/wKiom1fX49njaKodAAAeMC6y6iI013.png "style=" float: none; "title=" 7.png "alt=" Wkiom1fx49njakodaaaemc6y6ii013.png "/>

7. This stage1 has been repaired, reboot is complete.

Stage1_5: Destruction

DD If=/dev/zero OF=/DEV/SDA bs=512 count=2 seek=1

Stage1_5: Fix

1. Rebooting the system

2. Start the disc and enter rescue mode.

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/87/39/wKiom1fX557i1Jp8AABbIdJfE8I313.png "title=" 1.png " alt= "Wkiom1fx557i1jp8aabbidjfe8i313.png"/>

3. Repair the boot file with the Grub tool, repair it, and restart it directly.

Boot: Destroy, delete boot directory directly

Boot: Fix

1. Remove all files from the boot directory and restart

[Email protected] ~]# rm-rf/boot/*

2. Restart and enter rescue mode

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/87/3A/wKiom1fX7V6yCnJPAAAOckqUR5A100.png "style=" float: none; "title=" 1.png "alt=" Wkiom1fx7v6ycnjpaaaockqur5a100.png "/>

3. Go to the root directory, mount the image

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/87/37/wKioL1fX7V_D9MLBAAAczt0S0NI284.png "style=" float: none; "title=" 2.png "alt=" Wkiol1fx7v_d9mlbaaaczt0s0ni284.png "/>

4. Reinstall kernel

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/87/3A/wKiom1fX7V_iSKEWAAAS60MhvuQ563.png "style=" float: none; "title=" 3.png "alt=" Wkiom1fx7v_iskewaaas60mhvuq563.png "/>

5. Repair the boot file

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/87/37/wKioL1fX7V-xsEYuAAAQOJECVzg863.png "style=" float: none; "title=" 4.png "alt=" Wkiol1fx7v-xseyuaaaqojecvzg863.png "/>

6. Edit the/etc/grub.conf configuration file

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/87/37/wKioL1fX7WCioHiNAAAwbP91_gk683.png "style=" float: none; "title=" 5.png "alt=" Wkiol1fx7wciohinaaawbp91_gk683.png "/>

7. Repair complete, reboot.

Boot: Destroy

[Email protected] ~]# rm-rf/boot/*

Fstab: Destruction

[Email protected] ~]# Rm-rf/etc/fstab

Boot repair, fstab file repair.

1. Restart and enter rescue mode.

2. We will find that the system does not detect the root directory because we have removed the/etc/fstab

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/87/37/wKioL1fX9nuinS0lAAArbI9sj64838.png "style=" float: none; "title=" 1.png "alt=" Wkiol1fx9nuins0laaarbi9sj64838.png "/>

3. View the logical volume and activate the logical volume, default off state

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/87/37/wKioL1fX9nyz31ECAAAaUugGEzw071.png "style=" float: none; "title=" 2.png "alt=" Wkiol1fx9nyz31ecaaaauuggezw071.png "/>

4. Mount the root directory.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/87/3A/wKiom1fX9nzzonHHAAAFe9tMKps663.png "style=" float: none; "title=" 3.png "alt=" Wkiom1fx9nzzonhhaaafe9tmkps663.png "/>

5. Create a new/etc/fstab and write the mount information, reboot into rescue mode, let the system automatically detect.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/87/37/wKioL1fX9nzjvJ4bAAAqG7z5LQM133.png "style=" float: none; "title=" 4.png "alt=" Wkiol1fx9nzjvj4baaaqg7z5lqm133.png "/>

6. Here we find that the system has detected a path/etc/sysimage

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/87/3A/wKiom1fX9n2BUsbhAAA6zxq8hLA435.png "style=" float: none; "title=" 5.png "alt=" Wkiom1fx9n2busbhaaa6zxq8hla435.png "/>

7. Re-enter the root directory to mount the image file.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/87/37/wKioL1fX9n7iogc1AAAWXe5cEzY544.png "style=" float: none; "title=" 6.png "alt=" Wkiol1fx9n7iogc1aaawxe5cezy544.png "/>

8. Reinstall the kernel and repair the boot file

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/87/3A/wKiom1fX9n7xihH3AAApErgQoBY624.png "style=" float: none; "title=" 7.png "alt=" Wkiom1fx9n7xihh3aaapergqoby624.png "/>

9. Edit the/etc/group boot file

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/87/3A/wKiom1fX9n6Rzv4tAAAvObH63oQ324.png "style=" float: none; "title=" 8.png "alt=" Wkiom1fx9n6rzv4taaavobh63oq324.png "/>

10. To this step has been repaired, the direct restart can enter the system normally.

This article is from the "Linux Learning path" blog, so be sure to keep this source http://luyubo.blog.51cto.com/7634254/1852437

Linux system repair

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.