Xen FAQ Console: Difference between revisions

From Xen
Jump to navigationJump to search
(Move from FAQ Using)
Line 21: Line 21:


The problem is that when the box panics, it stops syslogd, so you don't get the panic output in /var/log. The best way to fix this is to setup a logging serial console.
The problem is that when the box panics, it stops syslogd, so you don't get the panic output in /var/log. The best way to fix this is to setup a logging serial console.

=== How do I connect to or detach from a console? ===
You can connect to a console directly when starting a domU:


<pre><nowiki>
# xm create -c your-DomU-config
</nowiki></pre>

This command will start a domU and connect to it's console immediately.

If you want to connect to a domU console that is already running you first have to find the domU id using:


<pre><nowiki>
# xm list
Name Id Mem(MB) CPU State Time(s) Console
Domain-0 0 123 0 r---- 2482.9
testXM1 30 127 1 -b--- 4.9 9630
testXM2 32 127 1 -b--- 4.7 9632
testXM3 34 128 1 -b--- 0.3 9634
</nowiki></pre>

Now you can connect to for example the testXM2 domU with Id 32 using:


<pre><nowiki>
# xm console 32
</nowiki></pre>

You can detach from a console using the escape character: <CTRL> ']'.

On a German keyboard try <CTRL> '5' if the above doesn't work. This works both in Putty and gnome-terminal. On a Swedish keyboard (mac running iTerm) <CTRL> 'å' works.

=== In 3.0, how can I expose a console on a TCP port like in 2.0 ===
Xen 3.0 no longer exposes consoles on TCP ports to provide stronger security out of the box. If this feature is desired (and you're on an isolated network), you can achieve the same results using inetd or xinetd. The following is an xinetd service that can be enabled by placing it in /etc/xinetd.d/xen:


<pre><nowiki>
# default: on
# description: Xen console port
service xen1
{
disable = yes
type = UNLISTED
socket_type = stream
protocol = tcp
user = root
wait = no
port = 9001
server = /usr/sbin/xm
server_args = console 1
}
service xen2
{
disable = yes
type = UNLISTED
socket_type = stream
protocol = tcp
user = root
wait = no
port = 9002
server = /usr/sbin/xm
server_args = console 2
}
</nowiki></pre>

Adding entries for each domid that you want to expose (and the port you want to expose it on). In the above example, entries are only made for domain IDs 1 and 2. Any additional xinetd parameters can be used to limit where the connections come from and to implement logging.


<!-- Leave this at the end -->
<!-- Leave this at the end -->

Revision as of 14:02, 18 October 2012

I have an Xen image that was built for a graphical console (VNC). Is there any way to change it to the non-graphical console (xen console)?

For HVM guest, you need to enable serial port on domU config file (example here: http://pastebin.com/fb6fe631), and setup domU to use serial port (ttyS0 on Linux) by modifying (for Linux domU) /boot/grub/menu.lst, /etc/inittab, and /etc/securetty.

If it's PV guest, you need to set up domU to use xen console (which is xvc0 on current xen version, hvc0 on pv_ops kernel). It's similar to setting up domU for serial console, you just need to change ttyS0 to hvc0. An example of domU setup that can use both xvc0 and vnc console is here : http://pastebin.com/f6a5022bf

How do I remove an active virtual machine?

xm shutdown or xm delete

How do I run xm console to a WindowsXP DomU?

You can't xm console to that (I'm not sure you can xm console to any hvm, but I know you can't to one that doesn't have a console).

I start a new DomainU (Guest) and some text scrolls by for launching the guest but then it just sits there with Continue and no actions takes place?

The console for this new DomainU is not properly available for you; fix this by adding xtra="xencons=tty" in the configuration file. This will bring up a login screen directly for your new DomainU.

One of our CentOS 5.3 randomly reboots, at different times of the day, and I can't see why it's doing it. I have looked through the logs, but don't see any thing in there that shows me why it has rebooted. How can I debug this?

The problem is that when the box panics, it stops syslogd, so you don't get the panic output in /var/log. The best way to fix this is to setup a logging serial console.

How do I connect to or detach from a console?

You can connect to a console directly when starting a domU:


# xm create -c your-DomU-config

This command will start a domU and connect to it's console immediately.

If you want to connect to a domU console that is already running you first have to find the domU id using:


# xm list
Name Id Mem(MB) CPU State Time(s) Console
Domain-0 0 123 0 r---- 2482.9
testXM1 30 127 1 -b--- 4.9 9630
testXM2 32 127 1 -b--- 4.7 9632
testXM3 34 128 1 -b--- 0.3 9634

Now you can connect to for example the testXM2 domU with Id 32 using:


# xm console 32

You can detach from a console using the escape character: <CTRL> ']'.

On a German keyboard try <CTRL> '5' if the above doesn't work. This works both in Putty and gnome-terminal. On a Swedish keyboard (mac running iTerm) <CTRL> 'å' works.

In 3.0, how can I expose a console on a TCP port like in 2.0

Xen 3.0 no longer exposes consoles on TCP ports to provide stronger security out of the box. If this feature is desired (and you're on an isolated network), you can achieve the same results using inetd or xinetd. The following is an xinetd service that can be enabled by placing it in /etc/xinetd.d/xen:


# default: on
# description: Xen console port
service xen1
{
        disable         = yes
        type            = UNLISTED
        socket_type     = stream
        protocol        = tcp
        user            = root
        wait            = no
        port            = 9001
        server          = /usr/sbin/xm
        server_args     = console 1
}
service xen2
{
        disable         = yes
        type            = UNLISTED
        socket_type     = stream
        protocol        = tcp
        user            = root
        wait            = no
        port            = 9002
        server          = /usr/sbin/xm
        server_args     = console 2
}

Adding entries for each domid that you want to expose (and the port you want to expose it on). In the above example, entries are only made for domain IDs 1 and 2. Any additional xinetd parameters can be used to limit where the connections come from and to implement logging.

Where do I find more Console FAQs?

See Xen Common Problems#Console