libvirt: virt-install hangs on installation
Asked Answered
I

2

5

After reading wiki libvirt I started virt-install to install VM off the Debian10 netinstall ISO image:

% sudo virt-install --debug --connect qemu:///system --virt-type kvm --name vm-debian --memory 1024 --disk path=/var/lib/libvirt/images/vm-debian.img,size=10 --graphics none --cdrom /var/lib/libvirt/images/debian-10.6.0-amd64-netinst.iso --location /var/lib/libvirt/images/debian-10.6.0-amd64-netinst.iso --network network=default,mac=00:22:bb:cc:dd:ee --os-variant debian10

I can see in debug output that virt-install analyzes ISO image, extracts initrd.gz and vmlinuz and the last message before it hangs:

[Wed, 11 Nov 2020 13:49:51 virt-install 729328] DEBUG (cli:370) Running: virsh --connect qemu:///system console vm-debian
Connected to domain vm-debian
Escape character is ^]

If I press 'Ctrl-]' virt-install exits and qemu-kvm process is still in the memory.

What exactly is happening here? Am I doing something wrong? Perhaps this method of installation in libvirt environment is obsolete, and there exists something more simple and straightforward?

Thanks.

UPDATE

As suggested by DanielB, I enabled setial port on the guest side and enabled virt-install output on the serial console:

% virt-install --name debian10 --virt-type kvm --memory 1024 \
               --disk path=/var/lib/libvirt/images/vm-debian10.img,size=10 \
               --graphics none \
               --console pty,target_type=serial \
               --cdrom /var/lib/libvirt/images/debian-10.6.0-amd64-netinst.iso \
               --location /var/lib/libvirt/images/debian-10.6.0-amd64-netinst.iso \
               --network bridge=virbr0 \
               --os-type linux --os-variant debian10 \
               --extra-args console=ttyS0,115200n8 serial
Iodide answered 11/11, 2020 at 19:1 Comment(0)
C
4

This is not a hang - whats happening is that because you used -graphics none, no graphical console is created and thus it assumes you're trying todo a serial console installation. virt-install is displaying the serial port output, and letting you type in input, but your guest OS does not appear to be activating the serial port on the guest side, so you see no output and anything you type is ignored by the guest.

IOW, the fix for the root cause issue here is that the guest OS installer needs to be told to run over the serial port in some manner. The alternate workaround is to enable graphics as your followup mentioned

Celio answered 12/11, 2020 at 11:30 Comment(2)
thanks for suggestion. I think I have fixed it, I updated my question.Iodide
See the notes for [ubuntu-16.04] here: builder.libguestfs.org/index. Adding those console params to the linux boot args seemed to work on my Ubuntu 18.04 image. Now to fix networking...Ronda
I
2

I managed to proceed with installation only with graphics enabled, i.e. passing --graphics vnc,listen=0.0.0.0 to virt-install. This will start virt-viewer (should be installed).

Iodide answered 11/11, 2020 at 22:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.