Ubuntu – How to set mount point of boot partition to /boot/efi

bootdual-bootgrub2mountpartitioning

I have two ubuntu installed in my system, one on the SSD (nvme0n1p1), and one on the Harddrive (sda1).

After upgrade to 17.10, ubuntu on the SSD wont boot, not being able to find file '/boot/vmlinuz-4.13.0-041300-generic', although the files are there. (See error: file '/boot/vmlinuz-4.13.0-041300-generic' not found , how to create?)

I see now on gparted, that the partition containing these files is not mounted correctly, so grub cannot see the files.

enter image description here

Where as for the other OS installed in the harddrive, which is working fine, gparted shows:

enter image description here

On start, grub also complaints that "22ac8da-d6…" partition was not found. This is how the SSD partition is apparently mounted.

I guess I should change the mount settings, so nvme0n1p1 has /boot/efi/ as the mount point, and have nvme0n1p2 on / , in other words, exactly how the partitions are set on the harddrive (sda1, sda2).

Any help on how I can do this?

the content of /etc/fstab shows that /boot/efi/ was previously on nvme0n1p1

# /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/nvme0n1p2 during installation
UUID=22ac8da3-d60a-46db-811d-a09ce5538215 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=C1DE-5B29  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0

And the output of blkid:

/dev/nvme0n1: PTUUID="eb5c38b1-7f71-4b49-a4e9-9e6ab2c9b6a4" PTTYPE="gpt"
/dev/nvme0n1p1: UUID="C1DE-5B29" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="5b57c19c-750b-457a-89f1-87130509735e"
/dev/nvme0n1p2: UUID="22ac8da3-d60a-46db-811d-a09ce5538215" TYPE="ext4" PARTUUID="2e1b8924-98f4-4821-8f48-8452620182b8"
/dev/sda1: UUID="DF5C-3936" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="2798e3ca-54f4-4528-8753-0b516c1a749c"
/dev/sda2: UUID="d37fc604-163d-4e04-83de-88993c28e419" TYPE="ext4" PARTUUID="a1331af1-a3e0-4f4e-846c-2ae70d53cb26"

Output of lsblk -f , which agrees with display of gparted:

NAME        FSTYPE LABEL UUID                                 MOUNTPOINT
sda                                                           
├─sda1      vfat         DF5C-3936                            /boot/efi
└─sda2      ext4         d37fc604-163d-4e04-83de-88993c28e419 /
sr0                                                           
nvme0n1                                                       
├─nvme0n1p1 vfat         C1DE-5B29                            
└─nvme0n1p2 ext4         22ac8da3-d60a-46db-811d-a09ce5538215 /media/lukas/22ac8da3-d60a-46db-811d-a09ce5538215

In summary: How can I set the Mount Point of /dev/nvme0n1p1 to /boot/efi/ ?

The error message upon booting on 17.10 in nvme0n1p1 is:

error: failure reading sector 0x3b9e12a0 from 'hd2'
error: failure reading sector 0x3b9e1200 from 'hd2'
error: failure reading sector 0x0 from 'hd2'
error: failure reading sector 0x3b9e12a0 from 'hd2'
error: failure reading sector 0x3b9e1200 from 'hd2'
error: failure reading sector 0x0 from 'hd2'
error: no such device: 22ac8da3-d60a-46db-811d-a09ce5538215 
error: file '/boot/vmlinuz-4.13.0-041300-generic' not found
error: you need to load the kernel first

Output of efibootmgr -v

BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,0001,0002,0008,0009
Boot0000* ubuntu    HD(1,GPT,2798e3ca-54f4-4528-8753-0b516c1a749c,0x800,0x100000)/File(\EFI\ubuntu\shimx64.efi)
Boot0001* grub  HD(1,GPT,2798e3ca-54f4-4528-8753-0b516c1a749c,0x800,0x100000)/File(\EFI\ubuntu\grubx64.efi)
Boot0002* boot  HD(1,GPT,2798e3ca-54f4-4528-8753-0b516c1a749c,0x800,0x100000)/File(\EFI\Boot\bootx64.efi)
Boot0008  Onboard NIC (IPV4)    PciRoot(0x0)/Pci(0x1c,0x3)/Pci(0x0,0x0)/MAC(14b31f18c7f5,0)/IPv4(0.0.0.0:0<->0.0.0.0:0,0,0)..BO
Boot0009  Onboard NIC (IPV6)    PciRoot(0x0)/Pci(0x1c,0x3)/Pci(0x0,0x0)/MAC(14b31f18c7f5,0)/IPv6([::]:<->[::]:,0,0)..BO

Boot-Info summary:

http://paste.ubuntu.com/p/bG54zn47VZ/

boot/efi/EFI/ubuntu/grub.cfg on both the SSD and HD are the same:

search.fs_uuid d37fc604-163d-4e04-83de-88993c28e419 root hd0,gpt2 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

UPDATES from suggestions of Oldfred:

Current output of efibootmgr -v

BootOrder: 0003,0000,0001,0002,0008,0009
Boot0000* ubuntu    HD(1,GPT,2798e3ca-54f4-4528-8753-0b516c1a749c,0x800,0x100000)/File(\EFI\ubuntu\shimx64.efi)
Boot0001* grub  HD(1,GPT,2798e3ca-54f4-4528-8753-0b516c1a749c,0x800,0x100000)/File(\EFI\ubuntu\grubx64.efi)
Boot0002* boot  HD(1,GPT,2798e3ca-54f4-4528-8753-0b516c1a749c,0x800,0x100000)/File(\EFI\Boot\bootx64.efi)
Boot0003* Ubuntu-NVMe   HD(1,GPT,5b57c19c-750b-457a-89f1-87130509735e,0x800,0x100000)/File(\EFI\ubuntu\shimx64.efi)
Boot0008  Onboard NIC (IPV4)    PciRoot(0x0)/Pci(0x1c,0x3)/Pci(0x0,0x0)/MAC(14b31f18c7f5,0)/IPv4(0.0.0.0:0<->0.0.0.0:0,0,0)..BO
Boot0009  Onboard NIC (IPV6)    PciRoot(0x0)/Pci(0x1c,0x3)/Pci(0x0,0x0)/MAC(14b31f18c7f5,0)/IPv6([::]:<->[::]:,0,0)..BO

/boot/efi/EFI/ubuntu/grub.cfg on NVMe:

search.fs_uuid 22ac8da3-d60a-46db-811d-a09ce5538215 root hd0,gpt2 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

/boot/efi/EFI/ubuntu/grub.cfg on HDD:

search.fs_uuid d37fc604-163d-4e04-83de-88993c28e419 root hd0,gpt2 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

Best Answer

See if this adds an entry in UEFI to boot from NVMe drive. See man efibootmgr for details on parameters.

sudo efibootmgr -c -L "Ubuntu-NVMe" -l "\EFI\ubuntu\shimx64.efi" -d /dev/nvme0n1 -p 1

But whenever I use a -L label different than Ubuntu, it still boots from the /EFI/ubuntu/grub.cfg, so make sure you have that also and it is correct. It used to not even have a 3 line grub.cfg in other labels, now it does, but something internally is still coded to only use /EFI/ubuntu/grub.cfg.

Script has not been updated to fully show NVMe drives. Your grub.cfg in it should be:

search.fs_uuid 22ac8da3-d60a-46db-811d-a09ce5538215 root hd0,gpt2 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

And the one in sda, should have UUID of install in sda, but probably hd1,gpt2, UUID should override device setting. Not sure how UEFI and grub see drives. I plug in external SSD and it becomes hd0 even though sdc in Ubuntu. And then grub/UEFI bumps up all my other drives one number. And if I also have flash drive plugged in I have to change hd0 to hd2 to find install in sda.

Related Question