3

I'm trying to migrate to my new NVMe Samsung 950 pro.

chroot /mnt/boot-sav/nvme0n1p3 update-grub
grub-probe: error: cannot find a GRUB drive for /dev/sda1.  Check your device.map.

Process:

  • Copied/pasted via Gparted (lastest gparted live-cd)
  • Ran boot-repair (with 15.10 ubuntu desktop)
  • failed on update-grub

http://paste.ubuntu.com/13244403/

Old drive had:

  • sda1 fat32 EFI
  • sda2 ntfs
  • unallocated (had to shrink a small amount for new drive)
  • sda3 ext4
  • sda4 linux-swap

My first guess is that I'm no longer using an sd, but an nvm prefixed device.

Any thoughts/help is appreciated.

sudo fdisk -l

Device             Start       End   Sectors   Size Type
/dev/nvme0n1p1      2048    206847    204800   100M Microsoft basic data
/dev/nvme0n1p2    206848 487878655 487671808 232.6G Microsoft basic data
/dev/nvme0n1p3 487878656 864057343 376178688 179.4G Linux filesystem
/dev/nvme0n1p4 864057344 897484799  33427456    16G Linux swap

Device     Boot   Start     End Sectors  Size Id Type
/dev/sda1  *          0 2301535 2301536  1.1G  0 Empty
/dev/sda2       2279532 2284075    4544  2.2M  c W95 FAT32 (LBA)

Update 11/14/15

This is the latest attempt:

sudo mount /dev/nvme0n1p3 /mnt
sudo mount /dev/nvme0n1p1 /mnt/boot/efi

for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done

sudo cp --remove-destination /etc/resolv.conf /mnt/etc/resolv.conf

sudo chroot /mnt
grub-install --efi-directory=/boot/efi --target=x86_64-efi --uefi-secure-boot 

Results:

Installation finished. No error reported.

$ update-grub
grub-probe: error: cannot find a GRUB drive for /dev/sda1.  Check your device.map.

When I look in /boot/grub I do NOT have a device.map. I read that I don't need one for grub2, but I generated one, ran update-grub and ran into the same message as above.

I attempt to reboot anyway, and my EFI only shows a Windows Boot Manager as a bootable item, for which it lands on a windows recovery screen. The Ubuntu partition isn't listed as a bootable drive in EFI.

3
  • nvme stands for SSD. And are there any possibilities of you removing your old hard-drive to install Ubuntu and then reconnect the drive again?
    – Raphael
    Nov 13, 2015 at 3:04
  • The old drive is already out in this scenario, I just mentioned the partitions for context. The other drive is the Ubuntu 15.10 desktop USB live image.
    – kross
    Nov 13, 2015 at 8:11
  • @Raphael I have both the old and new drives available. Are you suggesting some path of installing a fresh ubuntu just to get the efi right then overwriting it with the old ubuntu partition?
    – kross
    Nov 14, 2015 at 22:24

3 Answers 3

0
sudo fdisk -l

then, see what partition you have the ubuntu installed(ext4 filetype) then:

sudo mount -t ext4 /dev/sda6 /mnt 

(admitting that sda6 is my ubuntu partition)

and then

sudo grub-install --root-directory=/mnt /dev/sda

this will reinstall grub and see all the others OS' that you have and organize all of them.

5
  • or @KGlll, regarding the grub-install line, /dev/sda is the Ubuntu USB live image, should that be the EFI partition /dev/nvme0n1p1?
    – kross
    Nov 13, 2015 at 8:23
  • Following your advice and these additional instructions grub-install /dev/nvme0n1 fails with cannot find EFI directory. I can re-copy these partitions from the old drive at any time if I've lost it somewhere
    – kross
    Nov 13, 2015 at 8:32
  • Found this re: EFI, working on mounting it now.
    – kross
    Nov 13, 2015 at 8:35
  • no, on sudo grub-install --root-directory=/mnt /dev/sda is sda anyway
    – saidc3
    Nov 13, 2015 at 13:04
  • With gpt you are not supposed to copy partitions. Copying entire drive should be ok. The unique GUID in the partition and in both the main gpt partition table and the backup must match. You may be able to use gdisk or sgdisk to update/repair GUIDs so they all match. You must also have boot flag on the FAT32 partition that is the ESP - efi system partition. But boot flag is reallly just assigning the correct gpt type code for a UEFI bootable partition.
    – oldfred
    Nov 14, 2015 at 22:40
0

This should definitely work.

Device             Start       End   Sectors   Size Type
/dev/nvme0n1p1      2048    206847    204800   100M Microsoft basic data
/dev/nvme0n1p2    206848 487878655 487671808 232.6G Microsoft basic data
/dev/nvme0n1p3 487878656 864057343 376178688 179.4G Linux filesystem
/dev/nvme0n1p4 864057344 897484799  33427456    16G Linux swap

Here I can't see EFI partition nor separate boot partition.

Copying EFI directory to root won't work. You need separate partition of type fat32, around 100MB to hold the EFI directory.

So here my advice is to shrink /dev/nvme0n1p2 from right to create space for the efi partition.

Then boot into a Ubuntu Live Media.

Mount root parition

sudo mount /dev/nvme0n1pX /mnt/

Mount efi partition

sudo mount /dev/nvme0n1pX /mnt/boot/efi

; replace X with the actual device id

Chroot and reinstall Grub

sudo chroot /mnt
grub-install
2
  • The EFI partition is /dev/nvme0n1p1, I've verified that and the files. I'll try the remainder of the instructions fresh, but I believe I've already done exactly this. You never know though, I may have done something else in-between.
    – kross
    Nov 14, 2015 at 19:27
  • 1
    My question has been updated with results from taking the chroot path. update-grub still complains grub-probe: error: cannot find a GRUB drive for /dev/sda1. Check your device.map.
    – kross
    Nov 14, 2015 at 22:07
0

Thanks for all the help everyone. I ended up on this path because Clonezilla wouldn't recognize the nvme properly. I've tried diligently to get all this to work but none of the attempted would work. In the end, I resorted to using dd to get my clone, and it ended up working dd if=/dev/sdX of=/dev/sdY bs=512 count=1 conv=noerror,sync. I really didn't want to take this path but it ended up working.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .