1

I'm running Ubuntu 20.04 on one drive (m.2) and Win10 on another (3.5" SSD). I recently added another m.2 drive to my system and cloned my Win10 system onto it. So here's what my drives look like now, where sda1 and nvme1n1p1 are clones:

root@cantankerous:~# lsblk -f

NAME                 FSTYPE      LABEL UUID                                   FSAVAIL FSUSE% MOUNTPOINT
sda                                                                                          
└─sda1               ntfs              9638B89D38B87E35                                      
nvme1n1                                                                                      
└─nvme1n1p1          ntfs              9638B89D38B87E35                                      
nvme0n1                                                                                      
├─nvme0n1p1          vfat              23FD-2B75                               478.1M     6% /boot/efi
└─nvme0n1p2          LVM2_member       cKt344-wOPa-y34D-j0Wg-y3wq-ZlFz-fIGpnr                
  ├─vgkubuntu-root   ext4              27945eb2-45c3-48da-b887-6391111416e3    328.4G    23% /
  └─vgkubuntu-swap_1 swap              9bdb7f2f-ac7b-4322-ae8e-38c870a190cc                  [SWAP]

I'd like to get rid of /dev/sda now.

I believe that what I need to do next is use efibootmgr to modify my bootable drives. Right now my EFI files live on the nvme0n1 drive that houses Ubuntu. Here's the output of efibootmgr:

root@cantankerous:~# efibootmgr -v
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,0002,0008,0001
Boot0000* ubuntu        HD(1,GPT,9ab61c6d-62f6-474f-99c4-64eae4e5b595,0x800,0x100000)/File(\EFI\UBUNTU\SHIMX64.EFI)
Boot0001* Windows Boot Manager  HD(1,GPT,9ab61c6d-62f6-474f-99c4-64eae4e5b595,0x800,0x100000)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}....................
Boot0002* Hard Drive    BBS(HD,,0x0)..GO..NO........q.S.a.m.s.u.n.g. .S.S.D. .9.7.0. .E.V.O. .5.0.0.G.B....................A...........................%8Z.........4..Gd-.;.A..MQ..L.S.4.6.6.N.X.0.K.A.6.2.1.5.9.H........BO..NO........u.S.H.G.P.3.1.-.5.0.0.G.M.-.2....................A.......................................8..Gd-.;.A..MQ..L.C.S.0.9.N.5.2.4.9.1.0.2.0.9.G.3.K........BO..NO........u.S.a.m.s.u.n.g. .S.S.D. .8.5.0. .E.V.O. .2.5.0.G.B....................A.................................>..Gd-.;.A..MQ..L.2.S.5.R.X.N.H.A.0.3.4.9.1.2. .Z. . . . ........BO
Boot0008* Windows m.2   HD(1,GPT,2aba441a-2647-48c4-868c-b4ca31d4f5a3,0x800,0x3a385800)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)

I've tried using efibootmgr to create a new bootable entry, but what I can't figure out how to do is specify that, although the EFI image lives on "nvme0", I need it to boot onto "nvme1". I see this being done with /dev/sda with this "bcdobject=([uuid])" but I can't find any information out there about how this is done.

That is, of course, assuming I'm on the right track!

Once that's done I'm assuming os-probe will pick up the new drive and I can integrate it with grub-mkconfig.

Thanks for any help!

Chris C
  • 13
  • 3
  • You cannot have duplicate UUIDs or GUID/partUUID that efibootmgr uses. Disconnect sda, before trying any updates to avoid confusion of which device is which. Some example efibootmgr entries: Sony, HP & others workarounds: https://askubuntu.com/questions/486752/dual-boot-win-8-ubuntu-loads-only-win You have to use /dev/nvme & correct drive, partition. Like this but check if correct drive/partition `sudo efibootmgr -c -L "Windows Boot Manager" -l "\EFI\Microsoft\Boot\bootmgfw.efi" -d /dev/nvme1n1 -p 1` – oldfred Nov 25 '20 at 17:32
  • Thanks for your help! I did as you suggested and removed /dev/sda and ran the command you suggested (after removing my initial attempt). It's interesting now--`efibootmgr -v` still shows my original "Windows Boot Manager", but also has the new one. `os-prober` does not find the new drive (only nvme0), but when I boot into grub and select my old Windows option, it boots to the new drive just fine. I feel like I'm missing something, but I'm glad to have it working! – Chris C Nov 25 '20 at 18:59
  • 1
    Grub only boots working Windows, so make sure you can directly boot Windows from UEFI. UEFI entry uses GUID partUUID. Compare your `sudo efibootmgr -v` with partUUID from this for ESP: `lsblk -o name,mountpoint,label,size,fstype,uuid,partuuid | egrep -v "^loop"` They need to match as that is how UEFI finds correct FAT32 partition. – oldfred Nov 25 '20 at 19:16
  • My partUUID matches between the `lsblk` output and my `efibootmgr -v` output for the entry I added, but I can't boot the drive through UEFI in my BIOS. There is no UEFI entry for the drive in my BIOS, and booting in legacy mode results in an unbootable disk error. Here's what I have in my `efibootmgr`: `Boot0003* Windows Boot Manager HD(1,GPT,[partUUID[)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)` – Chris C Nov 25 '20 at 21:59
  • You do not see 0003 entry in UEFI boot menu? Normally Windows boot entry works, some like HP or Acer need additional changes to make ubuntu entry work. – oldfred Nov 25 '20 at 22:47
  • No, none of the UEFI entries for that drive work. That's okay, grub is booting Windows (and Ubuntu) just fine. It looks like `os-prober` uses the UUID to identify a drive, and so it doesn't really care that the device has changed. If you'd like to submit an answer instead of a comment I'd be happy to mark it solved at this point, you've been very helpful! – Chris C Nov 26 '20 at 01:03

1 Answers1

1

You cannot have duplicate UUIDs or GUID/partUUID that efibootmgr uses.

Disconnect sda, before trying any updates to avoid confusion of which device is which. Some example efibootmgr entries: Sony, HP & others workarounds:

Dual boot Win 8 / Ubuntu loads only Win

You have to use /dev/nvme & correct drive, partition. Like this but check if correct drive/partition, compare GUID in UEFI boot entry and partUUID from lsblk. That will tell which ESP you are using to boot from.

sudo efibootmgr -v
lsblk -o name,mountpoint,label,size,fstype,uuid,partuuid | egrep -v "^loop"

sudo efibootmgr -c -L "Windows Boot Manager" -l "\EFI\Microsoft\Boot\bootmgfw.efi" -d /dev/nvme1n1 -p 1 

Grub only boots working Windows. Windows will turn fast start up back on and then grub will not boot it, so best to fix UEFI boot entry to boot Windows directly.

Grub2's os-prober looks for .efi boot files in the ESP to find other installs to boot. It is not using UEFI entries.

oldfred
  • 11,747
  • 3
  • 23
  • 33