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
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.
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.
sudo updatedb on my workstation, neither of those files were found. If the
vmbuilder tool had tried to install them, it must have failed.
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
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
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.