Ubuntu Intrepid Xen DomU installer

December 4th, 2008

I’ve hacked the ubuntu intrepid(amd64 only) initrd so you can run the installer in a Xen DomU. No more debootstrap!

The only glitch is that the installer thinks that the xen block devices are part of a SATA array, when asked to activate the array select no.

vmlinuz

initrd

Example config:

memory = 500
name = “intrepid”
vcpus = 1
disk = ['phy:/dev/xenvg/ubuntu-test,xvda,w']
kernel = “/xen/vmlinuz”
ramdisk = “/xen/initrd”
#bootloader=”/usr/bin/pygrub”
vif  = [ 'bridge=eth0']
#this is for your framebuffer if needed
#vfb         = ['type=vnc,vncunused=1,vncdisplay=0,vnclisten=0.0.0.0,vncpasswd=password']

When the install is finished uncomment pygrub and comment out kernel and ramdisk and it should be fully functional. If you have any issues or comments please feel free.

Ubuntu intrepid Xen DomU made easy

November 6th, 2008

I made this script for bootstrapping and “Xenifying” an ubuntu easily. You will have a working ubuntu domU in 30 seconds flat with a fast mirror.

Root password will always be set to ‘password’. Hostname will be ubuntu , loopback interface will be set up. The sole argument is either a filename or a block device to install the distribution onto. See the top of the script for more configurable options. Notibly the mirror option.

The only prerequisite is that you have (a recent)debootstrap installed. Its available for nearly every distro these days.

Remember that i think you will need Xen 3.3 to boot an ubuntu intrepid DomU.

mkubuntu

How to create an ubuntu server DomU using the normal ubuntu install procedure

September 10th, 2008

How to create an ubuntu server DomU using the normal ubuntu install procedure(64 bit only, 32 bit maybe soon.). It may work or it may not, no guarantees. It did for me.

First download the kernel and the initrd and the ubuntu-8.04.1-server-amd64.iso file from ubuntu.com .

Create the xen config file similar to this one paying attention to all the paths.

Xen Config File:

memory = 256
name = “ubuntutemp”
disk = ['phy:/dev/filevg/ubuntutemp,hda,w','file:/mnt/filelv/Downloads/ISOs/ubuntu-8.04.1-server-amd64.iso,sda:cdrom,r']
kernel = ‘/xen/ubuntutemp/kernel-xen’
ramdisk = ‘/xen/ubuntutemp/initrd-xen’
#bootloader=”/usr/bin/pygrub”
vif  = [ '' ]

Fire up the DomU

xm create -c ubuntu.cfg

Setting up the locale settings will be 1st thing.

Then you will be asked:

Load CD-ROM drivers from a driver floppy? say no
Manually select a CD-ROM module and device? say yes
Select “none”
enter /dev/sda
continue without kernel modules.
Ignore “Could not get identity of device” errors, you will get a few, otherwise continue with the setup normally.

Make sure you have a valid internet connection configured because this will be needed later on in the process

Continue the setup until you get the installation complete dialog that says this:

┌│                         Installation complete                         │
││ Installation is complete, so it is time to boot into your new system. │
││ Make sure to remove the installation media (CD-ROM, floppies), so     │
││ that you boot into the new system rather than restarting the          │
││ installation.                                                         │
││                                                                       │
└│     <Go Back>                                          <Continue>     │


DO NOT
select continue. Select go back.

and from the next dialog select “execute a shell” and select continue.

Then issue the following commands to “xenify” the setup.

chroot /target /bin/bash
aptitude install -y linux-image-xen ##this is where you need your internet connection
sed -ibak ’s/generic/xen/g’ /boot/grub/menu.lst
sed -ibak ’s/splash/console=xvc0/g’ /boot/grub/menu.lst
mv /etc/event.d/tty1 /etc/event.d/xvc0
rm /etc/event.d/tty*
sed -i ’s/tty1/xvc0/g’ /etc/event.d/xvc0
sync
exit
poweroff

Probably best to do these 1 by 1, its important every single command finishes.

Now we need to edit the configuration file to this:

memory = 256
name = “ubuntutemp”
disk = ['phy:/dev/filevg/ubuntutemp,hda,w','file:/mnt/filelv/Downloads/ISOs/ubuntu-8.04.1-server-amd64.iso,sda:cdrom,r']
#kernel = ‘/xen/ubuntutemp/kernel-xen’
#ramdisk = ‘/xen/ubuntutemp/initrd-xen’
bootloader=”/usr/bin/pygrub”
vif  = [ '' ]

Obviously changing paths as needed.

And then fire up the machine again

xm create -c ubuntu.cfg

After a short while you should be presented with a lovely login dialog:

Ubuntu 8.04.1 ubuntu xvc0

ubuntu login:

And thats it, you have a fully functioning ubuntu DomU using the starndard ubuntu server setup procedure. FYI LVM setups have been tested and worked too, Encrypted LVM hasnt been tested.

Installing an ubuntu DomU using the native installer

September 10th, 2008

So I wanted to install an ubuntu DomU in my Centos5 Dom0 which proved to be quite the task due to the lack of debootstrap. So an idea was to get the ubuntu install initrd and modify it so it would work with Xen so the installer would work like it would in a normal system. I succeded to an extent, with a few minor operations at the end of the install its reletively simple to install ubuntu using this system.

I’ll post my intructions and kernel/initrd later.

FreeBSD 7(DomU) on XEN 3.

June 16th, 2008

I have compiled a FreeBSD-current XEN kernel(386/PAE) from the sources on cvsup10, I have also built an image which is a pristine image of FreeBSD which has been customised for the XEN kernel, uncompressed the filesystem layout is as follows:

pristine# df -m
Filesystem 1M-blocks Used Avail Capacity Mounted on
/dev/xbd833s1a 421 36 350 9% /
devfs 0 0 0 100% /dev
/dev/xbd833s1e 383 0 352 0% /tmp
/dev/xbd833s1f 6059 1917 3657 34% /usr
/dev/xbd833s1d 726 7 660 1% /var
procfs 0 0 0 100% /proc

The root password is “password”

This is not a stable kernel in the slightest, there is a known bug which segfaults the kernel, do not use for anything but experimentation.

This is an example XEN configuration:

name = ‘freebsd’
memory = ‘256′
vif = [ 'bridge=br0' ]
disk = [ 'file:/path/to/freebsd7.pristine,hdb1,w' ]
on_shutdown = ‘destroy’
on_reboot = ‘restart’
on_crash = ‘destroy’
kernel = ‘/path/to/kernel’
extra = “,vfs.root.mountfrom=ufs:/dev/xbd833s1a”
extra += “,kern.hz=250″

Kernel: here
Filesystem: here

OpenSolaris in XEN

February 9th, 2008

So I took on to put (open)Solaris in a Suse Linux 10.3 Dom0 with xen 3.1 64bit. I made a LOT of silly mistakes along the way, the first and most time wasting mistake was trying to work off the first CD instead of the DVD. The reason this was such a waste of time is because the CD doesn’t come with the 64 bit miniroot(boot_archive) so the kernel cant be loaded properly(look out for panic[cpu0]/thread=d30cfe00: HYPERVISOR_mmu_update() failed) , this wouldnt have been a problem if I was using 32 bit but unfortunately I wasn’t.

The general procedure after you download the DVD is as follows. As I’m using suse they like to bastardise things so it doesn’t come with pygrub, which is needed for a simpler install, so i had to fetch the kernel and the boot archive myself by mounting the ISO loop back and fetching the following files:

mount -o loop /home/dmarkey/sol.iso /mnt
mkdir /xen/solaris

cp /mnt/boot/amd64/x86.miniroot /xen/solaris

cp /mnt//platform/i86xpv/kernel/amd64/unix /xen/solaris

OK so now me have our kernel and our boot archive, now to generate our XEN configuration file.

name = ’solaris’
memory = ‘1024′
disk = [ 'file:/home/dmarkey/sol.iso,6:cdrom,r','file:/home/dmarkey/solaris.disk,0,w' ]
vif = [ 'mac=00:16:3e:00:20:11' ]
on_shutdown = ‘destroy’
on_reboot = ‘restart’
on_crash = ‘destroy’
#root=’/dev/dsk/c0d0s0′
kernel = ‘/xen/solaris/unix’
ramdisk = ‘/xen/solaris/x86.miniroot’
extra = ‘/platform/i86xpv/kernel/amd64/unix -B install_media=cdrom’

Because the boot archive is so bloated, you need a LOT of ram to get it booted, thats why I’m allocating 1024 meg of RAM. So now we have to generate the hard disk file, use something like DD to create a >8G file in /home/dmarkey/solaris.disk or wherever you want to put it, remember to change all the file paths in you configuration. I named this configuration file /xen/solaris/solaris.

So now we should be able to boot, so we do:

xm create -c /xen/solaris/solaris

And fingers crossed we should be able to perform a Solaris setup. When the setup is finished we need to edit the config file. First uncomment the #root=’/dev/dsk/c0d0s0′ line, and then we change the extra line to simply extra = ‘/platform/i86xpv/kernel/amd64/unix’ and you can reduce the amount of ram to 512 if you want.

The performance of Solaris under XEN is i would say near to native. The only problem is that solaris need 512mb of ram to even attempt to boot. This is because of the huge boot_archive (x86.miniroot). In another entry I will go through the steps to make a smaller boot_archive and now my Solaris under Xen will successfully boot with 96M of ram!

LVM progress update cont.

January 18th, 2008

OK so we’re successfully booted off the new LVM based root filesystem.

Now i want to move everything back onto the dm softraid array. So we delete the old home and root partitions and make them into a new big partition with an LVM label,(I justed yast to do this coz i couldn’t have been arsed looking up the commands.

Now we convert this new big partition into a LVM physical volume:

pvcreate isw_cggibjcgah_Raid_part5

And then add it to the system volume group.

vgextend system isw_cggibjcgah_Raid_part5.

Now we can actually start moving stuff over (on the fly) to the array.

/dev/sda1 is the physical volume we want to release, its currently where root and home is. But this command will move the partitions to any other free physical volumes, which there is only one, the array,  system isw_cggibjcgah_Raid_part5.

pvmove /dev/sda1

But i got an error saying the mirroring module isnt loaded, so we load that:

modprobe dm-mirror

And after this the command will run successfully, It takes a while, depending on the size of your disks.

Now we have a free sda1 physical volume that we can remove out of the volume group.

vgreduce system /dev/sda1

And then make it a non physical volume using

pvremove /dev/sda1.

And that should be it. A successful conversion from standard linux block device to Logical volumes without loosing any data!

Two things to note that may render your system unbootable are these:

  1. Don’t touch your/boot partition/device, grub needs this and cannot read from a logical volume!
  2. Leave your swap space as an ordinary partition too, although the system will attempt to boot even though it cant access any swap space.

LVM progress update

January 16th, 2008

So the resize of /home worked but i couldn’t manage to resize the block device size. So fortunately i had a spare 200gb hard disk, so i made a new volume group and added the new hard disc as a physical volume, i then made two logical volumes on that, one for root and one for home and format them both with reiserfs, the root logical volume i mount on /mnt/tmp and copy the root filesystem with cp -vaRx / /mnt/tmp which seems to work properly, and then the same for root.

My next problem is I cant boot off the lvm because the required kernel modules arent in initrd. so I have to run mkinitrd /dev/system/rootlv from the path of the root file system device it works out what modules are required to allow the kernel to mount the root filesystem. Then /boot/grub/menu.lst has to be updated and /etc/fstab to mount the logical volumes instead of the old physical ones.

Cross your fingers and do an init 6, and hopefully you will have a bootable system off the logical volume.

If your in luck you can now start working on moving the volume group back onto the original hard disks, or in my case the dmraid. I’ll update with that later.

Converting to LVM from standard block devices

January 16th, 2008

Ok, This is going to be a challenge, but I think im up to it. I’m going to convert from using standard linux partitions /dev/sda1 /dev/sda2 etc to an LVM setup, without the need to reinstall. The trouble is I have no free space to put a some physical volume space, so step one is to shrink my 200G /home filesystem to 100G making space for me to copy my root filesystem. So now I have to login as root to be able to unmount /home, and make sure nothing is accessing it. I’m also using dmraid which could complicate the issue.

Because I always use reiserfs I can shrink a partition, it takes time but it does work(crosses fingers).

resize_reiserfs -s -100G /dev/mapper/isw_cggibjcgah_Raid_part6
resize_reiserfs 3.6.19 (2003 www.namesys.com)

You are running BETA version of reiserfs shrinker.
This version is only for testing or VERY CAREFUL use.
Backup of you data is recommended.

Do you want to continue? [y/N]:y
Processing the tree: 0%….20%…. left 14597898, 8996 /sec

This is gonna take a while, will update on my progress tomorrow.

BBC iPlayer woes.

January 14th, 2008

Well I have to hand it to BBC’s IT team, I’ve spent all evening trying to get iPlayer to work where I am in Dublin and I couldn’t manage it. I tried numerous methods like:

  • Numerous proxies on proxy lists around the web
  • VPNing into my work network(I’m amazed this didn’t work)
  • Just going to the website directly(ye this was a dead horse)

One last thing I could do would be to boot my Laptop into windows because the Linux VPN client isn’t the best, but of course that would mean booting into windows.


Copyright © 2010 All Rights Reserved.
No computers were harmed in the 0.197 seconds it took to produce this page.

dmarkey.com