4

I've discovered the tool ubuntu-vm-builder, which I've installed and then invoked on an Ubuntu workstation as:

sudo vmbuilder xen ubuntu --suite maverick --flavour virtual --arch amd64 --mem=512 --rootsize 8192

This workstation is not the intended target host of the virtual machine, however; I would like to host the guest on a Red Hat Enterprise Linux 5 machine that is running Xen 3.0.3.

The output of this command appears to be a folder named ubuntu-xen containing three files:

  • tmpXXXXXX, a very large file which I assume is the root partition image
  • tmpYYYYYY, a somewhat large file which I assume is the swap partition image
  • xen.conf, a text file

I have copied the xen.conf file to the RHEL server's /etc/xen directory under the new name newvm, adjusting the paths of tempXXXXXX and tempYYYYYYin the file after also copying them from my local workstation to the RHEL server. When I launch the Virtual Machine Manager virt-manager, I can see the newvm virtual machine listed underneath the Dom0 machine.

When I try to start newvm, I get the error:

Error starting domain: virDomainCreate() failed POST operation failed: (xend.err 'Error creating domain: Kernel image does not exist: None')

Indeed, there exists an entry kernel = 'None' in the xen.conf file. How do I find out what the path of the kernel should be? Is this path supposed to be to a kernel stored on the local filesystem of the RHEL5 host, or is it supposed to be a path inside the guest image?

I see that the vmbuilder command provides for a --xen-kernel option, along with a --xen-ramdisk option, but I'm not sure what to use for either.

I think I should be able to get this to work, since Ubuntu is said to be supported as a Xen guest, even though the Xen 4.0.1 docs state support for only a limited set of distributions, Ubuntu excluded.


Update 1

When running vmbuilder on my local workstation, I did observe an output line saying:

Calling hook: install_kernel

and later, output lines saying:

update-initramfs: Generating /boot/initrd.img-2.6.35-23-virtual
[...]
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 2.6.35-23-virtual /boot/vmlinuz-2.6.35-23-virtual

So in the xen.conf file, I tried setting the lines:

kernel = '/boot/vmlinuz-2.6.35-23-virtual'
ramdisk = '/boot/initrd.img-2.6.35-23-virtual'

When trying to start the VM, I got an error similar to last time:

Error starting domain: virDomainCreate() failed POST operation failed: (xend.err 'Error creating domain: Kernel image does not exist: /boot/vmlinuz-2.6.35-23-virtual')

This makes me think that the RHEL5 machine is looking for local files, rather than a file within the binary guest disk image.

After running sudo updatedb on my workstation, neither of those files were found. If the vmbuilder tool had tried to install them, it must have failed.


Update 2

I was able to extract the kernel and initrd images from the guest disk binary by mounting it:

mkdir mnt_tmp
sudo mount ubuntu-xen/tmpXXXXXX mnt_tmp/ -o loop
cp mnt_tmp/boot/vmlinuz-2.6.35-23-virtual virtual_kernel_ubuntu
cp mnt_tmp/boot/initrd.img-2.6.35-23-virtual virtual_initrd_ubuntu

These two files I copied to the RHEL5 server, and edited the xen.conf file to point to them as kernel and ramdisk.

With this done, I could "run" the newvm virtual machine from within virt-manager, but was met with the message

Console Not Configured For Guest

when I double clicked the entry to open the Virtual Machine Console. As suggested by a forum, I then added the line

vfb = [ 'type=vnc' ]

to the configuration file, recreated the virtual machine (a ~10 min process), and this time got the message:

Connecting to console for guest

This remained indefinitely; after selecting View -> Serial Console, I found a kernel panic:

[5442621.272173] Kernel panic - not syncing: Attempted to kill the idle task!
[5442621.272179] Pid: 0, comm: swapper Tainted: G      D     2.6.35-23-virtual #41-Ubuntu
[5442621.272184] Call Trace:
[5442621.272191]  [<ffffffff815a1b81>] panic+0x90/0x111
[5442621.272199]  [<ffffffff810652ee>] do_exit+0x3be/0x3f0
[5442621.272204]  [<ffffffff815a5e20>] oops_end+0xb0/0xf0
[5442621.272211]  [<ffffffff8100ddeb>] die+0x5b/0x90
[5442621.272216]  [<ffffffff815a56c4>] do_trap+0xc4/0x170
[5442621.272221]  [<ffffffff8100ba35>] do_invalid_op+0x95/0xb0
[5442621.272227]  [<ffffffff8130851c>] ? intel_idle+0xac/0x180
[5442621.272232]  [<ffffffff810072bf>] ? xen_restore_fl_direct_end+0x0/0x1
[5442621.272239]  [<ffffffff815a48fe>] ? _raw_spin_unlock_irqrestore+0x1e/0x30
[5442621.272247]  [<ffffffff8108dfb7>] ? tick_broadcast_oneshot_control+0xc7/0x120
[5442621.272253]  [<ffffffff8100ad5b>] invalid_op+0x1b/0x20
[5442621.272259]  [<ffffffff8130851c>] ? intel_idle+0xac/0x180
[5442621.272264]  [<ffffffff813084e0>] ? intel_idle+0x70/0x180
[5442621.272269]  [<ffffffff810072bf>] ? xen_restore_fl_direct_end+0x0/0x1
[5442621.272275]  [<ffffffff8148a147>] cpuidle_idle_call+0xa7/0x140
[5442621.272281]  [<ffffffff81008d93>] cpu_idle+0xb3/0x110
[5442621.272286]  [<ffffffff815873aa>] rest_init+0x8a/0x90
[5442621.272291]  [<ffffffff81b04c9d>] start_kernel+0x387/0x390
[5442621.272297]  [<ffffffff81b04341>] x86_64_start_reservations+0x12c/0x130
[5442621.272303]  [<ffffffff81b08002>] xen_start_kernel+0x55d/0x561

Update 3

I tried an i386 architecture instead of amd64, but got the same kernel panic.

Also, it seems the Virtual Machine Manager pays attention to the format of the filename of the kernel; for the same kernel binary, I tried simply naming it vmlinuz-virtual, which threw out an error box about an invalid kernel. When I named it vmlinuz-2.6.35-23-virtual, it did not throw the error, but it did still result in the kernel panic shortly thereafter.

kostmo
  • 141
  • 5

3 Answers3

1

You might want to look into the xen-tools package which if you specify --pygrub on the xen-create-image command it will embed the kernel/initrd within the guest disk image which may make it easier for you to transfer guest images between systems.

thelsdj
  • 830
  • 1
  • 12
  • 25
1

you might want to consider upgrading your xen infrastructure, xen 3.x does have limitations to which guests it supports. Have a look at the following, http://www.redhat.com/resourcelibrary/articles/enterprise-linux-virtualization-support

Have you tried an older ubuntu version?

Danie
  • 1,360
  • 10
  • 12
0

You should use (have used?) the linux-image-virtual kernels provided by Ubuntu, and a newer Xen hypervisor (possibly with pygrub or similar).

But your question is old, nowadays you wouldn't use Ubuntu-10.10 and on newer ones you use the same kernel under Xen (both hvm and paravirt) and on bare metal.

Luke404
  • 5,826
  • 4
  • 47
  • 58