2

So I am trying to create a VM using KVM (on CentOS 6.3) and the command I use is as follows:

virt-install  --connect qemu:///system  --virt-type kvm  --name ffVM32  --ram 1024 --disk path=/home/datastore/images/ffVM32.img,size=10  --vnc  --cdrom  /home/datastore/backups/CentOS-6.4-i386-minimal.iso   --bridge bridge0

The output I get is:

Starting install...
Allocating 'ffVM32.img'                                             |  10 GB     00:00     
Creating domain...                                                  |    0 B     00:00     
Cannot open display: 
Run 'virt-viewer --help' to see a full list of available command line options
Domain installation still in progress. You can reconnect to 
the console to complete the installation process.

I have done a group install of "X Windows System" but it doesn't help. I am trying to access this via my laptop which runs Ubuntu 13..04. The curious thing is that when I tried the same from another machine that has PCLinuxOS, virt-viewer opens and I can continue with the installation.

While listing all the VMs, I find the VM running

[root@ts3 ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 8     ffVM32                         running

What am I missing out on?

3 Answers 3

2

You probably haven't logged into your hardware node using -X switch of ssh.

[root@yourmachine]# ssh -X root@<your-hardware-node-ip>

From the man page:

         Enables X11 forwarding.  This can also be specified on a per-host 
         basis in a configuration file.

         X11 forwarding should be enabled with caution.  Users with the
         ability to bypass file permissions on the remote host (for the
         user's X authorization database) can access the local X11 display
         through the forwarded connection.  An attacker may then be able
         to perform activities such as keystroke monitoring.

         For this reason, X11 forwarding is subjected to X11 SECURITY
         extension restrictions by default.  Please refer to the ssh -Y
         option and the ForwardX11Trusted directive in ssh_config(5) for
         more information.

To disable X11 forwarding you can use the -x switch.

To enable X11 forwarding, edit the conf file located at /etc/ssh/sshd_config and uncomment the following line:

X11Forwarding Yes

and restart the service using service sshd restart

Hope this helps.

1

Full steps to get vnc to work with libvirt:

  1. If you are doing ssh to the host:

    ssh -XY ...@....
    
  2. Install X11 if not installed (for RHEL, adjust for others):

    yum groupinstall "X Window System"
    

You might need to try to logout and ssh again as in step 1.

  1. ONLY if the above does not work by itself and $DISPLAY is not defined, try to define it:

    export DISPLAY=":0"
    
0

Connect with -X switch (ssh -X [host]) from your Ubuntu laptop.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .