After installing the dual system, if you accidentally delete the Ubuntu boot entry during use, you will not be able to choose to enter the Ubuntu system after booting. After reinstalling the Windows system, I found that the original Ubuntu boot was missing. When these two situations occur, the best solution is not to reinstall the Ubuntu system, because the original Ubuntu system files are well stored on the disk. We only need to repair the Ubuntu boot file again and we can re-enter the Ubuntu system normally.
problem causes
After reinstalling win10, the system starts with only the windows boot item, and the original Ubuntu boot item disappears in the BIOS boot menu. (You can use the partition tool to confirm that the partition and data are there. I confirmed it by seeing that the disk content and partition size of the Ubuntu installation have not changed)
Step 1: Make Ubuntu USB installation disk
In fact, the steps are the same as the U disk installation disk created when installing dual systems.
1.1 Download ISO image
Download the iso image file on the Ubuntu official website and select the version you want to download. (I have installed both versions 18 and 20, and the installation steps are the same)
Taking Ubuntu 20.04.2.0 version as an example, download: ubuntu-20.04.2.0-desktop-amd64.iso
1.2 Use UltaISO software to create a USB installation disk
Prepare a blank USB flash drive of 4G or above (back up data first), download the official Chinese version of UltraISO Soft Disk Pass for free on the UltalSO official website , and then use this software to create a USB installation disk.
1. After installation, open the UltalSO software and click the second Open Image File tool in the toolbar, as shown in the red square button.
2. Then find the Ubuntu image file we downloaded in the "Open ISO File" dialog box that opens, and then click the "Open" button on the lower right.
3. After opening the image file, a preview of the opened image file will appear in the upper list. The specific directory is displayed on the left, and the directory and specific files are displayed on the right.
4. Next, start making the boot disk. Click "Start" on the menu bar, and then press the pop-up button to select "Write Hard Disk Image..." to open the "Write Hard Disk Image" dialog box. 5. In the Write Hard Disk Image dialog
box In the hard drive box, select the U disk we want to write to. The writing method can be USB-HDD or USB-HDD+. I chose USB-HDD+.
6. This step is very critical. It is related to whether the hard disk image we finally made can start the computer and install the system. Click "Easy Start", and then select "Write New Drive Boot Sector" in the pop-up menu. ”, and then select “Syslinux”. If there is no selection in this step, the final U disk image we make will not be able to recognize the hard disk and cannot install the system. 7. After selecting
“Syslinux”, a prompt box as shown in the figure below will pop up. There is no doubt that we should choose "yes" here.
8. The process of writing the Syslinux boot sector settings is very fast. After the writing is completed, a prompt box will pop up indicating that the writing is successful. If the writing is not successful, then we have to repeat steps 6 and 7 above.
9. Now it’s time to write the files in the ISO to the USB flash drive. Click the “Write” button below, and a warning box will pop up that all data on the USB flash drive will be lost. Click “Yes” to start the USB flash drive installation. The disk is written, and the writing process takes several minutes.
11. The completion rate is 100%. Open "This Computer" and we can see that the name (or icon) of the USB flash drive has changed. In fact, this information is extracted from the image file. This means that the boot disk is completed and now we can safely eject the USB disk.
Step 2: Start the preview version of Ubuntu system from the USB disk
1. Connect the bootable USB flash drive to the port on the computer.
2. When the PC brand logo appears when the computer is just turned on, press the F12 key several times quickly to go to the one-time boot menu. The available boot options will be displayed in this menu. (To enter the BIOS one-time boot selection menu for Dell brand, press the F12 key. For other brands, you may need to search online)
3. Select the option to boot from USB (different from Windows boot). After selecting, press ENTER.
4. When the computer restarts, select the Try Ubuntu option. (Note that installation is not required here. If you install it directly, all the files in Ubuntu will be gone. If there is no way to repair the boot in the end, choose this to reinstall.)
Step 3: Enter the preview version of Ubuntu system
First make sure you are connected to the Internet, then open the terminal (shortcut key Ctrl+Alt+T), enter the command, and add the source where boot-repair is located:
sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update
As shown below:
Step 4: Execute the repair command
After the command in step 3 is executed, continue to enter the following command to install boot-repair and enable boot-repair:
sudo apt-get install -y boot-repair && boot-repair
The following interface appears, wait for a while.
The following interface will appear after a while. Click Recommended repair and continue waiting for repair.
After a while, a prompt interface indicating that the boot repair is completed will appear. At this time, choose to shut down and follow the prompts to safely remove the USB flash drive and restart the computer to enter Ubuntu boot.
common problem
1. Follow the above operations and the repair is unsuccessful.
If the above has been executed successfully, you can skip this step, otherwise, we can enter the command ourselves to fix it:
sudo recommended repair
After success, various information about our disk and boot information will pop up.
2. I mistakenly clicked on the second item Create a BootInfo summary.
Your startup screen will appear with a lot of things you haven't seen before. In that case, you can enter the command:
cd /boot/grub
Then enter:
sudo gedit grub.cfg
After opening the grub.cfg file, find windows through search, then delete the following and it will be the same as before.
### BEGIN /etc/grub.d/25_custom ###
menuentry "efi/EFI/Boot/bootx64.efi" {
search --fs-uuid --no-floppy --set=root d000ed6a-5303-40aa-a517-af50e807c0e9
chainloader (${root})/efi/EFI/Boot/bootx64.efi
}
menuentry "efi/EFI/ubuntu/MokManager.efi" {
search --fs-uuid --no-floppy --set=root d000ed6a-5303-40aa-a517-af50e807c0e9
chainloader (${root})/efi/EFI/ubuntu/MokManager.efi
}
menuentry "Windows UEFI recovery bootmgfw.efi" {
search --fs-uuid --no-floppy --set=root A603-846C
chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
}
menuentry "Windows Boot UEFI recovery" {
search --fs-uuid --no-floppy --set=root A603-846C
chainloader (${root})/EFI/Boot/bkpbootx64.efi
}
menuentry "EFI/ubuntu/MokManager.efi sda2" {
search --fs-uuid --no-floppy --set=root A603-846C
chainloader (${root})/EFI/ubuntu/MokManager.efi
}
menuentry "Windows UEFI recovery LrsBootmgr.efi" {
search --fs-uuid --no-floppy --set=root 7607-5674
chainloader (${root})/efi/Microsoft/Boot/LrsBootmgr.efi
}
menuentry "Windows Boot UEFI recovery bkpbootx64.efi" {
search --fs-uuid --no-floppy --set=root 7607-5674
chainloader (${root})/efi/Boot/bkpbootx64.efi
}
### END /etc/grub.d/25_custom ###
Reference link: https://blog.csdn.net/piaocoder/article/details/50589667