If you use two operating systems on your computer, Windows and Linux, and have upgraded your Windows from 7, 8 or 8.1 to the newest Windows 10, you may have problems with the Grub loader when using UEFI protected boot. During the update of the Windows 10 system, the Grub loader will simply be overloaded and write its own there.
Further, after restarting the system, the user expects to see the Grub operating system selection menu, but instead a new Windows 10 is loaded. It may seem that there is no way to access Ubuntu or that Ubuntu cannot run alongside Windows 10. But this is not the case.
Experts often advise installing Ubuntu on another disk, but there is a simple solution. You can always use the standard method, for example, using a LiveCD disk. But if you are using UEFI, there is a solution using Windows 10.
To start, click on the search icon in Windows, type cmd there and find The Windows command prompt. Right-click on it and select Run as administrator:
Next, you can try to guess the name of the Grub bootloader file on the EFI partition, but you can do it differently and just look. To connect the EFI partition, run diskpart. To do this, run:
$ diskpart
Then output a list of available disks:
$ list disk
Select as the active disk on which Windows 10 is installed and on which the EFI partition is currently located:
$ sel disk 0
Output a list of partitions on the disk:
$ list vol
Find the EFI partition, it is usually formatted in the FAT file system and takes up about 100 megabytes of space. In this case it is volume 2:
This section should be assigned a letter. To do this, run:
$ sel vol 2
$ assign letter=I:
Now you need to find the bootloader file on the EFI partition. But you can't open this section in Explorer, you just need to use the command line. Close DiskPart and run:
$ cd /d I:
Then use the dir command to find the Grub loader. For example:
$ dir EFIUbuntu
There is a grubx64.efi file here. It's him. The loader may be called differently in other distributions, which is why I told you how to see everything.
Now copy and execute this command:
bcdedit /set {bootmgr} path EFIubuntugrubx64.efi
You do not have to enter a password if you have administrator rights and the program should work normally. This command will write back the Grub loader instead of the Windows 10 loader.
If the command returned an error, you can roll back the changes with this command:
$ bcdedit /deletevalue {bootmgr} path EFIubuntugrubx64.efi
Then you can enable booting of the Windows 10 stub:
$ bcdedit /set {bootmgr} path EFIMicrosoftBootootmgfw.efi
Restart your computer and you will see the familiar Grub on the screen. This completes the Grub recovery process.
Apply the discount by inserting the promo code in the special field at checkout: