7

Usually when we install Windows after installing GNU/Linux, we usually lose the Grub. Which is the best way to recover grub when we lost grub or what are the possible different ways.

hildred
  • 5,829
  • 3
  • 31
  • 43
user3539
  • 4,378

2 Answers2

3

You need to boot system using LiveCD of ubuntu and run below command to install grub :

sudo grub-install /dev/XXX

above command will install grub and it also Keep windows bootloader NTLDR into grub , then you can choose any one OS while boot.

/dev/XXX this is your HDD where ubuntu installed (eg: grub-install /dev/sdb).

Please refer below link for more information :

https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows

Rahul Patil
  • 24,711
1

Late but the problem is as recent as it can be. I managed to avoid creating an up-to-date Live CD/USB stick to issue the recommended range of commands. From within Windows 10 Command Prompt (not PowerShell!) with admin rights, I used:

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

for EFI Secure Boot. You can normally use

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

More details and screenshots here and here.

mfg
  • 111
  • At least for Windows 7 didn't work. – David Magalhães Mar 21 '21 at 23:26
  • Hi, I see, W7 was the one back then, so which errors did you get if any? Unfortunately, the guides I used assume that W10 is installed. I added that detail. – mfg Mar 22 '21 at 00:24
  • No errors. But on restart nothing changed. – David Magalhães Mar 22 '21 at 01:00
  • Hmm, maybe settings like bootmgr might have changed from W7 to W10. See e.g. https://neosmart.net/wiki/bcdedit/#BCDEdit_on_Windows_7 Maybe try bcdedit /? to find out. Moreover, are you using EFI at all? Is there a grubx64.efi file in the partition? – mfg Mar 22 '21 at 07:43