After Ubuntu is installed, the system grub prompts invalid arch independent elf magic error.

Source: Internet
Author: User

After ubuntu12.04 was launched, the 64-bit system was first installed for a period of time, and then the 32-bit system was re-installed. After the time period was used, the difference between the two was basically not realized, and the 64-bit system was changed back as needed, the installation was successful and the/home partition was not formatted.

After the conversion is completed, restart: grub prompt: "error: Invalid arch independent elf magic.

Grub Rescure>

Solution: Install the CD and start the machine

# Sudo Mount/dev/sda2/mnt

# Sudo Mount/dev/sda1/mnt/boot

# Sudo grub-install -- root-directory =/mnt/dev/SDA

Remove the disc and restart it.

Grub prompts errors such as file not found, but the system can be started.

When sudo Update-grub is executed, the error message disappears during GRUB boot and the problem is resolved.

This works too.

Start with live CD or live USB, and input the following commands in sequence on the Ubuntu terminal of live CD (Change X to the value recorded above) (the two statements need to be verified ):
If/boot is not partitioned separately:
Code:
Sudo Mount/dev/sdax/mnt
Sudo grub-install -- boot-directory =/mnt/boot/dev/SDA

If/boot is partitioned separately, then:
Code:
Sudo Mount/dev/sdax/mnt
Sudo grub-install -- boot-directory =/mnt/dev/SDA

More information

Http://forum.ubuntu.org.cn/viewtopic.php? F = 139 & t = 348503 & SID = 2611b20e761a2f8e6f3788d41d3c7475

Symptoms:
Boot display: grub Loading

Error: unknow filesystem

Grub rescue>

Cause:
The following operations have been found to cause this problem:
1. To delete Ubuntu, delete/format the partition where Ubuntu is located in windows.
2. Adjust the disk and use tools to merge, split, adjust, and delete partitions to change the number of disk partitions.
3. reinstall the system and install Linux to a new partition. The original partition has been formatted, but grub2 has not been re-installed.
4. Use the Ubuntu backup tool/derivative version manufacturing tool to restore the primary partition to the old version of 8. X. As a result, grub of the old version is grub1, and grub2 is destroyed.

Generally, the operator does not know that grub2 is divided into two parts, one part (generally) written on MBR, the other part is written in the/boot/GRUB directory of a partition (if/boot is separately partitioned, it is directly written in the/GRUB directory of the corresponding partition. As a result, the part in the MBR of grub2 cannot find the part in the/GRUB directory (or the part has been deleted ).

Ideas:
Method 1: Delete grub2 permanently so that the prompt does not appear again:
This method is applicable to people who no longer want to use Ubuntu and want to switch back to Windows.
This is very simple, as long as you have a Windows boot disk (not a ghost), use it to start, to select the installation location, do not actually install, exit and restart it.
You can also use it to start to the fault recovery platform and run fixboot or fixmbr.
Run bootrec.exe/fixmbr under the win7 command line.
(/Fixmbr repair MBR,/fixboot repair startup sector,/scanos detection installed win7,/rebuildbcd reconstruction BCD .)

Method 2: reinstall and fix grub2
1. Run the LS command to find the partition where Ubuntu is installed:
Run the following command under grub rescue>:

Code:Ls

All disk partition information is listed, for example:Reference:(Hd0, 1), (hd0, 5), (hd0, 3), (hd0, 2)

2. Call the following commands in sequence: X indicates the number of each partition.
If/boot is not partitioned separately, run the following command:Code:Ls (hd0, x)/boot/GRUB

If/boot is partitioned separately, run the following command:Code:Ls (hd0, x)/GRUB

Under normal circumstances, hundreds of files are listed. Many files have extensions:. Mod,. lst, And. IMG, and grub. cfg. If the file in the folder is displayed (hd0, 5), it indicates that Linux is installed in this partition.

4. If the correct grub directory is found, try to temporarily associate the two parts of grub as follows:
The following command does not have a separate partition for/boot:Reference:Grub rescue> set root = (hd0, 5)
Grub rescue> set prefix = (hd0, 5)/boot/GRUB
Grub rescue> insmod/boot/GRUB/normal. Mod

The command for separate partitioning of/boot is as follows: (these statements need to be verified)Reference:Grub rescue> set root = (hd0, 5)
Grub rescue> set prefix = (hd0, 5)/GRUB
Grub rescue> insmod/GRUB/normal. Mod

Then, call the following command to display the lost GRUB menu.
Grub rescue> normal
But don't be happy. If the problem persists during the restart, we need to go to Linux and fix grub.
Start up. After Entering Ubuntu, run the following command on the terminal:Code:Sudo Update-grub
Sudo grub-install/dev/SDA

(SDA is your hard disk number. do not specify a partition number, such as sda1 or sda5)
Have the grub Startup Menu been restored? Congratulations! recovery successful!
5. If the correct/GRUB directory cannot be found, for example, 3rd or 4 misoperations, try to find whether the Linux core file exists. Then, call the following command in sequence: X indicates the number of each partition:
Grub rescue>, enter:
If/boot is not partitioned separately:Code:Ls (hd0, x)/boot

If/boot is partitioned separately, then:Code:Ls (hd0, X)

Find a file named like a vmlinuz-3.0.0-12-generic, which is the Linux core file, if found, write down the value of X in (hd0, X. Assume that the files in the folder are displayed when (hd0, 5) is found.

Start with live CD or live USB, and input the following commands in sequence on the Ubuntu terminal of live CD ("5" in sda5 must be changed to the value recorded above) (These two sentences need to be verified ):
If/boot is not partitioned separately:Code:Sudo Mount/dev/sda5/mnt
Sudo grub-install -- boot-directory =/mnt/boot/dev/SDA

If/boot is partitioned separately, then:Code:Sudo Mount/dev/sda5/mnt
Sudo grub-install -- boot-directory =/mnt/dev/SDA

Then restart.

(The above two commands can also solve the problem of incorrect grub installation location during Ubuntu installation, and the grub is not installed in/dev/SDA, which causes the Ubuntu startup Item to directly enter windows during startup, however, you need to determine the number of "5" in sda5 .)
6. If you do not have any Linux core files, reinstall them.

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.