Grub-install fails to get canonical path for vg-root

Hi all,

I just attempted upgrading from Ubuntu 18.04.4 LTS to 20.04 LTS and found my grub config was hosed. I can see the new kernels in /boot

This is my disk-layout

NAME                  FSTYPE      LABEL UUID                                   MOUNTPOINT
sr0
xvda
├─xvda1               ext2              ca3c4b9e-417d-49c4-bbf9-1a721b256b1f   /boot
├─xvda2
├─xvda3               LVM2_member       fWFXlh-O1Nr-qqsT-ZeCj-BTp3-3DA7-cCAzoX
│ └─gitlab--vg-root   ext4              a6df0d99-1813-4511-bd4e-953b1fdeb304   /
├─xvda4               LVM2_member       HSbyEz-SM5f-Qp1a-275C-n7z1-UfeS-dFBhco
│ └─gitlab--vg-root   ext4              a6df0d99-1813-4511-bd4e-953b1fdeb304   /
└─xvda5               LVM2_member       wv22ai-RQLB-Khyp-esKa-9pDh-Hv2H-SjRAww
  ├─gitlab--vg-root   ext4              a6df0d99-1813-4511-bd4e-953b1fdeb304   /
  └─gitlab--vg-swap_1 swap              416a1c87-b4b1-4d81-93c9-491c35abc6f5   [SWAP]
mdesilva@ubuntu-builder0:~$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         7.8G     0  7.8G   0% /dev
tmpfs                        1.6G  1.1M  1.6G   1% /run
/dev/mapper/gitlab--vg-root  195G  155G   32G  84% /
tmpfs                        7.9G     0  7.9G   0% /dev/shm
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                        7.9G     0  7.9G   0% /sys/fs/cgroup
/dev/xvda1                   472M  213M  235M  48% /boot
tmpfs                        1.6G     0  1.6G   0% /run/user/1001

Logical volume	/dev/gitlab-vg/root

From within a chroot (in /rescue and xvda1 mounted at /rescue/boot), I tried to reinstall grub, however, I’m getting the following: Screenshot as I’m using lightsout console access for my VM:

Screenshot 2020-05-08 at 08.47.47

Any ideas?

Is this an EFI installation or traditional?

cat /etc/fstab?

Oooohhhh

If you’ve got /dev/mapper/gitlab–vg-root mounted on the hosts /rescue, and you’re executing grub-install from within the /rescue chroot, you should not use the --root-directory=/rescue directive.

Oh, and if you haven’t bind mounted /dev, /proc and /sys, you need to do that.

mount --bind /dev /rescue/dev
mount --bind /proc /rescue/proc
mount --bind /sys /rescue/sys
2 Likes

Hey @SgtAwesomesauce yes, I did bind to those, although I used mount -o bind /dev /rescue/dev and mount -t sysfs /sys /rescue/sys

I simply get "failed to get canonical path of /dev/xvda1" for grub-install /dev/xvda.

I’m now getting for grub-install /dev/xvda no error. But it didn’t seem like anything was fixed though?

Thanks so much, I missed the / path for sys and dev!! DOH!!

Easy mistake. Glad you caught it.

So that error, “cannot find cannonical path” means that GRUB can’t figure out what block devices are associated with the logical volume. So it usually indicates that you haven’t bind-mounted them properly.

1 Like

I thought my Server LTS 18.04.4 would upgrade easily, but this gives me desktop 20.02 LTS. And since the upgrade is from server, almost none of the bloatcough…apps are installed. Not even a working terminal.

Thankfully I can just do a 1-click “switch” snapshot in XCP-ng, so I’m back on 18.04.4 for my builder VM.

EDIT: Post upgrade I’m running the following, this works.

apt-get install -y gnome-terminal gnome-software
grub-install /dev/xvda
1 Like