Fix GNU/Linux boot loader FROM Windows 10
Tags: linuxbootloader, windows10, boot, fix
Published: 2020-02-06 22:00:12

So you have a dual boot? Let's say you need that Win10 running close by because of the work (although MS Office apps get slower by the minute). Then you also have Manjaro, Ubuntu or something like that because WSL doesn't do the trick. And of course you need to update your Win10. What a great idea.

# Removing your GRUB or others from UEFI loader list

Aside from people reporting day by day more and more bugs with new updated/upgrades gotten through Update manager it comes with one more surprise: IT ALWAYS! ALWAYS! REMOVES YOUR BOOTLOADER and sets it's own as default one. So no now you can't boot to GNU/Linux. Aside from seriously thinking about going against all my principles(cheapness) and asking employer for a MacBook Pro and even buying two (for my UX/designer wife and myself), I really hate MS so much these days that I will probably at some point buy PS for games and use GNU/Linux exclusively + host everything either on DigitalOcean, AWS, GCP or anything other than Azure. Have you noticed maybe: they really p***ed me off with Azure bugs, slowness and it's support + now this! Ugh!

But let's try to fix some things

#CMD not PowerShell
Why? Well because MS doesn't care so if you run Powershell in Admin mode you might as well remember to type in cmd first, as PowerShell won't work with BCD for some reason (some PCs I think, not all of them, but please do inform me why is this if you know). If you get this ```sh 
The set command specified is not valid.
Run "bcdedit /?" for command line assistance.
The parameter is incorrect
``` then you know you have this issue with CMD over PS so you need either, as previously stated, type in *cmd* in powershell to switch or just rum CMD as admin in the first place

#BCD commands
Thanks to [this post](https://askubuntu.com/a/744840) there's a bunch of nice commands like ```sh 
bcdedit /enum firmware
``` that I learned and this one is to check where is your GRUB efi
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/wyyrz6hxijao8uc7voxi.png)

You can check list of loaders with `bcdedit` and it should look something like this
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/qpc446fuib0cod3c1gcm.png)

Goal is to replace that manager so first copy the record ```sh
bcdedit /set {bootmgr} path \EFI\Manjaro\grubx64.efi
```
Set it as first boot ```sh
bcdedit /set {fwbootmgr} displayorder {223530be-53f4-11e9-a11b-b6bc71c9efcb} /addfirst
``` where _{223530be-53f4-11e9-a11b-b6bc71c9efcb}_ should be the link to your linux firmware entry from the /enum frimware list

Watch out that partition for `{bootmgr}` should be something like partition=\Device\HarddiskVolume1 and not the C: drive

Check again with ```sh
bcdedit /enum firmware
```

If the first entry in list is Windows boot loader pointing to actual Windows remove it with ```sh
bcdedit /delete {id}
```
bcdedit should now return something like this![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4guv7rd6sn8z1btysf3f.png)

You can see that I don't bother changing name but the frimware needs to list something like this

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/t9n58h8g7lfgv3w7olxd.png)

where `{bc076f50-4923-11ea-b280-806e6f6e6963}` is my Frimware application for Manjaro and `{bootmgr}` is edited to point to Manjaro instead of Windows.

Now I'm not sure can you make this work without removing Windows one in firmware listings but my PC took listing Firmware app + changing bootmgr to Manjaro + removing Windows extra one at the top when using `
bcdedit /enum firmware` to fix it

That's it and good luck!