2

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?

cipricus
  • 3,444
  • 2
  • 34
  • 85
Marietto
  • 575
  • 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/ – oldfred Jun 20 '21 at 14:05
  • 1
    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 ? – Marietto Jun 20 '21 at 14:11
  • 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. – oldfred Jun 20 '21 at 14:18
  • 1
    it worked with ubuntu in live mode. thanks. – Marietto Jun 20 '21 at 16:24
  • 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 and answer based on your experience? – cipricus Jun 22 '21 at 14:02
  • 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. – Marietto Jun 22 '21 at 14:39

2 Answers2

1

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

Marietto
  • 575
0

Use the --target=i386-pc flag.

Source: https://wiki.archlinux.org/title/GRUB#Master_Boot_Record_(MBR)_specific_instructions