Windows autobooting on UEFI

The problem

If you're multi-booting your system alongside Windows with UEFI. You might be running into an issue which has been bugging me for some time now; Windows always boots by default irrespective of the boot order.

As it turns out, this is because Windows also installs it's bootloader to the fallback location of EFI/BOOT/bootx64.efi.

The solution

At first I thought that deleting the fallback bootloader would be enough, but Windows reinstalls the bootloader every time it gets booted.

The solution that works for me is to replace EFI/BOOT/ directory with an empty file which stops Windows from creating the fallback bootloader.

So with the ESP mounted to /boot, all you have to do to fix it is:

# rm -r /boot/EFI/Boot/
# touch /boot/EFI/Boot

This doesn't remove the proper Windows bootloader which is stored in EFI/Microsoft/ so everything should work.