CentOS 5.1 x86_64, Xen, and how to create a stinkin' Ubuntu DomU

Support for the other architectures (X86_64, IA-64, and PowerPC)
Post Reply
robgreene
Posts: 20
Joined: 2008/04/17 02:06:12
Location: Central WI

CentOS 5.1 x86_64, Xen, and how to create a stinkin' Ubuntu DomU

Post by robgreene » 2008/04/19 16:48:53

I've got a CentOS x86_64 install and have created a few domU's with CentOS 5.1 in the paravirtualized environment -- and that seems to work well.

I'd like to see if I can get MythTV setup in a domU with the PCI forwarding that is available now. However, I'd like to do with with either Ubuntu or Fedora -- and I'm starting with Ubuntu.

BUT, I cannot figure out the install media.

I've tried the URL approach -- but since Ubuntu has a different structure for its install media, I cannot use the GUI approach.

So, I think I need to go with the command-line approach. I'm guessing what I need, and I figure someone can point me to the right boot images to use. I downloaded the vmlinuz and initrd images from http://archive.ubuntu.com/ubuntu/dists/gutsy/main/installer-amd64/current/images/cdrom/ but those are apprantly not what I need.

How do I go about creating an Ubuntu domU with CentOS 5.1? Nearly all the directions I've found were using Ubuntu as the dom0 and using the Ubuntu tools.

My specific error message is:
[code][root@localhost xen]# xm create mythtv1
Using config file "./mythtv1".
Error: (2, 'Invalid kernel', 'xc_dom_find_loader: no loader found\n')[/code]

And, in case it helps, here's my config file:
[code]#### Install
kernel = "/boot/vmlinuz-ubuntu-7.10-xen"
ramdisk = "/boot/initrd-ubuntu-7.10-xen"
#kernel = "/boot/vmlinuz-xen-install"
#ramdisk = "/boot/initrd-xen-install"
#extra = "text ks=http://192.168.1.105/minimal-ks.cfg"
on_reboot = 'destroy'
on_crash = 'destroy'

#### Normal usage
#on_reboot = 'restart'
#on_crash = 'restart'
#on_poweroff = "destroy"
#bootloader="/usr/bin/pygrub"

#### Common
name = "mythtv1"
maxmem = 512
memory = 512
disk = [ 'tap:aio:/var/lib/xen/images/mythtv1.img,xvda,w', ]
vif = [ 'bridge=xenbr0', ]
vcpus = 2
vfb = [ "type=vnc,vncunused=1,keymap=en-us" ][/code]

I assume this is something simple and stupid on my part, but I haven't a clue. :-?

TIA!
-Rob

Speedster
Posts: 4
Joined: 2005/09/22 07:28:47

Re: CentOS 5.1 x86_64, Xen, and how to create a stinkin' Ubuntu DomU

Post by Speedster » 2008/05/06 06:32:26

I have done this with Hardy (should be a similar process for Gutsy) following these steps:

1. Install the debootstrap RPM from Fedora development in Dom0

2. Create the devices to use as disks and mount the root partition in the Dom0. In my case I use LVM.

[quote]# lvcreate -n ubuntu -L10G /dev/vgxen
# lvcreate -n ubuntu-swap -L256M /dev/vgxen
# mke2fs -j /dev/vgxen/ubuntu
# mkswap /dev/vgxen/ubuntu-swap
# mkdir -p /mnt/xen
# mount /dev/vgxen/ubuntu /mnt/xen[/quote]

3. Debootstrap a system. Make sure to include extra repositories (multiverse, universe) and tell it to include the correct linux-image-xen, modules, libc6-xen and grub packages. Use a mirror closer to you, and change architecture if you are using x86_64:

[quote]# debootstrap --arch=i386 --include=linux-image-2.6.24-16-generic,linux-image-2.6.24-16-xen,linux-ubuntu-modules-2.6.24-16-xen,linux-image-xen,libc6-xen,grub --components=main,universe,multiverse hardy /mnt/xen http://mirror.3fl.net.au/ubuntu/[/quote]

4. Once that has finished chroot into the new debootstrapped tree for the next round of changes.

[quote]# chroot /mnt/xen
# export LANG=C[/quote]

5. Disable TLS libc libraries:

[quote]# mv /lib/tls /lib/tls.disabled[/quote]

6. Create /etc/fstab:

[quote]# cat /etc/fstab
/dev/xvda1 / ext3 defaults 0 1
/dev/xvdb1 none swap defaults 0 0
proc /proc proc defaults 0 0[/quote]

7. Create a folder for GRUB menu and update the config. This is the reason you install the linux-image-generic package:

[quote]# mkdir -p /boot/grub
# update-grub[/quote]

8. Edit /boot/grub/menu.lst
- replace "-generic" with "-xen"
- remove "quiet splash" from the kernel line
- add "console=xvc0" to both kernel lines (normal and recovery mode)

9. Setup a getty on the Xen console (xvc0):

[quote]# cd /etc/event.d
# cp tty1 xvc0
# sed -i -e "s/tty1/xvc0/g" xvc0[/quote]

10. Add xvc0 to /etc/securetty to allow root to login

11. Remove references to the hardware clock; these will cause the DomU to hang:

[quote]# update-rc.d -f hwclockfirst remove
# update-rc.d -f hwclock remove
# rm /etc/udev/rules.d/85-hwclock.rules[/quote]

12. Configure network interfaces (/etc/network/interfaces). In my setup I have DHCP, set static information if you require it:

[quote]# cat /etc/network/interfaces
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp[/quote]

13. Create /etc/hosts file

[quote]# cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 hardy[/quote]

14. Create /etc/hostname file

[quote]# cat /etc/hostname
hardy[/quote]

15. Exit chroot and unmount the filesystem.

[quote]# exit
# umount /mnt/xen[/quote]

16. Create DomU configuration. Because you have installed a kernel in DomU you can use pygrub:

[quote]# cat /etc/xen/ubuntu
bootloader = '/usr/bin/pygrub'
memory = 256
name = "ubuntu"
vif = [ '' ]
disk = [ 'phy:/dev/vgxen/ubuntu,sda1,w', 'phy:/dev/vgxen/ubuntu-swap,sdb1,w' ][/quote]

Start your DomU and it should be all good! There is a [url=https://bugs.launchpad.net/ubuntu/+source/linux/+bug/218126]bug[/url] with Hardy at the moment where the network driver will cause a kernel panic on ifup, but the kernel from the Bug Tracker will resolve that - it can be installed while in the chroot.

Speedster
Posts: 4
Joined: 2005/09/22 07:28:47

Re: CentOS 5.1 x86_64, Xen, and how to create a stinkin' Ubuntu DomU

Post by Speedster » 2008/05/07 02:08:48

There is a mistake in my previous post. The DomU config should have xvda and xvdb instead of sda and sdb.

[quote]# cat /etc/xen/ubuntu
bootloader = '/usr/bin/pygrub'
memory = 256
name = "ubuntu"
vif = [ '' ]
disk = [ 'phy:/dev/vgxen/ubuntu,xvda1,w', 'phy:/dev/vgxen/ubuntu-swap,xvdb1,w' ][/quote]

herrold
Posts: 100
Joined: 2005/03/19 22:14:28
Contact:

CentOS 5.1 x86_64, Xen, and how to create a stinkin' Ubuntu

Post by herrold » 2008/08/20 14:13:30

Thank you, Speedster

This appears to be a recap of the [url=http://ubuntuforums.org/archive/index.php/t-630886.html]Ubuntu article[/url] .

I had removed the LVM complexity, and made a simple local dd image to install into, which I loop mounted for the debootstrap to use:

[code]
/opt/xen/32bitdebiantesting.img
8256952 401276 7436248 6% /mnt/xen
[/code]

Following the debootstrap method against a plain Debian (testing) 'lenny' archive, I get the following failures:

[code]
[root@centos-5 mnt]# debootstrap --arch=i386 \
--include=linux-image-2.6.25-2-686,linux-image-2.6.25-2-xen-686,linux-modules-2.6.25-2-xen-686,linux-image-xen-686,libc6-xen,grub \
lenny /mnt/xen http://ftp.us.debian.org/debian/
...
I: Unpacking wget...
I: Unpacking whiptail...
W: Failure while installing base packages. This will be re-attempted up to five times.
[root@centos-5 mnt]#
[/code]

and sadly it did not get enough installed for me for the grub-install bootloader fix up to work, so I get;

[code]
[root@centos-5 xen]# xm create debian -c
Using config file "./debian".
Traceback (most recent call last):
File "/usr/bin/pygrub", line 656, in ?
chosencfg = run_grub(file, entry, fs)
File "/usr/bin/pygrub", line 513, in run_grub
g = Grub(file, fs)
File "/usr/bin/pygrub", line 203, in __init__
self.read_config(file, fs)
File "/usr/bin/pygrub", line 393, in read_config
raise RuntimeError, "couldn't find bootloader config file in the image provided."
RuntimeError: couldn't find bootloader config file in the image provided.
No handlers could be found for logger "xend"
Error: Boot loader didn't return any data!
Usage: xm create <ConfigFile> [options] [vars]
[/code]

It is not clear to me how to dial up logging or verboseness of debootstrap after reading the man page, and it does not appear to write to a log file.

Thanks for any feedback

-- Russ herrold

p.s., there is an unanswered question in the Ubuntu article forum as well. ;)

Speedster
Posts: 4
Joined: 2005/09/22 07:28:47

Re: CentOS 5.1 x86_64, Xen, and how to create a stinkin Ubuntu DomU

Post by Speedster » 2008/10/10 01:34:23

Sorry, I went on holiday and changed jobs so haven't been checking up on forums! debootstrap should put a log in the root of the path you're installing the packages to (debootstrap.log). That's about all I can remember, I haven't built a debian guest for a while!

Post Reply

Return to “CentOS 5 - X86_64,s390(x) and PowerPC Support”