How to set grub as the boot manager?

I recently bought a new HP computer, it is running on Windows 10 and I installed Ubuntu 16.04, but everytime I turn on the PC it goes straight to Windows, so how can I fix this to set up grub at the boot time. I can access Ubuntu from Windows Advanced Restart settings, but that's the only way. I have disabled the secure boot on the bios and the fast startup for Windows but it didn't work.


Solution 1:

Run this from windows command prompt

bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi

Solution 2:

This issue can be resolved by installing boot-repair package by following these steps:

1) Open a terminal and run these commands:

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair

2) Then run boot-repair by sudo boot-repair and use "Recommended repair". Then boot-repair will scan boot paths and correct them and update your grub configuration and set grub as the default bootloader of your system.