Got thrown into a situation managing boxes that the person before me used virt, so trying to come up to speed. As a test doing a virt-install of this:

virt-install --virt-type=kvm --name kosmos-icc --ram 1000 --os-variant=centos7.0 --cdrom=/var/lib/libvirt/boot/CentOS-7-x86_64-Minimal-1810.iso --network=bridge=virbr0,model=virtio --graphics vnc --disk path=/var/lib/libvirt/images/centos7.qcow2,size=8,bus=virtio,format=qcow2 --boot userserial=on

It runs with this:

WARNING  Graphics requested but DISPLAY is not set. Not running virt-viewer.
WARNING  No console to launch for the guest, defaulting to --wait -1

Starting install...
Allocating 'centos7.qcow2'                                                                                                                                                | 8.0 GB  00:00:00     
Domain installation still in progress. Waiting for installation to complete.

Then hangs, I can hit ctrl-c and get my prompt back, doing a virsh list shows that it is running but doing a virsh domifaddr kosmos-icc shows nothing (the other one that is generic and was installed using the gui) shows the ip address (that i can ssh into) from the machine.

So not sure why it isn't completing or if it is and being silent about it or if I am missing a switch. I was assuming the virbr0 was the way to go with the network. So still learning virsh/virt and seeing if I can via a command line install a VM and then replicate the process on a non test machine.

The install logs in /root/.cache/virt-manager show no real errors... in fact shows:

[Wed, 19 Jun 2019 11:28:38 virt-install 351] DEBUG (guest:441) XML fetched from libvirt object:

... the xml ...

[Wed, 19 Jun 2019 11:28:38 virt-install 351] DEBUG (virt-install:744) Domain state after install: 1

that state after install is the last line before the log sees my ctrl-c keyboard interrupt.

WARNING  Graphics requested but DISPLAY is not set. Not running virt-viewer.
WARNING  No console to launch for the guest, defaulting to --wait -1

This WARNING is received because the virt-install command is trying to connect you to the console of the virtual machine using your display. However, it cannot do that in your environment because you don't have a DISPLAY set.

Presumably, you have lost the connection to your display by some combination of SSH without X11 forwarding and/or the use of sudo.

If you are able to connect to the console another way, you can include --noautoconsole in your virt-install command options and it will not make this attempt or display the WARNING.

You can connect to the console of the VM via virt-manager. Use it to setup an SSH connection to the virtual machine's host and all the display tunneling is done for you over SSH.

Once you have gotten console of the virtual machine you may find that there is no problem with the installation. And maybe you just need to wait longer for virsh domifaddr kosmos-icc to work. It's also not clear if this installation is meant to proceed automatically. It could also be waiting for your intervention.

Either way, once you have a console on the virtual machine it's state will begin to answer questions.

  • This is great info, the --noautoconsole did make it not hang. I am ssh'ed into a machine that is my 'test platform' for building these vms. I ssh from a mac, so I did try the virt-manager and that is when it complained `Gtk-WARNING cannot open display' . I assume I need to do some x11 forwarding somehow but not sure how to do that on a mac no less. – Codejoy Jun 20 '19 at 17:57
  • 2
    @Codejoy You should just be able to use ssh -X on macOS, the same as anywhere else. And the CentOS installer doesn't start the network by default, so that's why you couldn't see an IP address. (This is very annoying but they inherited the behavior from RHEL...) – Michael Hampton Jun 20 '19 at 18:18
  • 1
    On Mac you used to have to install XQuartz or something to do display back. (ssh -X) Not sure if that's the case now or not. – Aaron Copley Jun 20 '19 at 18:42
  • 2
    @AaronCopley Yes, it appears you are right. – Michael Hampton Jun 20 '19 at 18:46
  • You guys are awesome, the -X worked (I do have XQuartz installed). Then I was like 'uh oh will this work on the production box, that is two ssh hops.' I did ssh -X to the first machine, then ssh -X to the real machine I need to do this on...ran virt-manager and BAM it worked. Question for you all: Is there a web server that can be set up to basically be virt-manager but accessible from the web? Thanks guys! Going to mark this as solved, you all made my week. – Codejoy Jun 20 '19 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.