Installing oracle 10gr2/ on debian/sarge as xen domU

First question here is: why would I want to install the Oracle database on debian? Well, there is very much to say about that, but, in essence: I very much like debian. And I could tell you, of course, about the brilliant packaging system, debian being true free software, debian being standards based, easy upgrading and security updates, the merry help from the community, but I don’t. I just happen to like debian.

Second question is: why in a xen user domain? Well, that’s very obvious for me:
-the userdomain I describe here is build in a logical volume. the logical volume can very easy and very fast being copied to a second one, and voila: I have a second, seperate machine.
-the userdomain can be snapshoted at any time, so we can have a ‘frozen’ image of a domain. comes in very handy when testing or when trailing errors.
-I can use a single piece of metal for running various versions of linux (yes, also the bsd’s and solaris, but I do not run that now), running various versions of oracle (each running different patchlevels and CPU’s (the infamous Cummulative Patch Update)). Very handy for investigating quality and stability.
-When software alters files or something, and needs to be recovered (in testing or investigation), it’s very convenient to use the snapshot possiblities of LVM.

This is how I create a debian/sarge domU in a logical volume. There are more versions of this description (in fact, that is how got to know the trick), but they have little omissions which do not give me what I want (like being unable to use swap because the block special device is missing in /dev)

nb. dom0 is called ‘server’, the domU to be created is called ‘sarge’.
nb. this version is simplified. I install the oracle software in a seperate logical volume, so I can use a single installation with different o/s installs.

1. create logical volume for the root:
frits@server:~# sudo lvcreate -n sarge-root -L 5G /dev/vg00
2. create logical volume for swap:
frits@server:~$ sudo lvcreate -n sarge-swap -L 1G /dev/vg00
3. create ext3 filesystem on the root logical volume:
frits@server:~$ sudo /sbin/mkfs.ext3 /dev/vg00/sarge-root
4. create swap:
frits@server:~$ sudo /sbin/mkswap /dev/vg00/sarge-swap
5. mount root logical volume:
frits@server:~$ sudo mount /dev/vg00/sarge-root /mnt/install
6. install sarge using debootstrap:
frits@server:~$ sudo debootstrap sarge /mnt/install
7. alter the feshly installed server:
frits@server:~$ cd /mnt/install/dev
frits@server:~$ sudo ./MAKEDEV tty1 tty2 tty3 tty4 tty5 tty6
frits@server:~$ sudo ./MAKEDEV sda
frits@server:~$ cd ../etc
frits@server:~$ sudo vi fstab

here we put the following rows, so we mount the minimal three things:

proc /proc proc defaults 0 0
/dev/sda1 / ext3 defaults,errors=remount-ro 0 1
/dev/sda2 none swap sw 0 0

frits@server:~$ cd network
frits@server:~$ sudo vi interfaces

here we put the following rows, so we activate localhost and our public ip address:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

next we configure the last few things before we boot our virtual host ‘sarge’:

frits@server:~$ cd ..
frits@server:~$ sudo echo "sarge" > hostname
frits@server:~$ sudo printf "\tlocalhost\n192.168.0.18\tsarge\n" > hosts

As we see on the last line, is the address I have gotten from my dhcp server.

8. The filesystem is now configured for booting as root-filesystem. Next we have to define a host for xen, which looks like this (name of the file needs to be the name of machine, in order to start it by name with xen):

kernel = "/boot/vmlinuz-"
memory = 512
name = "sarge"
vif = [ 'mac=aa:00:00:00:00:15, bridge=xenbr0' ]
disk = [ 'phy:vg00/sarge-root,sda1,w','phy:vg00/sarge-swap,sda2,w' ]
hostname= "sarge"
root = "/dev/sda1 ro"
extra = "4"

9. Next, we start our new host ‘sarge’:
frits@server:~$ sudo xm create sarge -c

The experienced xen user will notice I have forgotten to move the /lib/tls directory. Well, I have done that on purpose! Xen will complain about the “normal” tls version and warn us.

After the complaint, our machine will boot nicely and we get a prompt. We log in as root, and set a password. (root needs to have a password, especially because we get public access shortly!) After that, we finish the configuration using ‘base-config’.

10. Next we have to modify the ‘/etc/apt/sources.list’ file. Apparently, base-config puts the following line:
deb testing main
Which results in downloading packages of etch, instead of sarge. So we alter the line to:
deb stable main non-free
(we add ‘non-free’ to it too, because we need some packages out of non-free in a short while)
Refresh the apt cache and renew our new system:
sarge:~# apt-get update
sarge:~# apt-get upgrade

11. Next we alter the sources list once more, in order to get a xen-friendly libc. Add the following line to /etc/apt/sources.list:
deb sarge roman
After that, refresh the apt cache, and get the xen-friendly libc:
sarge:~# apt-get update
sarge:~# apt-get install libc6-i686

At this point, we got a working version of debian/sarge, with the bare minimum of packages. This is a good point to save a copy of the root logical volume, in order to be able to start with an installed and configured debian/sarge installation.

Because we want to install the oracle database server on our debian host ‘sarge’, we get on configuring it.

12. Because the ssh daemon is not a part of the bare minumum packages of debian, we have to install it:
sarge:~# apt-get install ssh
After this installation, review the ssh_config and sshd_config in /etc/ssh, in order to be able to use X-tunneling. This way we are able to get a ssh session to sarge, and can conveniently tunnel our X connection through it. No messing with xhost for me 🙂

13. We need to have a X environment, because of the graphical installation of the oracle software. So we install it:
sarge:~# apt-get install x-window-system

14. There are some reports of errors during the link phase of the installations due to incorrect version of libaio. The most simple (and elegant) way to get this, is from oracle itself. We add the oracle repository to /etc/apt/sources.list by inserting the following line:
deb unstable main non-free
Next we refresh our apt cache and install libaio:
apt-get install libaio

15. Because we got a minimized version of the install, we have installed less than a default debian/sarge installation. One of the missing things (which gives a nice little error message during linktime:)
Error in invoking target 'ntcontab.o' of makefile '/oracle/db/10201/network/lib/'
is libc6-dev. So we install it:
apt-get install libc6-dev

16. Next a whole bunch of other needed software:
apt-get install gcc make binutils libmotif3 lesstif2 rpm

At this point, we can do the oracle installation. There are no error messages or other faults during the install. I have used a nfs share exported from dom0 with the software.

17. Follow this link to go to Graham Williams description of installing oracle on debian.


  1. Ananyous A said:

    Hey, cool blog. And long live debian

  2. red said:

    I follow your instruction but I got several kernel error (es Bad pte = …., process = oracle, … ) after executing /etc/init.d/oracle-xe configure. I use 2.6.18-3-xen-686 kernel for my domU.

    Thank you

  3. Administrator said:

    could you mail me the exact error messages?

    Please mind that the 2.6.18 kernel is etch, not sarge.

  4. red said:

    Sorry I’m not very good with Linux; I saw that you used the kernel but in the etch repository I couldn’t find it . Howerer these are the errors I got :
    Bad pte = 0033e0a0, process=oracle,vm_flags=70,vaddr= b7539000
    [] vm_normal_page+0x98/0xb0
    [] unmap_vmas ….


  5. Per said:

    I get the same error as well (Ubuntu, running homebuilt kernel in both dom0 and domU). Excerpt from my syslog:

    Feb 14 21:05:12 devel kernel: Bad pte = 0040a0a0, process = oracle, vm_flags = 70, vaddr = b7848000
    Feb 14 21:05:12 devel kernel: [] show_trace+0x13/0x20
    Feb 14 21:05:12 devel kernel: [] dump_stack+0x1e/0x20
    Feb 14 21:05:12 devel kernel: [] print_bad_pte+0x75/0xc0
    Feb 14 21:05:12 devel kernel: [] vm_normal_page+0xcc/0xe0
    Feb 14 21:05:12 devel kernel: [] unmap_vmas+0x1e7/0x670
    Feb 14 21:05:12 devel kernel: [] unmap_region+0xac/0x150
    Feb 14 21:05:12 devel kernel: [] do_munmap+0x16d/0x210
    Feb 14 21:05:12 devel kernel: [] do_mmap_pgoff+0x2b3/0x6f6
    Feb 14 21:05:12 devel kernel: [] sys_mmap2+0x68/0xb8
    Feb 14 21:05:12 devel kernel: [] syscall_call+0x7/0xb

    The error occurs regularly, for example now as I’m going through the Oracle getting started guide. But the domU (and the db) keeps running.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: