[Bug 1838525] Re: LVM setup fails to install grub on virtio storage

Rafael David Tinoco rafaeldtinoco at kernelpath.com
Wed Oct 2 19:54:51 UTC 2019


xenial - does not ask device to grub-install, finds /dev/vda correctly


~ # pvs
  PV         VG        Fmt  Attr PSize  PFree 
  /dev/vda5  ubuntu-vg lvm2 a--  29.28g 40.00m


~ # vgs
  VG        #PV #LV #SN Attr   VSize  VFree 
  ubuntu-vg   1   2   0 wz--n- 29.28g 40.00m


~ # lvs
  LV     VG        Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   ubuntu-vg -wi-ao----  28.29g                                                    
  swap_1 ubuntu-vg -wi-ao---- 976.00m     


~ # ls -lah1 /dev/disk/by-id/
drwxr-xr-x    2     120 Oct  2 17:54 .
drwxr-xr-x    5     100 Oct  2 18:05 ..
lrwxrwxrwx    1      10 Oct  2 18:07 dm-name-ubuntu--vg-root -> ../../dm-0
lrwxrwxrwx    1      10 Oct  2 18:05 dm-name-ubuntu--vg-swap_1 -> ../../dm-1
lrwxrwxrwx    1      10 Oct  2 18:07 dm-uuid-LVM-rKxFFLzSxoQE5R09qa8ztKdfGKZIxktySnE1WunTpz1cKQt8elMkWyzXF25Dhqgt -> ../../dm-0
lrwxrwxrwx    1      10 Oct  2 18:05 dm-uuid-LVM-rKxFFLzSxoQE5R09qa8ztKdfGKZIxktyoOA5IYfjtokmG0cVkmlrLRZfr0gbBZCh -> ../../dm-1


/lib/udev/rules.d # grep -ril lvm * 
55-dm.rules
60-persistent-storage-dm.rules

----

bionic - does not ask device to grub-install, finds /dev/vda correctly


  PV         VG        Fmt  Attr PSize   PFree 
  /dev/vda1  ubuntu-vg lvm2 a--  <30.00g 12.00m


~ # vgs
  VG        #PV #LV #SN Attr   VSize   VFree 
  ubuntu-vg   1   2   0 wz--n- <30.00g 12.00m


~ # lvs
  LV     VG        Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   ubuntu-vg -wi-ao----  29.03g                                                    
  swap_1 ubuntu-vg -wi-ao---- 976.00m                                                    


~ # ls -lah1 /dev/disk/by-id/
drwxr-xr-x    2 root     root         120 Oct  2 18:10 .
drwxr-xr-x    6 root     root         120 Oct  2 18:27 ..
lrwxrwxrwx    1 root     root          10 Oct  2 18:27 dm-name-ubuntu--vg-root -> ../../dm-0
lrwxrwxrwx    1 root     root          10 Oct  2 18:27 dm-name-ubuntu--vg-swap_1 -> ../../dm-1
lrwxrwxrwx    1 root     root          10 Oct  2 18:27 dm-uuid-LVM-tuUboqieQsJtu1wB4OyTbAT5pRwXxZj7C8q7wogJHSUaOrIBRvJ2GL7ZcRFz4nCe -> ../../dm-0
lrwxrwxrwx    1 root     root          10 Oct  2 18:27 dm-uuid-LVM-tuUboqieQsJtu1wB4OyTbAT5pRwXxZj7d1U7ckfbgo1bRtQnDa5XQsaoXSpjCvfV -> ../../dm-1


/lib/udev/rules.d # grep -ril lvm *
55-dm.rules
60-persistent-storage-dm.rules
95-dm-notify.rules

----

disco - does not ask, but has only /dev/vda to choose


~ # pvs
  PV         VG        Fmt  Attr PSize   PFree 
  /dev/vda1  ubuntu-vg lvm2 a--  <30.00g 12.00m


~ # vgs
  VG        #PV #LV #SN Attr   VSize   VFree 
  ubuntu-vg   1   2   0 wz--n- <30.00g 12.00m


~ # lvs
  LV     VG        Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   ubuntu-vg -wi-ao----  29.03g                                                    
  swap_1 ubuntu-vg -wi-ao---- 976.00m                                                    


~ # ls -lah1 /dev/disk//by-id/
drwxr-xr-x    2 root     root         120 Oct  2 18:09 .
drwxr-xr-x    6 root     root         120 Oct  2 18:27 ..
lrwxrwxrwx    1 root     root          10 Oct  2 18:27 dm-name-ubuntu--vg-root -> ../../dm-0
lrwxrwxrwx    1 root     root          10 Oct  2 18:27 dm-name-ubuntu--vg-swap_1 -> ../../dm-1
lrwxrwxrwx    1 root     root          10 Oct  2 18:27 dm-uuid-LVM-qBHgS7hD0Uk4hjhprGFLVwCUekU0i6OBbMg8u7PfVrnT4mcYKuKXRqI4ehzM7pLX -> ../../dm-0
lrwxrwxrwx    1 root     root          10 Oct  2 18:27 dm-uuid-LVM-qBHgS7hD0Uk4hjhprGFLVwCUekU0i6OBjuHfJCKZ6aVKKmZHq2VxntLeR46xIexG -> ../../dm-1


/lib/udev/rules.d # grep -ril lvm *
55-dm.rules
60-persistent-storage-dm.rules
95-dm-notify.rules


----

eoan - asks device to grub-install and shows /dev/mapper as default


~ # pvs
  PV         VG       Fmt  Attr PSize   PFree 
  /dev/vda1  vgubuntu lvm2 a--  <30.00g 12.00m


~ # vgs
  VG       #PV #LV #SN Attr   VSize   VFree 
  vgubuntu   1   2   0 wz--n- <30.00g 12.00m


~ # lvs
  LV     VG       Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   vgubuntu -wi-ao----  29.03g                                                    
  swap_1 vgubuntu -wi-ao---- 976.00m                                                    


~ # ls -lah1 /dev/disk/by-id/
drwxr-xr-x    2 root     root         160 Oct  2 19:25 .
drwxr-xr-x    7 root     root         140 Oct  2 19:25 ..
lrwxrwxrwx    1 root     root          10 Oct  2 19:25 dm-name-vgubuntu-root -> ../../dm-0
lrwxrwxrwx    1 root     root          10 Oct  2 19:25 dm-name-vgubuntu-swap_1 -> ../../dm-1
lrwxrwxrwx    1 root     root          10 Oct  2 19:25 dm-uuid-LVM-uUYPMknWpQfkO3t3oKjW16vWmUeeTItFH9kCscuyNWWYybHdrB9ZENbFXKkJZUfb -> ../../dm-1
lrwxrwxrwx    1 root     root          10 Oct  2 19:25 dm-uuid-LVM-uUYPMknWpQfkO3t3oKjW16vWmUeeTItFfFw10F8npYWNaZWovPClX8tbARfym9zo -> ../../dm-0
lrwxrwxrwx    1 root     root          10 Oct  2 19:25 lvm-pv-uuid-iXIOdp-tXsj-ditG-JaUC-8flA-XV51-RFV778 -> ../../vda1


/lib/udev/rules.d # grep -ril lvm * 
55-dm.rules
56-lvm.rules
60-persistent-storage-dm.rules
69-lvm-metad.rules
95-dm-notify.rules

in 69-lvm-metad.rules:

# Create /dev/disk/by-id/lvm-pv-uuid-<PV_UUID> symlink for each PV
ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-id/lvm-pv-uuid-$env{ID_FS_UUID_ENC}"

That is the difference causing the problem, and installer should NOT
have that udev rule in order for not to have to change any logic in init
scripts for grub device detection.

----

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grub-installer in Ubuntu.
https://bugs.launchpad.net/bugs/1838525

Title:
  LVM setup fails to install grub on virtio storage

Status in debian-installer package in Ubuntu:
  New
Status in grub-installer package in Ubuntu:
  Triaged
Status in debian-installer source package in Eoan:
  New
Status in grub-installer source package in Eoan:
  Triaged
Status in debian-installer package in Debian:
  New

Bug description:
  Comment #26 has the TL;DR version of the problem.
  https://bugs.launchpad.net/ubuntu/+source/debian-installer/+bug/1838525/comments/26

  [Original Description]

  The Eoan debian-installer ISO fails to install GRUB on LVM installs
  with virtio storage, as it runs grub-install with /dev/mapper as a
  target (a directory), even if instructed to target a device.

  The following steps to reproduce have been prepared running the
  20190730 build, but this has been broken since about June 18, 2019.
  Steps to reproduce:

  $ md5sum eoan-server-amd64.iso
  f591e30485e5f0b5117f6c116e538c42  eoan-server-amd64.iso
  $ qemu-img create -f raw disk1.img 8G
  Formatting 'disk1.img', fmt=raw size=8589934592
  $ kvm -m 1024 -boot d -cdrom eoan-server-amd64.iso -drive file=disk1.img,if=virtio

  Proceed with all the defaults. In the "Partition disk" step select
  "Guided - use entire disk and set up LVM". Go ahead accepting the
  defaults. At the "Install the GRUB boot loader" step select "/dev/vda"
  as the target device. The installer will actually run `grub-install
  --force /dev/mapper` and fail after a while. The wrong command is
  visible both in the d-i screen and by running `ps` on a different
  console.

  Full installer syslog: http://paste.ubuntu.com/p/qtZy86dTp6/

  It's interesting how this doesn't happen when not using virtio. If
  from the commands above the "if=virtio" option is dropped then
  everything works as expected. In this case the target block device is
  called /dev/sda instead of /dev/vda.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/debian-installer/+bug/1838525/+subscriptions



More information about the foundations-bugs mailing list