libguestfs / guestfs-tools

Tools for accessing and modifying guest disk images
https://libguestfs.org
GNU General Public License v2.0
14 stars 6 forks source link

virt-install uses `vda` whereas supermin uses `sda` #9

Closed ehuelsmann closed 1 year ago

ehuelsmann commented 1 year ago

This line cases virt-install to use the default virtio-blk driver, which causes the installation device to be called /dev/vda.

https://github.com/rwmjones/guestfs-tools/blob/6b81746649cf586c9783fa4f82b0fce138df00f1/builder/templates/debian-11.virt-install-cmd#L16

Running apt full-upgrade inside the virt-builder appliance fails due to the disk device being named /dev/sda in the supermin appliance. The full-upgrade is required because the distro has advanced its minor release: the installation or update of any package depends on it.

ehuelsmann commented 1 year ago

The template file mentions being generated for example purposes only. While I don't mind, I'd like to send a patch to address the above (i.e. align the supermin and virt-install invocations to libvirt/qemu). However, it's unclear (to me) where the code is that such a patch would/could be applied: the templates indeed do not work to instantiate an installation environment with preceeding.

ehuelsmann commented 1 year ago

For others running into this issue before it's fixed by aligning virt-install with supermin: this works around the issue:

run-command bash -c "debconf-set-selections <<< 'grub-pc grub-pc/install_devices multiselect /dev/sda'"
run-command DEBIAN_FRONTEND=noninteractive apt-get full-upgrade -q -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew
rwmjones commented 1 year ago

In this file: https://github.com/rwmjones/guestfs-tools/blob/master/builder/templates/make-template.ml

However there are some problems: (1) We basically assume virtio-scsi everywhere. (2) The existing templates cannot be changed easily.

ehuelsmann commented 1 year ago

Thanks for the quick response!

There's no problem to use virtio-scsi everywhere, as far as I'm concerned. As far as I'm able to see, libguestfs is explicitly adding the virtio-scsi controller to the libvirt machine definition, though (in lib/launch-libvirt.c). I'd like to use the same approach for the virt-install command as there is for the supermin VM creation, for consistency.

The fact that old templates can't be changed shouldn't be much of a problem: I've tried older templates (meaning, I've used virt-builder with images up to 'debian10') and none exhibit this problem. I've searched the Debian BTS and I think I found that they tightened the checks on grub-install where it now explicitly checks that the initial installation device is available and being installed to -- as of Debian 11.

rwmjones commented 1 year ago

I'm not sure what the request is here.

ehuelsmann commented 1 year ago

You're right. I'll file a true bug report. Closing this one and opening a new one with the report. Sorry for being insufficiently clear.

ehuelsmann commented 1 year ago

Opened #10. Hopefully that report is more helpful than these ramblings.