How To Run Fully-Virtualized Guests (HVM) With Xen 3.2 On Debian Lenny (x86_64) - Page 2

Most installers require you to reboot at the end of the installation and remove the installation media; this is not possible if you have specified an ISO image in the guest configuration file, and even if you use a CD - the reboot of the guest happens so fast that you cannot remove the CD before the guest boots again. This means the guest will boot from the CD or ISO file and start the installer again.

If that happens, stop the guest...

xm destroy xen1.example.com

... and edit the guest configuration file:

vi /etc/xen/xen1.example.com.cfg

Remove the CD drive from the boot line...

[...]
boot="c"
[...]

... and boot the guest again:

xm create /etc/xen/xen1.example.com.cfg

This time it should boot from its hard drive. Of course, you can now use VNC again to connect to the guest.

 

3 Using VNC When There Are Multiple Guests

If you have multiple guests running at the same time, the guests obviously cannot all use port 5900 at the same time. Therefore the second guest will use port 5901, the third one port 5902, and so on. You can check the VNC ports that are currently in use by running

netstat -tap

server1:/etc/xen# netstat -tap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *:5900                  *:*                     LISTEN      24492/qemu-dm
tcp        0      0 *:5901                  *:*                     LISTEN      24950/qemu-dm
tcp        0      0 *:5902                  *:*                     LISTEN      25295/qemu-dm
tcp        0      0 *:42991                 *:*                     LISTEN      2293/rpc.statd
tcp        0      0 *:sunrpc                *:*                     LISTEN      2282/portmap
tcp        0      0 *:ssh                   *:*                     LISTEN      2987/sshd
tcp        0      0 localhost.localdom:smtp *:*                     LISTEN      2803/exim4
tcp        0      0 server1.example.co:5901 192.168.0.6:49936       ESTABLISHED 24950/qemu-dm
tcp        0    148 server1.example.com:ssh 192.168.0.2:4399        ESTABLISHED 4134/2
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      2987/sshd
server1:/etc/xen#

In your VNC viewer, you must specify the new port (e.g. 192.168.0.100:5901):

And voilà, here's the second guest, this time an Ubuntu 8.10 desktop:

And here's our third guest, a Windows XP desktop:

 

4 Troubleshooting

It might happen that you start a guest, but cannot connect to it using VNC, and netstat -tap shows no new VNC port. In the log file of the guest in /var/log/xen/qemu-dm-*.log you might see something like this:

I/O request not ready: 0, ptr: 0, port: 0, data: 0, count: 0, size: 0

Shut down one or two of the other guests, and afterwards it should be possible to start this guest again.

 

5 Important Xen Commands

Here are the most important Xen commands:

xm create -c /path/to/config - Start a virtual machine.
xm shutdown <name> - Stop a virtual machine.
xm destroy <name> - Stop a virtual machine immediately without shutting it down. It's as if you switch off the power button.
xm list - List all running systems.
xm help - List of all commands.

 

6 Links

Share this page:

9 Comment(s)

Add comment

Comments

From: admin at: 2009-05-01 22:17:11

The egrep command doesn't show the correct details anymore once Xen is installed. That's why you must use

xm dmesg | grep -i hvm

From: Flip at: 2009-05-01 21:14:59

If I run:

xm dmesg | grep -i hvm
(XEN) HVM: VMX enabled

It tells me I have the support but:

 egrep '(vmx|svm)' --color=always /proc/cpuinfo

Return nothing so I don't know if I have the possibility or not? Is it correct that I get so different results? It's an older Quadcore 6600 with ,if I keep correct in my mind, just 4MB L1 Cache not with 8MB.

From: Frenchy at: 2009-11-26 17:19:59

Great ! This is the first tutorial about Windows over Xen i've found which is working !

Thanks a lot !

From: Marius Ionel at: 2010-01-20 00:34:51

HVM works with LVM too.

Instead of 

disk = [ 'file:/home/xen1.example.com.img,xvda,w', 'file:/home/ubuntu8_10_server_amd64.iso,xvdc:cdrom,r' ]

 use

disk = [ ''phy:/dev/vps/ubuntu-test,xvda,w'', 'file:/home/ubuntu8_10_server_amd64.iso,xvdc:cdrom,r' ]

where ubuntu-test is your logical volume. This must be created first. Maybe it works without created first, but I have'n tryed. yet.

From: Lance Leger at: 2010-03-09 15:50:37

Like the author, I couldn't get HVM with LVM to work. I could get my HVM to boot via an ISO, recognize my logical volume, and even partition/install to the logical volume. Upon reboot, the server failed to recogize the hard drive. Suggestions?

From: at: 2010-03-18 14:18:11

I found a way to make it work for me:

 In the  /etc/xen/xen1.example.com.cfg file use a different disk line.
change:

disk = [ 'file:/home/xen1.example.com.img,xvda,w', 'file:/home/ubuntu8_10_server_amd64.iso,xvdc:cdrom,r' ]

to:

disk = [ 
'phy:/dev/virtual/xen2.example.com-disk,ioemu:hda,w',
'file:/root/windows.iso,ioemu:hdb:cdrom,r' ]

And you can see your LVM in the installer and you can boot the newly installed machine!

From: LightVision at: 2011-10-11 12:09:44

Hi,

 The line above should work.

 If you are trying to to setup windows that depends of windows version, I think.

Anyway, for the XP you should use hda instead of xvda

 Good Luck.

Unfortunately,  there is any chance, until now, to setup a HVM with routed scripts in Dom0.

From: clumsy888 at: 2010-03-05 22:52:21

Thanks - it has helped a lot!! It took a while but now :-) a WinXP is running as Guest in Debian Lenny. When starting the Guest with "xm create /etc/xen/xen1.example.com.cfg" command. I got an error, something like: Device 0 (vif) could not be connected. Hotplug skripts not working. solved by commending the vif line in the xen1.example.com.cfg file. (and i changed the /etc/xen/xend-config.sxg file of course).

From: Anonymous at: 2013-09-27 08:41:21

Very good tutorial, I used it for Debian Squeeze.

Just 2 points worth mentioning in my opinion :

1)  starting from an ordinary Debian Xen configuration (just intended to use for ParaVirtualisation), you must add :

apt-get install xen-qemu-dm-4.0

or whatever version according to your Debian version.

2) Very important for me (I had to search a while to correct that silly bug). My screen is on Windows (apologizes...) and I used tight VNC. Be careful that by default, tight VNC uses "Tight" encoding and that was apparently causing many hangs of the HVM for me. Switch to "Raw" encoding and everything is fine !