Score:1

Grub not recognizing Windows after fresh Ubuntu install on new drive

pe flag

I know this is a very common question but none of the answers I read worked for me so far. I have two M.2 NVMe SSD. I have installed Windows 10 in one, and wanted to install Ubuntu 20.04 on the other one. I figured the safer way for me to do it was to unplug the Windows drive and do a fresh install. Then, plug it in and run sudo update-grub for it to recognize the Windows install in the other drive.

But life isn't that easy (or I'm missing something) :'(

$ sudo update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.8.0-63-generic
Found initrd image: /boot/initrd.img-5.8.0-63-generic
Found linux image: /boot/vmlinuz-5.8.0-43-generic
Found initrd image: /boot/initrd.img-5.8.0-43-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done
$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0         7:0    0  55,5M  1 loop /snap/core18/1988
loop1         7:1    0   219M  1 loop /snap/gnome-3-34-1804/66
loop2         7:2    0  64,8M  1 loop /snap/gtk-common-themes/1514
loop3         7:3    0    51M  1 loop /snap/snap-store/518
loop4         7:4    0  31,1M  1 loop /snap/snapd/11036
nvme1n1     259:0    0 465,8G  0 disk 
└─nvme1n1p1 259:1    0 465,8G  0 part /media/username/System
nvme0n1     259:2    0 465,8G  0 disk 
└─nvme0n1p1 259:3    0 465,8G  0 part /

The entry for:

nvme1n1     259:0    0 465,8G  0 disk 
└─nvme1n1p1 259:1    0 465,8G  0 part /media/username/System

is the drive where Windows lives in.

$ sudo fdisk -l
Disk /dev/loop0: 55,48 MiB, 58159104 bytes, 113592 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 218,102 MiB, 229629952 bytes, 448496 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop2: 64,79 MiB, 67915776 bytes, 132648 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop3: 51,4 MiB, 53522432 bytes, 104536 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop4: 31,9 MiB, 32595968 bytes, 63664 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/nvme1n1: 465,78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: PNY CS3030 500GB SSD                    
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: 0xdef856b7

Device         Boot Start       End   Sectors   Size Id Type
/dev/nvme1n1p1       2048 976771071 976769024 465,8G  7 HPFS/NTFS/exFAT


Disk /dev/nvme0n1: 465,78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: PNY CS3030 500GB SSD                    
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: 0x84bb543f

Device         Boot Start       End   Sectors   Size Id Type
/dev/nvme0n1p1 *     2048 976771071 976769024 465,8G 83 Linux

Also:

$ [ -d /sys/firmware/efi ] && echo "Installed in UEFI mode" || echo "Installed in Legacy mode"
Installed in Legacy mode

I am wondering, what can I do to get Windows added to the GRUB and be able to dual-boot?

Thank you very much in advance. Let me know if you need any more information

UPDATE 1:

First, I removed my Ubuntu drive and my Windows wasn't booting :( I realized I had other drives that had unplugged. I plugged them in and it booted windows normally. Apparently, the windows bootloader has been installed somewhere else. Weird! I unplugged everything but the Windows drive to try and solve the bootloader issue.

I went and try different things from the Windows side. I created a media installation drive and booted to the troubleshoot area. There I got in the command line prompt and used diskpart to make the Windows Partition active

I use bootrec /fixmbr, bootrec /fixboot, and bootrec /rebuildbbcd. This wasn't working either. Then I use bcdboot c:\windows /d and that did the job. I restarted and booted Windows normally without any other drives plugged in.

Plugged in my Ubuntu drive and ran sudo update-grub

Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.8.0-63-generic
Found initrd image: /boot/initrd.img-5.8.0-63-generic
Found linux image: /boot/vmlinuz-5.8.0-43-generic
Found initrd image: /boot/initrd.img-5.8.0-43-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 10 on /dev/nvme1n1p1
done

At last!

PS: Don't know if I should make this update an answer to my own question to help others. I'll try later.

oldfred avatar
cn flag
It looks like both systems are in old BIOS/MBR configuration. So it may be Windows fast start up is on? https://askubuntu.com/questions/843153/unable-to-mount-windows-10-partition-it-is-in-an-unsafe-state & https://askubuntu.com/questions/145902/unable-to-mount-windows-ntfs-filesystem-due-to-hibernation If your hardware supports 2 NVMe drives it is UEFI. Microsoft has required vendors to install Windows in UEFI boot mode to gpt drives since 2012. User could install in BIOS mode, but that was more to support old hardware.
C.S.Cameron avatar
cn flag
I agree with oldfred, if Windows boots in UEFI mode, then Ubuntu must be installed in UEFI mode for GRUB to work with Windows.
DarK_FirefoX avatar
pe flag
@oldfred, I am not sure if fast startup is on, and I will check, but I am able to mount the drive containing Windows on Ubuntu
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.