Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I installed xcp-xapi package in Ubuntu 12.10. I have already created a PV VM in XenCenter, but I cannot access it's console -- when I choose the Console tab in XenCenter, I just got a blank page.

I tried this via console and got this:

bear@ubuntu-tmp1:~$ sudo xe vm-list params=dom-id
dom-id ( RO)    : 0


dom-id ( RO)    : 2


bear@ubuntu-tmp1:~$ sudo xenstore-ls /local/domain/2/serial
0 = ""
 limit = "65536"
bear@ubuntu-tmp1:~$

According this official link, I should at least see 'tty' and 'vnc' in output, but I got neither of them... Now I completely have no way to install OS on that VM because there is no console available... :-(

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

There is a hidden CLI command (for which I have submitted a request to make non-hidden):

xe console uuid=<vm_uuid>

Note that this only works for PV guests. Alternatively, for both PV and HVM guests, you can use vncviewer to get a VNC console. Use xenstore to get the VNC port:

PORT=xenstore-read /local/domain/${domid}/console/vnc-port

and then call:

vncviewer -via root@${YOUR_SERVER} localhost::${PORT}

Here is a script which does this for you:

#!/bin/bash

function usage () {
    echo "Usage:"
    echo "   `basename $0` -h <xenserver host> -g <guest vm name-label>"
    echo "   `basename $0` -h <xenserver host> -u <guest vm uuid>"
    echo "   `basename $0` -h <xenserver host> -d <domID>"
    exit 1
}

while getopts "h:g:u:d:" option
do
    case $option in
        h ) xs=${OPTARG} ;;
        g ) vm=${OPTARG} ;;
        u ) uu=${OPTARG} ;;
        d ) id=${OPTARG} ;;
        * ) usage
    esac
done

if [ -z ${xs} ]; then
    usage
fi

if [ -z ${uu} ] && [ -z ${vm} ] && [ -z ${id} ]; then
    usage
fi

if [ ! -z ${uu} ]; then
    domid=`ssh root@${xs} xe vm-list uuid=${uu} params=dom-id --minimal`
elif [ ! -z ${vm} ]; then
    domid=`ssh root@${xs} xe vm-list name-label=${vm} params=dom-id --minimal`
elif [ ! -z ${id} ]; then
    domid=${id}
fi

if [ -z ${domid} ]; then
    echo "Could not find guest ${vm}${uu} on host ${xs}."
    exit 1
elif [ ${domid} -lt 0 ]; then
    echo "Guest ${vm}${uu} has no dom-id. Is your vm running?"
    exit 1
fi

port=`ssh root@${xs} xenstore-read /local/domain/${domid}/console/vnc-port`

if [ -z ${port} ]; then
    echo "Couldn't read VNC port from xenstore. Is your vm running?"
    exit 1
fi

echo "Connecting to vnc port ${port} on host ${xs}..."
set -x
vncviewer -via root@${xs} localhost::${port}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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