I’m hoping to essentially follow this: help.ubuntu.com/9.10/installation-guide/i386/linux-upgrade.html and this: ubuntuforums.org/showpost.php?p=4892417&postcount=2
Essentially, create LVs and format them (look at the previous posts for the how to), and have debootstrap installed on the CentOS host.
Mount the LV in which you’re going to install Ubuntu on by running mount <LV location> <mount location>. I did mount /dev/domU/ubuntu /mnt/ubuntu.
The command to run is
debootstrap --arch ARCH karmic <mount location of LV> <mirror to download from>. For me, this should be
debootstrap --arch i386 --include=linux-image-virtual,libc6-xen,grub --components=main,universe,multiverse karmic /mnt/ubuntu http://sg.archive.ubuntu.com/ because my local mirror (by local, I mean Singapore) is sg.archive.ubuntu.com. (Note: Don’t use the ‘release’ mirrors – they won’t work.)
Once debootstrap comes back ok, run
Setup the Xen console –
cd /etc/init and
cp tty1.conf hvc0.conf. Change tty1 in the file to hvc0 –
cat tty1.conf |sed 's/tty1/hvc0/g'>hvc0.conf.
You must do this before starting any of the installs. The debootstrap install fails because it tries to start rsyslog, then fails when it can’t connect to upstart, causing dpkg to fail!
upstart (the new service manager in 9.10) doesn’t like chrooted environments, so we have to apply a workaround –
dpkg-divert --local --rename --add /sbin/initctl && ln -s /bin/true /sbin/initctl
For good measure, do
dpkg --configure -a just make sure everything is successful.
dpkg will complain about missing locales – run
aptitude install language-pack-en to stop the complaints.
Edit /etc/fstab to reflect the drives:
[email protected]:/# cat /etc/fstab
proc /proc proc defaults 0 0
sys /sys sysfs defaults 0 0
/dev/xvda1 / ext3 defaults,errors=remount-ro 0 1
/dev/xvdb1 none swap defaults 0 0
Create a Xen enabled kernel – download the kernel source from the Ubuntu repos and set it up for Xen. (See below for the current steps.)
Kill the hardware clock, apparently it causes the domU to lock up –
update-rc.d -f hwclockfirst remove && update-rc.d -f hwclock remove
Add a user –
Create an admin group if you want –
addgroup --system admin && adduser myusername admin – this doesn’t add you to the sudoers file though. Still have to add yourself manually. I just added my user account to the sudo usergroup, and allowed the sudo group to run all commands with sudo. (From the chroot environment, run
Set the hostname –
echo 'name' > /etc/hostname
Setup the network devices in /etc/network/interfaces:
iface lo inet loopback
iface eth0 inet dhcp
Setup the routing – add
127.0.0.1 localhost localhost.localdomain hostname to /etc/hosts
Modify /boot/grub/menu.lst and change the “indomU” to “true”. (Also, enable memtest as a boot option if you want, but it’s not much use in a domU system.)
Then, run update-grub to update the bootloader to use the Xen-enabled kernel.
ALSO: The Xen domU configuration file needs to be changed – this will store the MAC address of the network interface, script used to create the interface, and the bridge to which the interface will be joined As well as all the memory sizes and what not.
The kernel compilation stuff
Based on help.ubuntu.com/community/Kernel/Compile
echo "deb-src http://sg.archive.ubuntu.com/ubuntu karmic main" >> /etc/apt/sources.list && apt-get update
apt-get install fakeroot kernel-wedge build-essential makedumpfile kernel-package
apt-get build-dep linux
Find the version of the kernel source in the apt repo. Using the “$(uname -r)” trick doesn’t work because we’re in a chrooted environment.
apt-cache search linux-image
In my case, it was linux-image-2.6.31-14. So,
apt-get build-dep --no-install-recommends linux-image-2.6.31-14-virtual
mkdir kernel && cd kernel && apt-get source linux-image-2.6.31-14-virtual
apt-get install libncurses5-dev
Go to Processor type and features -> High Memory Support and change it to something other than 4GB. (The xen option won’t appear till you do so.)
Then, go back to Paravirtualised Guest Support and enable Xen support.
Now, just keep searching for Xen options (Hint: Hit ‘/’ and type ‘xen’) and enabling all of them. Also, you can probably disable stuff that you don’t need and set the processor architecture too, while you’re at it.
As a note, for some strange reason, Xen doesn’t show up under the Virtualization sub menu in the root menu. My guess is that the Virtualization menu refers to stuff that the OS will virtualize, as in the newly created kernel will be the dom0. Ubuntu doesn’t support this in its sources, so makes sense that it’s not included.
Once the config’s finished, run
If you have a multi-core system, run
export CONCURRENCY_LEVEL=(1+number of cores) I have a 4 core system (dual dual core P4 era Xeons), so I ran export CONCURRENCY_LEVEL=5
Finally, create the kernel.
fakeroot make-kpkg --initrd --append-to-version=-xen-p4xeon kernel-image kernel-headers
Once the packages are created, do dpkg -i ../*.deb