1) This system has had the virtual disk swapped to SCSI and back to virtio.
2) grub-pc postinst fails after a switch from SCSI to virtio with cannot find /dev/disk/by-id/....
(There is *NO* /dev/disk/by-id with virtio)
3) After purging grub-pc and reinstalling it, the postinst can no longer find a disk where grub should be installed.
4) grub-install --recheck /dev/vda works just fine
Thoughts.
1) udev persistent storage rules probably need to match the [vs]d*[!0-9] wildmat instead of sd*[!0-9].
2) Until udev is fixed, it would be pleasant if grub-pc.postinst would fallback to /dev/disk/by-uuid.
I think this does it.
available_ids()
{
local id path diskby
if [ "$cached_available_ids" ]; then
echo "$cached_available_ids"
return
fi
for diskby in /dev/disk/by-id /dev/disk/by-uuid; do
[ -d "$diskby" ] && break
done
cached_available_ids="$(
for path in "$diskby"/* ; do
[ -e "$path" ] || continue
printf '%s %s\n' "$path" "$(readlink -f "$path")"
done | sort -k2 -s -u | cut -d' ' -f1
)"
echo "$cached_available_ids"
}
3) Yes, I know testing is a pain, but it's probably worth checking that install works with kvm with all three possible ways of providing disk.
kvm command line as generated by libvirt-bin
/usr/bin/kvm -S -M pc-0.11 -enable-kvm -m 1024 -smp 2,sockets= 2,cores= 1,threads= 1 -name BT -uuid 7e4c5cc4- f077-e52e- 6d2d-f865637e87 df -nodefaults -chardev socket, id=monitor, path=/var/ lib/libvirt/ qemu/BT. monitor, server, nowait -mon chardev= monitor, mode=readline -rtc base=utc -boot cd -device lsi,id= scsi0,bus= pci.0,addr= 0x6 -drive file=/local/ vimages/ isos/ubuntu/ lucid-alternate -amd64. iso,if= none,media= cdrom,id= drive-ide0- 1-0 -device ide-drive, bus=ide. 1,unit= 0,drive= drive-ide0- 1-0,id= ide0-1- 0 -drive file=/dev/ greasy- vg/bt,if= none,id= drive-virtio- disk0,boot= on,format= raw -device virtio- blk-pci, bus=pci. 0,addr= 0x7,drive= drive-virtio- disk0,id= virtio- disk0 -device e1000,vlan= 0,id=net0, mac=54: 52:00:33: 9c:2d,bus= pci.0,addr= 0x4 -net tap,fd= 46,vlan= 0,name= hostnet0 -chardev pty,id=serial0 -device isa-serial, chardev= serial0 -usb -vnc 127.0.0.1:0 -k en-us -vga cirrus -device ES1370, id=sound0, bus=pci. 0,addr= 0x5 -device virtio- balloon- pci,id= balloon0, bus=pci. 0,addr= 0x3
Some history and quirks.
1) This system has had the virtual disk swapped to SCSI and back to virtio.
2) grub-pc postinst fails after a switch from SCSI to virtio with cannot find /dev/disk/ by-id/. ...
(There is *NO* /dev/disk/by-id with virtio)
3) After purging grub-pc and reinstalling it, the postinst can no longer find a disk where grub should be installed.
4) grub-install --recheck /dev/vda works just fine
Thoughts.
1) udev persistent storage rules probably need to match the [vs]d*[!0-9] wildmat instead of sd*[!0-9].
2) Until udev is fixed, it would be pleasant if grub-pc.postinst would fallback to /dev/disk/by-uuid.
I think this does it.
available_ids()
{
local id path diskby
if [ "$cached_ available_ ids" ]; then available_ ids"
echo "$cached_
return
fi
for diskby in /dev/disk/by-id /dev/disk/by-uuid; do available_ ids="$( available_ ids"
[ -d "$diskby" ] && break
done
cached_
for path in "$diskby"/* ; do
[ -e "$path" ] || continue
printf '%s %s\n' "$path" "$(readlink -f "$path")"
done | sort -k2 -s -u | cut -d' ' -f1
)"
echo "$cached_
}
3) Yes, I know testing is a pain, but it's probably worth checking that install works with kvm with all three possible ways of providing disk.