Grub cannot be started after Linux is installed

Why can’t you stop buying 618?From the technical dimension to explore>>>

After using unetbootin to make a startup USB disk and install Linux, there is a problem in the installation process. After restart, it will display:
error: invalid arch independent elf magic.
grub rescue & gt

The solution is as follows:

After booting with USB flash drive

1. Check the partition

sudo fdisk -lu /dev/sda

The display is as follows:

Disk /dev/sda: 500.1 GB, 500107862016 bytes

255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0xde6c93b8

Device Boot Start End Blocks Id System

/dev/sda1 63 58589054 29294496 83 Linux

/dev/sda2 58589184 976773119 459091968 5 Extended

/dev/sda5 58591232 967903231 454656000 83 Linux

/dev/sda6 967905280 976773119 4433920 82 Linux swap/Solaris

2. Mount the system as a partition of Linux

Sudo mount/dev/sdax/MNT # x is the partition where/is located

Sudo mount/dev/sdax/MNT/boot ᦇ when/boot is a separate partition

If there is no/MNT/boot, you can use MKDIR to create it

3. Repair grub

sudo grub-install –root-directory=/mnt /dev/sda

References:

http://blog.sina.com.cn/s/blog_ a2d4803001013vqk.html

When there is no file or command when using grub install, try the following methods:
reason: grub does not find the command file in the partition where the system is located
1. Restart grub save # the error message is error: file not found
2. Use set command to view prefix and root
3. Use LS command to view hard disk partition # display (HD0, msdos1)
(HD0, Msdos1) is equivalent to sda1, and so on
4. Find the location of the system and grub command file one by one on the hard disk partition
system search: LS (HD…)/# be careful not to lose ‘/’
# if there are many system files in the result, it may be the partition where the system is located
# but in most cases, because the partition has been selected when installing the system, Therefore, this step is mainly to verify the
grub command file search: LS (HD…)/boot/grub
?If there are a large number of mod files, it is the location of grub command file
5. According to the results of the previous step, set prefix and root
set prefix = (HD…)/boot/grub # grub command file location
set root = (HD…) # system file partition
6 Insmod normal # load normal module
7, normal # enter normal mode
8, insmod Linux # load Linux command module
9, Linux/boot/vmlinuz -… Root =/dev/sdxy ro # load Linux core
# vmlinuz -… File should be in system file/boot, you can use tab to automatically complete
# sdxy is the partition of the system, such as sda1. It should be determined according to the previous search results
# do not lose the last ‘ro’
10, initrd/boot/initrd -… # load initrd
11, boot # start the system
12, the previous changes are not actually written to grub, so you need to save the settings in the boot system
you can use updata grub and grub install to repair

Reference materials:
1 https://help.ubuntu.com/community/Grub2/Troubleshooting

Attachment: in addition to the above methods, you can use boot repair
boot repair is a grub repair tool with graphical interface
it is recommended to download ISO file, burn boot disk or make boot U disk
for specific information, please refer to: https://help.ubuntu.com/community/Boot-Repair

Similar Posts: