This article applies to the following three cases: 1. grub fails to be started after the backup is restored with tar, this is common after the partition is changed. 2. when linux is started, minimalbash-likelineeditingissupported cannot be started normally. 3. when linux is started, elf appears.
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!