Previous setup:

  • windows 10 + ubuntu 16.04 dual boot with grub on ssd1(/dev/nvme0n1).

Current setup:

  • ssd2(/dev/nvme1n1) contains only windows 10 cloned from above. Boots fine.

  • ssd1(/dev/nvme0n1) contains only ubuntu, all other partitions removed. Can't boot here.

I want to be able to dual boot again and select either windows 10 or ubuntu from the menu. This is what the terminal shows in the live usb:

ubuntu@ubuntu:~$ sudo fdisk -l
Disk /dev/loop0: 1.5 GiB, 1601015808 bytes, 3126984 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: 238.5 GiB, 256060514304 bytes, 500118192 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: gpt
Disk identifier: F6F46D18-D629-4D34-9F1A-0900B2600555

Device         Start       End   Sectors Size Type
/dev/nvme0n1p1  2048 104859647 104857600  50G Linux filesystem

Disk /dev/nvme1n1: 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: gpt
Disk identifier: 4C872172-3D07-4489-B670-6FB593A31318

Device            Start       End   Sectors   Size Type
/dev/nvme1n1p1     2048   1026047   1024000   500M EFI System
/dev/nvme1n1p2  1026048   1288191    262144   128M Microsoft reserved
/dev/nvme1n1p3  1288192   3033087   1744896   852M Windows recovery environment
/dev/nvme1n1p4  3033088  23244799  20211712   9.7G Windows recovery environment
/dev/nvme1n1p5 23244800 976773119 953528320 454.7G Microsoft basic data

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: gpt
Disk identifier: F7921471-F857-4820-9356-237BF02CAD38

Device          Start        End    Sectors   Size Type
/dev/sda1          34     262177     262144   128M Microsoft reserved
/dev/sda2      264192 1919969279 1919705088 915.4G Microsoft basic data
/dev/sda3  1919969280 1953523711   33554432    16G Linux swap

Partition 1 does not start on physical sector boundary.

Disk /dev/sdb: 7.3 GiB, 7813988352 bytes, 15261696 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: 0xf5e34067

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdb1  *     8064 15124991 15116928  7.2G  c W95 FAT32 (LBA)


ubuntu@ubuntu:~$ lsblk -f -o +PARTLABEL /dev/nvme1n1
NAME        FSTYPE LABEL      UUID                                 MOUNTPOINT PARTLABEL
├─nvme1n1p4 ntfs   Image      C66E65726E655BE5                                
├─nvme1n1p2                                                                   Microsoft reserved partition
├─nvme1n1p5 ntfs   OS         01D238F37C836540                                Basic data partition
├─nvme1n1p3 ntfs   WINRETOOLS AEFA63D2FA63957D                                
└─nvme1n1p1 vfat   ESP        9AB9-9DEA                                       EFI system partition
ubuntu@ubuntu:~$ lsblk -f -o +PARTLABEL /dev/nvme0n1
NAME        FSTYPE LABEL UUID                                 MOUNTPOINT                                         PARTLABEL
└─nvme0n1p1 ext4         1e27d729-df08-4d63-ad19-402e4c3340cf /media/ubuntu/1e27d729-df08-4d63-ad19-402e4c3340cf


ubuntu@ubuntu:~$ blkid
/dev/nvme0n1p1: UUID="1e27d729-df08-4d63-ad19-402e4c3340cf" TYPE="ext4" PARTUUID="97c73deb-1ad6-4fa9-bc50-7dad24f84a68"
/dev/nvme1n1p1: LABEL="ESP" UUID="9AB9-9DEA" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="ac04e9de-aeb3-4595-9498-7e088a2178f7"
/dev/nvme1n1p3: LABEL="WINRETOOLS" UUID="AEFA63D2FA63957D" TYPE="ntfs" PARTUUID="162446b1-0911-41bf-8b91-6e92609105fe"
/dev/nvme1n1p4: LABEL="Image" UUID="C66E65726E655BE5" TYPE="ntfs" PARTUUID="8d16423b-2a17-45f3-ab56-95652bcb47af"
/dev/nvme1n1p5: LABEL="OS" UUID="01D238F37C836540" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="f8fe17da-3179-4c3e-98b0-ba7d0e8ad7ad"
/dev/sda2: LABEL="Data" UUID="86F26B62F26B5609" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="ff2d059c-108b-4e4a-9ef1-1d5645bf4e70"
/dev/sdb1: LABEL="UUI" UUID="0CDF-DB24" TYPE="vfat" PARTUUID="f5e34067-01"


# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/nvme0n1p6 during installation
UUID=1e27d729-df08-4d63-ad19-402e4c3340cf /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p1 during installation
#UUID=9AB9-9DEA  /boot/efi       vfat    umask=0077      0       1
# swap was on /dev/sda3 during installation
UUID=74c15561-f026-4824-bc85-32e3ee9b5d90 none            swap    sw              0       0
UUID=9AB9-9DEA  /boot/efi   vfat    defaults    0   1

This is grub.cfg : https://pastebin.com/cL1KFY5c

  • 1
    You have to be careful cloning, especially with gpt drives. You cannot have duplicate UUIDs nor GUIDs, if cloned from another drive. And with gpt, the partition GUID is in the partition table, backup partition table and the partition which all must match. With Ubuntu often easier to just backup and reinstall. Then restore backup. And if you still have old install, it becomes a good way to confirm your backups include everything. Post this above to check UUID & GUIDs (aka part label). lsblk -f -o +PARTLABEL /dev/nvme1n1 and lsblk -f -o +PARTLABEL /dev/nvme0n1 – oldfred May 14 at 2:35
  • @oldfred Added both to question description. I also have the backed up image of the entire previous setup using macrium reflect. – vikramreddym May 14 at 2:52
  • 1
    The relevant parts of /boot/grub/grub.cfg with UUIDs and /etc/fstab should be included. As well have you tried running boot-repair from Live USB yet? – WinEunuuchs2Unix May 14 at 4:18
  • @WinEunuuchs2Unix Thanks, boot-repair surprisingly worked so well. Did not think it would work. It asked me to enter several commands during the process and in the end generated this log: paste.ubuntu.com/p/x28hgGCbs5 I just need to figure out now how to remove unnecessary entries from GRUB. Also attached the files you have asked. – vikramreddym May 14 at 4:42
  • Glad it worked. I addressed the too unnecessary entries issue in answer below. – WinEunuuchs2Unix May 14 at 10:41

The best way of cloning Ubuntu from one drive to another, or one partition to another, is with a script that resets UUID's in /boot/grub/grub.cfg and /etc/fstab like this one:

If you simply clone with a tool that doesn't change UUID's you need to use boot-repair as demonstrated here:

After running boot-repair you can get 7 entries for Windows so use this method to remove the extra entries:

With multiple Operating Systems you will get generic names created in grub such as:

  • Ubuntu
  • Windows Boot Manager (on /dev/nvme0n1p2)
  • Windows Boot Manager (on /dev/sda1)
  • Ubuntu 18.04 LTS (18.04) (on /dev/nvme0n1p6)

To get user friendly or more meaningful OS names for yourself use:

Disclaimer I wrote all the above links.

  • There is still this issue of grub opening in console mode (grub>)randomly after a couple of switches between windows and Ubuntu. – vikramreddym May 14 at 22:00
  • Also is it.reatarting from Windows or Ubuntu that makes grub confused? Does hard power off fix? – WinEunuuchs2Unix May 14 at 22:12
  • It happens after restarting from Ubuntu. May be it happened after restarting from Windows as well. Can't say for sure. To fix it (only to come back again!), I type exit, that boots it into windows and then restarting shows the grub screen in normal mode. – vikramreddym May 15 at 4:03
  • @vikramreddym I can't think of anything off the top of my head. Try to see if you can do something in Ubuntu or Windows and then click restart and have it break grub every time. Then post that as a new question for greater visibility. – WinEunuuchs2Unix May 15 at 10:44

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.