This article applies to three situations
1. After using tar to restore the backup, grub has a problem and cannot be started. This is common after the partition is changed.
2. When linux is started, minimal bash-like line editing is supported cannot be started normally.
3. elf header smaller than expected and other issues occur when linux is started.
In short, a problem occurs in grub, which causes linux to fail to start normally.
Requirement: Live CD is available.
The procedure is as follows:
1. Mount/partition on your hard disk after entering live cd. my options are/dev/sda6.
Sudo mount/dev/sda6/mnt
Ii. Mount/dev/proc/sys
Sudo mount -- bind/dev/mnt/dev
Sudo mount -- bind/proc/mnt/proc
Sudo mount -- bind/sys/mnt/sys
3. This step is very important!
Are you sure you want to partition the boot partition separately?
If it is a separate partition, You need to mount the/boot partition. It is best to mount all other file systems.
Sudo mount/dev/sda1/mnt/boot
Sudo mount/dev/sda7/mnt/home
4. Change the chroot system after mounting
Chroot/mnt
Unmount the old grub
Apt-get purge grub-pc
Install the new
Apt-get install grub-pc
Grub-mkconfig
Grub-install/dev/sda
Exit
Umount/proc
Umount/dev
Umount/sys
Umount/dev/sda1
Umount/dev/sda7
Umount/dev/sda6
Reboot
This will succeed.
The most important thing is to mount the/boot partition. If your boot is partitioned separately, do not forget to mount it. Otherwise, it will not succeed!