Fix Ubuntu Linux Startup items

Source: Internet
Author: User

This is just a backup, the original text I refer to here, has helped me to solve the grub broken repair, avoid the reload system.

This is often the case when you use a dual system before. My windows collapsed, but the system did not do Gho backup, then how to do it, I think only re-install the road. After the reload Windows normal, the heart flattered. But suddenly found that my Linux startup item is missing, so we are not sad to urge it?

In this case, it is common for people to choose to reinstall Linux. In fact, it is not necessary, because our Linux system is still intact, just because the reload of Windows caused our Linux startup item grub2 damaged. All we have to do is fix the startup item.

There are a lot of ways to fix startup items, and here I'll show you one of the most common ways to fix this-by LiveCD.

Use Ubuntu 11.04 livecd to fix GRUB2 's boot today.

Start Ubuntu 11.04 CD, select LiveCD mode, enter the terminal (CTRL+ALT+T) after entering, first enter the following command in the terminal:

sudo fdisk-l (note is the lowercase l, not the number 1)

This step is used to determine the location of the partition where the Ubuntu11.04 is installed in the computer, input will be similar to the following information, to find the line ID 83, remember the/DEV/SDAX situation, such as my computer is/DEV/SDA7, the following as an example.

disk/dev/sda:80.0 GB, 80026361856 bytes
255 heads, Sectors/track, 9729 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Disk identifier:0x624aa2e0
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 1388 11149078+ 7 Hpfs/ntfs
/dev/sda2 1389 3825 19575202+ 7 Hpfs/ntfs
/dev/sda3 3826 9729 47423880 f W95 Ext ' d (LBA)
/dev/sda5 3826 5851 16273813+ b W95 FAT32
/dev/sda6 5852 8323 19856308+ b W95 FAT32
/DEV/SDA7 8324 9598 10241406-up Linux
/dev/sda8 9599 9729 1052226, Linux Swap/solaris

And then enter
Sudo-i
This step is used to get root privileges and to facilitate the following actions

then enter

Mkdir/media/tempdir

This is used to create a folder TempDir, which is used to mount just the SDA7, that is, your Ubuntu "/" Mount HDD partition. This folder name you can depend on personal interests, not too many requirements

Re-enter

Mount/dev/sda7/media/tempdir

Mount the SDA7 in the TempDir folder

If you mount the Ubuntu boot and home partitions separately, how do you do that?

This is the partition table for my computer:

disk/dev/sda:320.1 GB, 320072933376 bytes
255 heads, Sectors/track, 38913 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0xf0b1ebb0
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 102400 7 Hpfs/ntfs
/dev/sda2 6375 51103744 7 hpfs/ntfs
/dev/sda3 6376 38914 261362638 f W95 Ext ' d (LBA)
/dev/sda5 6376 15298 71672942 7 hpfs/ntfs
/dev/sda6 15298 25497 81920000 7 hpfs/ntfs
/dev/sda7 25497 35696 81920000 7 hpfs/ntfs
/dev/sda8 35696 35708 96256-up Linux
/dev/sda9 35708 35770 498688, Linux Swap/solaris
/DEV/SDA10 35770 36144 2999296-up Linux
/DEV/SDA11 36144 38914 22249472-up Linux

As you can see, I've mounted two file systems alone, in addition to/and swap. I mounted the/boot and/home.
Then you need to do the following:

Mount/dev/sda11/media/tempdir (My/partition is SDA11)
Mount/dev/sda8/media/tempdir/boot (My boot partition is SDA8)

Below, enter the most critical and exciting moment of this recovery, and enter the following command at the terminal:

Grub-install–root-directory=/media/tempdir/dev/sda

This step is used to reinstall GRUB2 into the hard drive's master boot Record "MBR" inside, very critical!

Enter later if "Installation finished" appears. No Error reported. " character, it means that the operation was successful. But now only half of the success, the following operations can be completely successful.

At this time to restart your computer, you can see the GRUB2 boot interface, but this can only be used to boot Ubuntu 10.04, but also temporarily unable to boot Windows 7, then choose to go to Ubuntu 11.04, then find and start the terminal, enter the following command in the terminal:

sudo update-grub2

Follow the prompts to enter the password, if successful, will appear similar to the following statement, that means success.

Grub.cfg ...
Found Debian Background:moreblue-orbit-grub.png
Found Linux Image:/boot/vmlinuz-2.6.31-15-generic
Found initrd Image:/boot/initrd.img-2.6.31-15-generic
Found memtest86+ Image:/boot/memtest86+.bin
Found Windows 7 (loader) on/dev/sda1
Done

If this is not the case, then you can search for grub in the new, install the GRUB-PC with the Ubuntu logo, and then enter

sudo update-grub2

Update the GRUB2 on the go.

That way, we're done. When the boot, did you see the familiar picture? Stir it up, haha!

Now, there is a more popular way, is the use of some GRLDR tool software to restore Ubuntu Startup items, this method is relatively simple, do not require too many command line operations, and do not need to LiveCD. I share this approach to you, and you can refer to it.

GRLDR is a file inside grub, a friend who is not familiar with grub may not know, but if you have used a key ghost, Maxdos, Dwarf dos Toolbox, and so on software, You should know the name: None of these software uses grub or GRLDR to boot the floppy image or system boot file that they saved on your hard drive. No grub and GRLDR (including Avldr, Isomenu, etc. are derived from grub or GRLDR, and you are the way to derive a personalized hard drive boot file yourself. ), it will not be by the presence of these softwares.

First step: Download GRLDR
: http://forum.ubuntu.org.cn/download/file.php?id=79193
Download the extract and put g2ldr.mbr and g2ldr on the root of the first disk
(In general, C, if you install Win7, the system reserved partition is placed in the system reserved Partition)

Step Two: Create a new boot. ini file
Write the following content:
C:\g2ldr.mbr= "Ubuntu11.04″

Step Three: Restart
Reboot to see ubuntu11.04 's Startup Items
Select the ubuntu11.04 startup entry to enter Ubuntu

Fourth step: Use the Ubuntu bootloader to boot back to Win7
$sudo GRUB-INSTALL/DEV/SDA
$sudo Update-grub

After the success you will restart into the Win7, the C disk just put g2ldr.mbr,g2ldr and boot. INI removed it OK

This will lead you back to your ubuntu11.04.

Fix Ubuntu Linux Startup items

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.