Ubuntu Live CD Repair Grub boot entry

Source: Internet
Author: User

1. Enter Ubuntu system via Ubuntu Live CD (Install disk, choose try Ubuntu)

Open the terminal and do the following in turn:

[Plain] View plain copy
    1. 1. Sudo fdisk-l

The following interface appears:

2. Then you will see that there are a lot of different hard disk partitions, but when I installed the system did not divide the boot partition, and I then gave the/directory capacity is 20G, it is clear that/dev/sda7 is my root directory on the hard disk (if not split boot partition, boot partition boot default is located in /directory). Then execute:

[Plain] View plain copy
    1. 2. Sudo mount/dev/sda7/mnt

3. The next step is to create a new MBR partition that does the following

[Plain] View plain copy
    1. 3. Sudo grub-install--ROOT-DIRECTORY=/MNT/DEV/SDA

4. Update Grub

[Plain] View plain copy
    1. 4. Sudo update-grub

# #这一步并非必须

----------------------------------------------------2017.5.2 Update----------------------------------------------------------- --------

Linux veterans have warned users to install Windows and then install Linux, but there are times when Windows crashes or is poisoned and must reload the Windows system to fix grub. The reason for this is because Windows overwrites the Multiboot grub, and its own program does not have the ability to boot Linux boot.

The solution is simply to re-fix grub and what is needed is the installation disk.

Ubuntu FIX:

Use the CD to start Ubuntu, choose try Ubuntu without any your computer.

A successful boot from the CD is ready to fix grub. In the Ubuntu command line, enter the following in turn.

Grub

Find/boot/grub/stage1

Root (Hdx,y)

Setup (hd0)

Quit

Command

Meaning

Grub

Start the GRUB program on the CD, and if the user is using Ubuntu, use sudo grub to gain root privileges.

Find/boot/grub/stage1

Find the hard disk partition on which the Linux system on your hard disk is stored/boot, and grub needs to read the relevant configuration files in this directory during installation.

Root (Hdx,y)

Indicates that the Linux kernel file is located on the hard disk partition (that is, the/boot directory partition), replace here (Hdx,y) with the one found in the previous row, note that there is no space in parentheses.

Setup (hd0)

Install the Grub Boot program on the first hard drive.

Quit

Leave the boot program grub.

Using the GRUB command to start a damaged Linux system, your computer may not start automatically because of some cause damage. Of course there are many reasons, there are many possible phenomena.

Here is the processing method in this case, that is: The screen prompts Grub>, but the data on your hard drive is not lost, each partition is good. This situation is that your grub information is corrupted, but the more serious is the system can not boot.

Of course, in the normal boot situation, when the Grub Startup item Selection menu appears on the screen, pressing the C key will also enter the grub> state. At this point we need to manually start the system with GRUB commands. Only four command boot, kernel, INITRD, boot are required.

But grub itself commands a lot, like the cat that looks at the contents of a file, and you get it by typing help.

First, enter "root (HD") and press two tab;/* This will list the possible disk devices on your computer, the hard drive is HD0/HD1 or SD0/SD1, etc. */

Then, choose your Linux system to install the hard disk, such as hd0, enter "root (hd0," and then press two tab;/* This will list the partition on your first hard drive, you will know which swap partition, 0x82, which is the Linux partition 0x8 3 */

Select the partition where you think the/boot directory is located and enter root (hd0, 1).

Next, enter CAT/BOOT/VM, press two TAB, if there are some files at the beginning of the VM, such as vmlinuz-2.6.15-26-386, this is the partition where/boot is located.

Delete the last input, and then enter CAT/BOOT/INITRD, press two TAB key, if there are some initrd beginning of the file, such as initrd.img-2.6.15-26-386 that the/boot is located in the partition has INITRD, that is RAMDisk Mirror

Delete the last input, and then enter Cat/sbin/init, press two TAB key, if there are some files beginning with init, such as/sbin/init description of the partition is/where the partition;

If the/sbin/init file does not appear, the description (hd0,1) partition is just the/boot partition instead of/partition. Re-enter the root (hd0,n) command, where N is a Linux partition, and then try Cat/sbin/init until the/sbin/init appears on the screen, indicating that you have found/partitioned, strictly speaking, should be the partition where the/sbin directory resides;

Enter the command in turn:

[Plain] View plain copy
    1. Root (hd0,1)//Assume that/dev/hda2 is the partition where your/boot is located */
    2. kernel/boot/vmlinuz-2.6.15-26-386 RO Dev=/dev/hda3/* Assume/dev/hda3 is your/your partition */
    3. Initrd/boot/initrd.img-2.6.15-26-386
    4. Boot

You can start the system.

The key question here is how to determine several partitions of the system:/boot//sbin

Ubuntu Live CD Repair Grub boot entry

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.