Hi guys,
I''ve written a little howto on my experiences getting ubuntu hardy to
work under an indiana dom0 - its available and probably best viewed here -
http://www.noogies.org/node/7
I hope somebody finds it useful - here it is verbatim (apologies for any
formatting screw ups)
Here''s a little howto get Ubuntu Hardy working as a domU under
Opensolaris :)
This should be fairly applicable to other variants of opensolaris. We assume
that you have a functioning xend for this article. See my other howto on how to
achieve this.
If you already have a physical hardy machine, you can save some time. You can
skip step 1 and 2.
Basically what we will do, is setup a fully virtualized (HVM) Hardy
installation, create a disk image, debootstrap a base Ubuntu installation in to
this disk image and setup this disk image to be used under Xen.
Lets get started....
* Use virt-install to create fully virtualized (HVM) Ubuntu hardy install. You
can also use the server or alternative installation media and text mode if you
wish, the rest of the information in this howto is not specific to any of them.
# virt-install --name=ubuntuhvm --ram=512 --vnc --vncport=5900 --os-type=linux
--file=/vm/ubuntuhvm.img --file-size=20 --cdrom=ubuntu-8.04-desktop-amd64.iso
* Use vncviewer to connect to your newly created VM and install Ubuntu as per
normal. Once it is installed, login to the VM and open up a terminal.
* Create a sparse file to use as the disk image for the paravirtualized install
of Ubuntu (you can use mkfile -n on solaris, but no such luxury exists in
linux). Here we create a 20GB sparse file (which only actually uses up space as
we add data to it). We''ll also make a 2GB swap file that we can use
later.
# dd if=/dev/zero of=/var/tmp/ubuntupvm.img bs=1 count=0 seek=20G
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.00013132 s, 0.0 kB/s
# dd if=/dev/zero of=/var/tmp/ubuntupvm-swap.img bs=1 count=0 seek=2G
0+0 records in
0+0 records out
0 bytes (0 B) copied, 2.5766e-05 s, 0.0 kB/s
* Create an ext3 file system on the sparse file.
# mkfs.ext3 /var/tmp/ubuntupvm.img
mke2fs 1.40.8 (13-Mar-2008)
/var/tmp/ubuntupvm.img is not a block special device.
Proceed anyway? (y,n) y
Filesystem labelOS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1310720 inodes, 5242880 blocks
262144 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
160 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
* Create swap space by running mkswap on our swap image
# mkswap /var/tmp/ubuntupvm-swap.img
Setting up swapspace version 1, size = 2147479 kB
no label, UUID=901cdce0-9c17-4183-93d5-192d460c8555
* Lets now loopback mount our file system.
# mount -o loop /var/tmp/ubuntupvm.img /mnt
* All looking good?
# df -h /mnt
Filesystem Size Used Avail Use% Mounted on
/var/tmp/ubuntupvm.img 20G 173M 19G 1% /mnt
* Now we need to install debootstrap, which is a utility to install a base
debian/ubuntu system.
# apt-get install debootstrap
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
debootstrap
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 50.3kB of archives.
After this operation, 266kB of additional disk space will be used.
Get:1 http://ftp.iinet.net.au hardy/main debootstrap 1.0.8 [50.3kB]
Fetched 50.3kB in 0s (87.9kB/s)
Selecting previously deselected package debootstrap.
(Reading database ... 114480 files and directories currently installed.)
Unpacking debootstrap (from .../debootstrap_1.0.8_all.deb) ...
Setting up debootstrap (1.0.8) ...
* Lets use debootstrap to setup our base system. Be sure to use a mirror
geographically close to you so its faster.
# debootstrap --arch=amd64 --components=main,updates,universe,multiverse hardy
/mnt http://ftp.iinet.net.au/pub/ubuntu
I: Retrieving Release
I: Retrieving Packages
I: Validating Packages
I: Retrieving Packages
I: Validating Packages
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Checking component main on http://ftp.iinet.net.au/pub/ubuntu...
I: Retrieving adduser
I: Validating adduser
...
I: Configuring ubuntu-minimal...
I: Configuring libc6...
I: Configuring initramfs-tools...
I: Base system installed successfully.
* Lets change root in to our shiny new environment
# chroot /mnt
# export LANG=C
* Edit the sources.list file to include hardy-updates. Unfortunately there is a
bug in the default linux kernel shipped with hardy that will cause segfaults
when bringing up a network interface - so we need to use the updated kernel from
hardy-updates (see this bug -
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/218126). Remember to use a
mirror geographically close to you.
# echo deb http://ftp.iinet.net.au/pub/ubuntu hardy-updates main universe
multiverse >>/etc/apt/sources.list
# apt-get update
Hit http://ftp.iinet.net.au hardy Release.gpg
Get:1 http://ftp.iinet.net.au hardy-updates Release.gpg [191B]
Hit http://ftp.iinet.net.au hardy Release
Get:2 http://ftp.iinet.net.au hardy-updates Release [58.5kB]
Hit http://ftp.iinet.net.au hardy/main Packages
Hit http://ftp.iinet.net.au hardy/universe Packages
Hit http://ftp.iinet.net.au hardy/multiverse Packages
Get:3 http://ftp.iinet.net.au hardy-updates/main Packages [81.3kB]
Get:4 http://ftp.iinet.net.au hardy-updates/universe Packages [33.4kB]
Get:5 http://ftp.iinet.net.au hardy-updates/multiverse Packages [7682B]
Fetched 181kB in 1s (113kB/s)
Reading package lists... Done
* Install our Xen enabled kernel, kernel modules, and the grub boot loader.
Kernel image and modules are both pulled in as part of the linux-image-xen
metapackage, so we only need to install it.
# apt-get install grub linux-image-xen
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
linux-image-2.6.24-17-xen linux-ubuntu-modules-2.6.24-17-xen ucf
Suggested packages:
grub-doc mdadm fdutils linux-doc-2.6.24 linux-source-2.6.24
The following NEW packages will be installed:
grub linux-image-2.6.24-17-xen linux-image-xen
linux-ubuntu-modules-2.6.24-17-xen ucf
0 upgraded, 5 newly installed, 0 to remove and 13 not upgraded.
Need to get 22.8MB of archives.
After this operation, 93.1MB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://ftp.iinet.net.au hardy-updates/universe linux-image-2.6.24-17-xen
2.6.24-17.31 [18.9MB]
Get:2 http://ftp.iinet.net.au hardy-updates/universe
linux-ubuntu-modules-2.6.24-17-xen 2.6.24-17.25 [2929kB]
Get:3 http://ftp.iinet.net.au hardy/main ucf 3.005 [61.6kB]
Get:4 http://ftp.iinet.net.au hardy/main grub 0.97-29ubuntu21 [870kB]
Get:5 http://ftp.iinet.net.au hardy-updates/universe linux-image-xen
2.6.24.17.19 [26.4kB]
Fetched 22.8MB in 54s (422kB/s)
Preconfiguring packages ...
Can not write log, openpty() failed (/dev/pts not mounted?)
Selecting previously deselected package linux-image-2.6.24-17-xen.
(Reading database ... 8559 files and directories currently installed.)
Unpacking linux-image-2.6.24-17-xen (from
.../linux-image-2.6.24-17-xen_2.6.24-17.31_amd64.deb) ...
Done.
Selecting previously deselected package linux-ubuntu-modules-2.6.24-17-xen.
Unpacking linux-ubuntu-modules-2.6.24-17-xen (from
.../linux-ubuntu-modules-2.6.24-17-xen_2.6.24-17.25_amd64.deb) ...
Selecting previously deselected package ucf.
Unpacking ucf (from .../apt/archives/ucf_3.005_all.deb) ...
Moving old data out of the way
Selecting previously deselected package grub.
Unpacking grub (from .../grub_0.97-29ubuntu21_amd64.deb) ...
Selecting previously deselected package linux-image-xen.
Unpacking linux-image-xen (from .../linux-image-xen_2.6.24.17.19_amd64.deb) ...
Can not write log, openpty() failed (/dev/pts not mounted?)
Setting up linux-image-2.6.24-17-xen (2.6.24-17.31) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.24-17-xen
Setting up linux-ubuntu-modules-2.6.24-17-xen (2.6.24-17.25) ...
update-initramfs: Generating /boot/initrd.img-2.6.24-17-xen
Setting up ucf (3.005) ...
Setting up grub (0.97-29ubuntu21) ...
Setting up linux-image-xen (2.6.24.17.19) ...
* Almost there! Now we setup our /etc/fstab file
# cat <<EOF >/etc/fstab> /dev/xvda1 / ext3 defaults 0 1
> /dev/xvdb1 none swap defaults 0 0
> proc /proc proc defaults 0 0
> EOF
# cat /etc/fstab
/dev/xvda1 / ext3 defaults 0 1
/dev/xvdb1 none swap defaults 0 0
proc /proc proc defaults 0 0
* Setup the grub boot loader. It doesnt like xen kernels for some reason, and
wont automagically create them. Normally making the /boot/grub directory and
running update-grub is enough, but not in this case...
# mkdir -p /boot/grub
# update-grub
# mv /boot/grub/menu.lst /boot/grub/menu.lst.bak
# cat <<EOF >/boot/grub/menu.lst
default 0
timeout 3
title Ubuntu 8.04, kernel 2.6.24-17-xen
root (hd0,0)
kernel /boot/vmlinuz-2.6.24-17-xen root=/dev/xvda1 ro console=xvc0
initrd /boot/initrd.img-2.6.24-17-xen
EOF
# cat /boot/grub/menu.lst
default 0
timeout 3
title Ubuntu 8.04, kernel 2.6.24-17-xen
root (hd0,0)
kernel /boot/vmlinuz-2.6.24-17-xen root=/dev/xvda1 ro console=xvc0
initrd /boot/initrd.img-2.6.24-17-xen
* Turn off the hwclock. We''ll get our time from our host OS.
# update-rc.d -f hwclockfirst remove
# update-rc.d -f hwclock remove
# rm /etc/udev/rules.d/85-hwclock.rules
* Create an xvc0 tty for our xen console to talk to. We will just copy tty1 and
replace any occurance of tty1 with xvc0 using sed.
# cat /etc/event.d/tty1 | sed -e "s/tty1/xvc0/g" >/etc/event.d/xvc0
* Setup our networking configuration
# cat <<EOF >/etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
EOF
# cat /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
* Also setup our hosts file
echo "127.0.0.1 localhost" >/etc/hosts
* And one last file to create, our hostname
echo "ubuntupvm" >/etc/hostname
* Congratulations - your disk image is built! Only a few more easy steps.
* Exit the chroot environment
# exit
exit
* Unmount our disk image
# umount /mnt
* Copy our two disk image files (remember creating swap waaay back in this
howto?) back to our Xen dom0.
scp /var/tmp/ubuntupvm.img /var/tmp/ubuntupvm-swap.img user@hostname:/var/tmp/
* You can now exit out of your fully virtualized (HVM) Ubuntu. Back on the Xen
dom0, move the .img files to where you would like to store them permanently.
I''ll assume you want them in /vm/ here
# mv /var/tmp/ubuntupvm.img /var/tmp/ubuntupvm-swap.img /vm
* Create a suitable xen configuration file. Use a MAC address inside the range
00:16:3e:xx:xx:xx. This address range is reserved for use by Xen.
# cat <<EOF >/vm/ubuntupvm.cfg
memory = 512
name = "ubuntupvm"
vif = [ ''mac=00:16:3e:00:00:00'' ]
disk = [
''file:/vm/ubuntupvm.img,xvda1,w'',''file:/vm/ubuntupvm-swap.img,xvdb1,w''
]
* Now to see if it all worked... Lets boot her up and connect to the console. If
you see output like this, then its all worked! The formatting is a little messed
up from my terminal.
# xm create -f /vm/ubuntupvm.cfg -c
Using config file "/vm/ubuntupvm.cfg".
Started domain ubuntupvm
[ 0.000000] Linux version 2.6.24-17-xen (buildd@crested)
(gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)) #1 SMP Thu May 1 15:55:31 UTC 2008
(Ubuntu 2.6.24-4.6-generic)
[ 0.000000] Command line: root=/dev/xvda1 ro console=xvc0
[ 0.000000] BIOS-provided physical RAM map:
[ 0.000000] Xen: 0000000000000000 - 0000000010800000 (usable)
[ 0.000000] end_pfn_map = 67584
[154739.117160] Zone PFN ranges:
[154739.117161] DMA 0 -> 4096
[154739.117163] DMA32 4096 -> 1048576
[154739.117164] Normal 1048576 -> 1048576
[154739.117165] Movable zone start PFN for each node
[154739.117166] early_node_map[1] active PFN ranges
[154739.117167] 0: 0 -> 67584
[154739.120639] No mptable found.
[154739.121063] PERCPU: Allocating 22368 bytes of per cpu data
[154739.121078] Built 1 zonelists in Zone order, mobility grouping on. Total
pages: 66660
[154739.121081] Kernel command line: root=/dev/xvda1 ro console=xvc0
[154739.121496] Initializing CPU#0
[154739.121683] PID hash table entries: 2048 (order: 11, 16384 bytes)
[154739.121716] Xen reported: 2400.000 MHz processor.
[ 0.031224] console [xvc0] enabled
[ 0.031262] Console: colour dummy device 80x25
[ 0.031537] Dentry cache hash table entries: 65536 (order: 7, 524288 bytes)
[ 0.031719] Inode-cache hash table entries: 32768 (order: 6, 262144 bytes)
[ 0.031762] Software IO TLB disabled
[ 0.033091] Memory: 231592k/270336k available (2531k kernel code, 30248k
reserved, 1329k data, 220k init)
[ 0.099246] Calibrating delay using timer specific routine.. 4806.03 BogoMIPS
(lpj=9612067)
[ 0.099283] Security Framework initialized
[ 0.099290] SELinux: Disabled at boot.
[ 0.099296] AppArmor: AppArmor initialized
[ 0.099300] Failure registering capabilities with primary security module.
[ 0.099318] Mount-cache hash table entries: 256
[ 0.099439] CPU: L1 I cache: 32K, L1 D cache: 32K
[ 0.099443] CPU: L2 cache: 4096K
[ 0.099451] CPU: Physical Processor ID: 0
[ 0.099453] CPU: Processor Core ID: 2
[ 0.099459] SMP alternatives: switching to UP code
[ 0.100125] Freeing SMP alternatives: 23k freed
[ 0.100230] Early unpacking initramfs... done
[ 0.113696] Brought up 1 CPUs
[ 0.114092] net_namespace: 120 bytes
[ 0.114103] failed to set up cpufreq notifier
[ 0.131280] Time: 165:165:165 Date: 165/165/65
[ 0.131310] NET: Registered protocol family 16
[ 0.132782] Brought up 1 CPUs
[ 0.132800] PCI: Fatal: No config space access function found
[ 0.132802] PCI: setting up Xen PCI frontend stub
[ 0.133248] ACPI: Interpreter disabled.
[ 0.133258] Linux Plug and Play Support v0.97 (c) Adam Belay
[ 0.133280] pnp: PnP ACPI: disabled
[ 0.133593] xen_mem: Initialising balloon driver.
[ 0.134595] Setting mem allocation to 262144 kiB
[ 0.134805] PCI: System does not support PCI
[ 0.134809] PCI: System does not support PCI
[ 0.143788] NET: Registered protocol family 8
[ 0.143793] NET: Registered protocol family 20
[ 0.143859] AppArmor: AppArmor Filesystem Enabled
[ 0.144191] NET: Registered protocol family 2
[ 0.147737] Time: xen clocksource has been installed.
[ 0.179791] IP route cache hash table entries: 4096 (order: 3, 32768 bytes)
[ 0.179963] TCP established hash table entries: 16384 (order: 6, 262144
bytes)
[ 0.180032] TCP bind hash table entries: 16384 (order: 6, 262144 bytes)
[ 0.180112] TCP: Hash tables configured (established 16384 bind 16384)
[ 0.180115] TCP reno registered
[ 0.191832] checking if image is initramfs... it is
[ 0.206040] Freeing initrd memory: 19604k freed
[ 0.212804] audit: initializing netlink socket (disabled)
[ 0.212830] audit(1212512572.302:1): initialized
[ 0.212983] VFS: Disk quotas dquot_6.5.1
[ 0.213010] Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[ 0.213092] io scheduler noop registered
[ 0.213097] io scheduler anticipatory registered
[ 0.213103] io scheduler deadline registered
[ 0.213109] io scheduler cfq registered (default)
[ 0.213292] Xen virtual console successfully installed as xvc0
[ 0.213343] Event-channel device installed.
[ 0.220636] Successfully initialized TPM backend driver.
[ 0.233480] netfront: Initialising virtual ethernet driver.
[ 0.237326] xen-vbd: registered block device major 202
[ 0.237344] blkfront: xvda1: barriers enabled
[ 0.256807] rtc: IRQ 8 is not free.
[ 0.256868] Linux agpgart interface v0.102
[ 0.257280] RAMDISK driver initialized: 16 RAM disks of 65536K size 1024
blocksize
[ 0.257330] input: Macintosh mouse button emulation as
/devices/virtual/input/input0
[ 0.257414] PNP: No PS/2 controller found. Probing ports directly.
[ 0.258240] i8042.c: No controller found.
[ 0.258821] blkfront: xvdb1: barriers enabled
[ 0.259397] mice: PS/2 mouse device common for all mice
[ 0.259442] cpuidle: using governor ladder
[ 0.259500] NET: Registered protocol family 1
[ 0.259551] registered taskstats version 1
[ 0.259559] XENBUS: Device with no driver: device/console/0
[ 0.259569] Magic number: 1:252:3141
[ 0.259661]
/build/buildd/linux-2.6.24/debian/build/custom-source-xen/drivers/rtc/hctosys.c:
unable to open rtc device (rtc0)
[ 0.259671] Freeing unused kernel memory: 220k freed
Loading, please wait...
Begin: Loading essential drivers... ...
[ 0.491281] thermal: Unknown symbol acpi_processor_set_thermal_limit
Done.
Begin: Running /scripts/init-premount ...
Done.
Begin: Mounting root file system... ...
Begin: Running /scripts/local-top ...
Done.
Begin: Waiting for root file system... ...
Done.
Begin: Running /scripts/local-premount ...
Done.
[ 0.803687] kjournald starting. Commit interval 5 seconds
[ 0.803702] EXT3-fs: mounted filesystem with ordered data mode.
Begin: Running /scripts/local-bottom ...
Done.
Done.
Begin: Running /scripts/init-bottom ...
Done.
[ OK ]ting preliminary keymap... * Setting the system clock
Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.
* Unable to set System Clock to: Tue Jun 3 17:02:53 UTC 2008
[ OK ]rting basic networking... [ OK ]rting kernel event manager...
[ OK ]ding hardware drivers... * Setting the system clock
Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.
* Unable to set System Clock to: Tue Jun 3 17:02:54 UTC 2008
[ OK ]ding kernel modules... * Loading manual drivers... [ OK
]ting kernel variables... [ OK ]ivating swap... * Checking root file
system... fsck 1.40.8 (13-Mar-2008)
/dev/xvda1: clean, 12663/1310720 files, 181193/5242880 blocks
[ OK ]
* Checking file systems... fsck 1.40.8 (13-Mar-2008)
[ OK ]
[ OK ]nting local filesystems... [ OK ]ivating swapfile swap... [ OK
]cking minimum space in /tmp... [ OK ]figuring network interfaces...
[ OK ]rting system log daemon... [ OK ]rting kernel log daemon... [
OK ]ning local boot scripts (/etc/rc.local)
Ubuntu 8.04 ubuntupvm xvc0
ubuntupvm login:
This message posted from opensolaris.org