0

I dual boot Windows 10 and Ubuntu 18.04. Space on my SSD was getting a little cramped so I wanted to delete my large swap partition and use a swapfile instead like in the default installation. I correctly created a swap file and edited the appropriate line in fstab and rebooted and free showed it was using the file. I booted into a live usb of ubuntu and ran gparted to delete the swap partition and extended ubuntu to free space and it went well.

When I tried to boot grub2 kept going to rescue mode. I tried to boot to windows but it gave me an error. I rebooted into the live usb to run boot repair and couldn't get it to fix grub so I switched over to repair MBR and I was able to boot into Windows again but gives me no option to boot ubuntu.

Now I try reinstalling grub with boot repair and it keeps giving me errors. I have pastebin here and it says something about not finding EFI partition. sudo fdisk -l gives this:

Disk /dev/loop0: 1.8 GiB, 1864450048 bytes, 3641504 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: 86.9 MiB, 91099136 bytes, 177928 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: 34.7 MiB, 36323328 bytes, 70944 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: 140.9 MiB, 147722240 bytes, 288520 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: 2.3 MiB, 2433024 bytes, 4752 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/loop5: 13 MiB, 13619200 bytes, 26600 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/loop6: 14.5 MiB, 15196160 bytes, 29680 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/loop7: 3.7 MiB, 3887104 bytes, 7592 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/nvme0n1: 477 GiB, 512110190592 bytes, 1000215216 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
Disklabel type: dos
Disk identifier: 0x0001a5ef

Device         Boot     Start        End   Sectors  Size Id Type
/dev/nvme0n1p1 *         2048  914407423 914405376  436G  7 HPFS/NTFS/exFAT
/dev/nvme0n1p2      914407424  915329023    921600  450M 27 Hidden NTFS WinRE
/dev/nvme0n1p3      915331070 1000214527  84883458 40.5G  5 Extended
/dev/nvme0n1p5      915331072 1000214527  84883456 40.5G 83 Linux


Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
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: 0x6f63051a

Device     Boot      Start        End    Sectors   Size Id Type
/dev/sda1             2048     206847     204800   100M  7 HPFS/NTFS/exFAT
/dev/sda2           206848 1953110015 1952903168 931.2G  7 HPFS/NTFS/exFAT
/dev/sda3  *    1953110016 1953519615     409600   200M  7 HPFS/NTFS/exFAT


Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 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
Disklabel type: dos
Disk identifier: 0x0000ddff

Device     Boot Start       End   Sectors   Size Id Type
/dev/sdb1  *     2048 976769023 976766976 465.8G  7 HPFS/NTFS/exFAT




Disk /dev/sdc: 232.9 GiB, 250059350016 bytes, 488397168 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
Disklabel type: dos
Disk identifier: 0xb95cbb7b

Device     Boot Start       End   Sectors   Size Id Type
/dev/sdc1        2048 488394751 488392704 232.9G  7 HPFS/NTFS/exFAT


Disk /dev/sdd: 29.7 GiB, 31914983424 bytes, 62333952 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
Disklabel type: dos
Disk identifier: 0x663eb4c4

Device     Boot   Start     End Sectors  Size Id Type
/dev/sdd1  *          0 3815135 3815136  1.8G  0 Empty
/dev/sdd2       3737268 3741939    4672  2.3M ef EFI (FAT-12/16/32)

I know I have a lot of physical drives with old installations but the one I want is on /dev/nvme0n1 which is my main boot drive. I have my ubuntu with a custom set up for my development environment so I really don't want to reinstall ubuntu if it's just boot errors. How do I setup grub2 to be the default boot manager.

EDIT: I tried creating an EFI partition following this guide and I created the partition but I can't install grub. sudo update grub outputs /usr/sbin/grub-probe: error: failed to get canonical path of ``/cow'. (only one backtick near cow) As requestedsudo parted -l gives this

Model: ATA WDC WD10EARX-00N (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  106MB   105MB   primary  ntfs
 2      106MB   1000GB  1000GB  primary  ntfs
 3      1000GB  1000GB  210MB   primary  ntfs         boot


Model: ATA Samsung SSD 850 (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  500GB  500GB  primary  ntfs         boot


Model: ATA Samsung SSD 850 (scsi)
Disk /dev/sdc: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  250GB  250GB  primary  ntfs


Warning: The driver descriptor says the physical block size is 2048 bytes, but
Linux says it is 512 bytes.
Ignore/Cancel?                                                            
Ignore/Cancel? ignore                                                     
Model: Generic- SD/MMC (scsi)
Disk /dev/sdd: 128GB
Sector size (logical/physical): 2048B/512B
Partition Table: mac
Disk Flags: 

Number  Start   End     Size    File system  Name   Flags
 1      2048B   6143B   4096B                Apple
 2      1913MB  1916MB  2392kB               EFI


Model: NVMe Device (nvme)
Disk /dev/nvme0n1: 512GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size    File system  Name                  Flags
 3      1049kB  211MB  210MB   fat32        EFI System            boot, esp
 1      211MB   468GB  468GB   ntfs         Microsoft basic data  msftdata
 2      468GB   469GB  472MB   ntfs         Windows RE            diag
 5      469GB   512GB  43.5GB  ext4         Linux filesystem

Edit 2: So I was able to boot my ubuntu installation into efi mode and was able to install grub-efi. I was able to enable secure boot and disable CSM and ubuntu still loaded. Only issue is Windows won't boot now though I assume because it still thinks its in MBR mode. Im making a live windows usb to fix the issue though I don't know if it'll mess up the EFI partition I setup. Is that the correct way to fix it?

  • You are showing Windows UEFI boot entries and booted Ubuntu live installer in UEFI boot mode. But drives look like they all are configured for BIOS/MBR. Windows only boots in BIOS mode from MBR and only from gpt with UEFI. You do not show a FAT32 ESP - efi system partition on NVMe drive, but script does not fully parse NVMe drives. So was system booting with BIOS or UEFI? The grub in the MBR of sdb, looks for the UUID of the ext4 partition in the NVMe drive, but you must boot in BIOS mode from sdb drive. – oldfred Sep 12 '18 at 19:40
  • So if u run the live USB in legacy mode it'll fix it correctly? I'm not sure what I was booting b4 tbh. I do plan on installing a 2tb+ hdd in the future so I'd like to boot them into uefi mode for the future. – AndroidDragon Sep 12 '18 at 19:51
  • It would give a clearer picture of your partition details if you ran sudo parted -l and printed that output instead of fdisk -l. – Paul Benson Sep 12 '18 at 21:02
  • Have you just tried booting in BIOS mode from sdb drive? If you want Windows in UEFI mode, you have to totally reinstall and convert drive to gpt. Ubuntu can boot from gpt with UEFI or BIOS if you have correct partitions. A FAT32 ESP for UEFI and/or an unformatted bios_grub for BIOS boot. I have made all new drives gpt with both ESP & bios_grub as first 2 partitions for about 5 years. But have not used BIOS for several years so may stop adding bios_grub. With both partitions you just need to reinstall grub2 to convert boot mode. Windows has no real way to convert. – oldfred Sep 12 '18 at 21:26
  • @oldfred what's this then? docs.microsoft.com/en-us/windows/deployment/mbr-to-gpt I'm thinking about doing it but I'm worried about it touching Ubuntu install – AndroidDragon Sep 12 '18 at 23:01
0

I was able to fix it in the end without wiping any data. I think creating an EFI partition using gdisk then installing efi version of grub fixed it. As for broken Windows, I ran the bootrec in the installation usb you create online and used options like rebuild bcd and fixmbr and it booted. After that I ran sudo update-grub in Ubuntu and it detected windows.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.