It’s reinstalledoperationsystem, grub was also overwritten. In order to restore startup, I took a live CD of Ubuntu and started it. After entering Linux, I entered the command line to restore grub.
First mount the original / partition
sudo mkdir /mnt/root
sudo mount /dev/sda7 /mnt/root
sudo mount -t proc none /mnt/root/proc
sudo mount -o bind /dev /mnt/root/dev
If you don’t know the device name of the / partition, you can use sudo fdisk – L to view it.
Use chroot to enter the original / partition
chroot /mnt/root /bin/bash
source /etc/profile
Restore grub
sudo grub-install –no-floppy /dev/sda
Failure, prompt “the file / boot / grub / stage1 not read correctly”
I searched the relevant articles on the Internet and found that it was caused by the change of partition, which was related to the files fstab and mtab.
Edit / etc / mtab and find that the partition device of / is wrong. After modification, run again
Grub install / dev / SDA succeeded.
After restart, enter grub and select Linux. It is found that the partition cannot be found. Edit the grub option with E and change the root to the correct partition device.
Then enter the B command to start. Modify the menu before restarting Lst, this problem will not occur.