Score:2

How to reinstall grub2 after installing Windows 11 (on a dual boot system with Ubuntu 18.04)

in flag

I've just installed Windows 11 on the first partition of my disk,that's partitioned like this :

# fdisk /dev/sdb -l

Disk /dev/sdb: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: Samsung SSD 860 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1967ba67

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdb1  *         2048 273092607 273090560 130.2G  7 HPFS/NTFS/exFAT
/dev/sdb2       273092608 274454527   1361920   665M 27 Hidden NTFS WinRE
/dev/sdb3       274456576 276553727   2097152     1G 82 Linux swap / Solaris
/dev/sdb4       276553728 976772477 700218750 333.9G 83 Linux

As you can see, Ubuntu 18.04 is installed on /dev/sdb3 and /dev/sdb4.

Previously Windows 10 was installed instead of Windows 11.

The problem is that the installation of Windows 11 broke grub2 that was installed on top of the disk /dev/sdb and now I want to reinstall it. I've tried to do like this :

# sudo grub-install --recheck --no-floppy --root-directory=/ /dev/sdb

But it gives this error :

Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.

I think that it is a bug, because it detects an EFI partition, which isn't there. The disk has been formatted with MBR and it is DOS style and I have installed Windows 11 using RUFUS using the MBR method. Even /dev/sda is not EFI style :

# fdisk /dev/sda -l

Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: CT500MX500SSD4  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xa6e39599

Device     Boot Start       End   Sectors   Size Id Type
/dev/sda1  *     2048 976767672 976765625 465.8G 83 Linux

What's the right procedure here to reinstall grub2?

oldfred avatar
cn flag
Are you sure you want BIOS/MBR not UEFI/gpt? Microsoft has required vendors to install in UEFI/gpt mode since 2012. BIOS drivers may not be as well supported in the future. Windows in BIOS mode was known to delete Linux logical partitions. It looks like you only have primary. You can just use Boot-Repair's advanced mode and reinstall grub from your Ubuntu live installer boot in BIOS mode manually or with Boot-Repair added. https://help.ubuntu.com/community/Boot-Repair & https://sourceforge.net/p/boot-repair/home/Home/
in flag
Does the boot-repair tool works if I don't use the ubuntu live installer but I use the ubuntu os that I have installed on /dev/sda ?
oldfred avatar
cn flag
You can add Boot-Repair to any working version of Ubuntu. Can you boot? Some get a system to boot with Supergrub. supergrub & Rescatux https://www.supergrubdisk.org/rescatux/ & https://askubuntu.com/questions/1186273/ubuntu-dual-boot-booting-into-windows I used to use Supergrub for my older BIOS systems. Have not used Rescatux, but have it on a flash drive somewhere. For UEFI I use rEFInd for emergency boot and it fits on an old 256MB flash drive that was too small for anything else. I suggest having multiple repair tools for both Windows & Ubuntu.
in flag
it worked with ubuntu in live mode. thanks.
br flag
`it worked with ubuntu in live mode. thanks` - You mean you have fixed this? Please post an answer under your own question, it may prove helpful in the future. Have you used boot-repair? Could you please take a look at [this question](https://askubuntu.com/q/1346846/925128) and answer based on your experience?
in flag
yes. I've used the ubuntu 21.04 in "try" mode and I have installed Boot-Repair. I've chosen to reinstall grub2 on the /dev/sdb and it did all the necessary steps correctly.
Score:1
in flag

I've used ubuntu 21.04 in "try" mode and I have installed Boot-Repair. I've chosen to reinstall grub2 on the /dev/sdb and it did all the necessary steps correctly. After rebooting I was able to boot ubuntu 18.04 installed on /dev/sdb4

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.