And "/dev/vda1" is being caught instead of "/dev/vda", as it happens to "/dev/sda" (instead of getting "/dev/sda1"). This logic comes a bit above that execution output:
And this is why andreas talks about "grub-mkdevicemap" here, and he is triggered by the "head -n1" usage:
17:10 <rafaeldtinoco> instead of /dev/vda
17:10 <andreas> cyphermox: I wonder about this head -n1
17:10 <andreas> default_bootdev_os="$($chroot $ROOT grub-mkdevicemap --no-floppy -m - | head -n1 | cut -f2)"
17:10 <andreas> if it's making an assumption
17:10 <cyphermox> well, usually hd0 is really what you want
17:10 <cyphermox> and it works for sda
17:10 <cyphermox> I mean, what is so different about virtio?
17:10 <andreas> yeah, I don't have the raw output in the sda case
We then tested both, virtio and non-virtio installations and saw that, for the SCSI case:
the disk is listed first (as hd0) in grub-mkdevicemap, while in the VIRTIO case, it is listed as SECOND (explaining why /dev/mapper was generated in subsequent wrong logic bellow).
After Andreas and I compared side by side the 2 "set -x" outputs, we discovered what is happening.
https:/ /pastebin. ubuntu. com/p/WyvnChrqB Q/
And "/dev/vda1" is being caught instead of "/dev/vda", as it happens to "/dev/sda" (instead of getting "/dev/sda1"). This logic comes a bit above that execution output:
https:/ /pastebin. ubuntu. com/p/ZRNHfnmJ4 P/
And this is why andreas talks about "grub-mkdevicemap" here, and he is triggered by the "head -n1" usage:
17:10 <rafaeldtinoco> instead of /dev/vda bootdev_ os="$($ chroot $ROOT grub-mkdevicemap --no-floppy -m - | head -n1 | cut -f2)"
17:10 <andreas> cyphermox: I wonder about this head -n1
17:10 <andreas> default_
17:10 <andreas> if it's making an assumption
17:10 <cyphermox> well, usually hd0 is really what you want
17:10 <cyphermox> and it works for sda
17:10 <cyphermox> I mean, what is so different about virtio?
17:10 <andreas> yeah, I don't have the raw output in the sda case
We then tested both, virtio and non-virtio installations and saw that, for the SCSI case:
bash-5.0# grub-mkdevicemap --no-floppy -m - by-id/scsi- 0QEMU_QEMU_ HARDDISK_ drive-scsi0- 0-0 by-id/lvm- pv-uuid- oKqHJy- nRnC-nLm3- AuxT-FmpR- CCox-ltoWeB
(hd0) /dev/disk/
(hd1) /dev/disk/
the disk is listed first (as hd0) in grub-mkdevicemap, while in the VIRTIO case, it is listed as SECOND (explaining why /dev/mapper was generated in subsequent wrong logic bellow).
https:/ /pastebin. ubuntu. com/p/hCNPH8Gjg S/