Installing Ubuntu 8.04 Hardy as guest

From Linix VServer
Jump to navigationJump to search

Installing Ubuntu 8.04 (Hardy) as a Vserver guest

As Ubuntu 8.04 (Hardy) is the latest LTS release of Ubuntu, it would be a good choice to install as a server. A lot of this information is from the OpenVZ guide at https://help.ubuntu.com/community/OpenVZ.

This guide requires that you have configured your /etc/vservers/.default correctly

Prerequisites[edit]

  • debootstrap
 [Vserver-host] $ sudo apt-get install debootstrap

Debootstraping in Ubuntu[edit]

 [Vserver-host] $ vserver hardy-guest build -m debootstrap \
 --context 42 --hostname hardy-guest --force \
 --interface eth0:10.0.0.123/8 \
 -- -d hardy -m http://us.archive.ubuntu.com/ubuntu/ \
 -- --arch=i386 --exclude=udev

You will receive the following warning 5 times (obviously):

 W: Failure while configuring base packages.  This will be attempted 5 times.

You can safely ignore them, as we will fix this later

Removing unneeded services[edit]

By default klogd and rmnologin runs at startup of the guest, it is not necessary, and will slow down the startup time of your guest, you better remove them

 [Vserver-host] $ cd /[path_of_vservers]/hardy-guest/etc/rc3.d
 [Vserver-host] $ rm S11klogd S99rmnologin

You should also remove unneeded shutdown scripts

 [Vserver-host] $ cd /[path_of_vservers]/hardy-guest/etc/rc6.d
 [Vserver-host] $ rm *

You should add a link for killing sysklogd

 [Vserver-host] $ ln -s ../init.d/sysklogd K11sysklogd

Starting guest and fixing group 11 issue[edit]

Now it is time to start your new vserver and enter it:

 [Vserver-host] $ vserver hardy-guest start

It will return the following:

 /etc/init.d/rc: 166: cannot open /dev/console: No such file
 * Starting system log daemon...
  ...done.
 * Running local boot scripts (/etc/rc.local)
  ...done.

Then you can enter your vserver

 [Vserver-host] $ vserver hardy-guest enter

It will return the following:

 id: cannot find name for group ID 11

Fixing the "/etc/init.d/rc: 166: cannot open /dev/console: No such file" issue[edit]

Open /etc/init.d/rc in your favorite editor

 root@hardy-guest:/# vim /etc/init.d/rc

Find the following lines and comment them out by perpending them with an "#" (this has been done in the example) They will be at line 163-166

 # Set onlcr to avoid staircase effect.
 #if [ "$QUIET" != yes ]; then
 #    stty onlcr </dev/console >/dev/console 2>&1
 #fi

Save and quit

Fixing the "id: cannot find name for group ID 11" issue[edit]

I don't know what the group really shoud be, but I just added the group "void" as group 11. Someone who knows what it should be, could probably correct it.

 root@hardy-guest:/# groupadd -g 11 void

Removing unneeded packages[edit]

There are some packages you obviously would not need in a vserver-guest:

  • DHCP3
  • busybox-initramfs
  • console-setup
  • dmidecode eject
  • ethtool
  • initramfs-tools
  • klibc-utils
  • laptop-detect
  • libiw29
  • libklibc
  • libvolume-id0
  • mii-diag
  • module-init-tools
  • ntpdate
  • pciutils
  • pcmciautils
  • ubuntu-minimal
  • udev usbutils
  • wireless-tools
  • wpasupplicant
  • xkb-data
  • tasksel
  • tasksel-data

So you should start up your new guest and enter it and remove them.

 [hardy-guest] $ apt-get remove --purge busybox-initramfs console-setup dmidecode eject \
 ethtool initramfs-tools klibc-utils laptop-detect libiw29 libklibc \
 libvolume-id0 mii-diag module-init-tools ntpdate pciutils pcmciautils ubuntu-minimal \
 udev usbutils wireless-tools wpasupplicant xkb-data tasksel tasksel-data \
 dhcp3-client dhcp3-server

Finished[edit]

Now you have installed hardy from debootstrap, and hopefully everything is working

Remember that you will have to create symlinks to services in /etc/rc6.d in order for them to be stopped when running 'vserver [vservername] stop'