Open main menu

OpenVZ Virtuozzo Containers Wiki β

Ubuntu without templates

This tutorial will teach how to install the newest Ubuntu versions through chroot (no templates required).

Contents

Initial stepsEdit

  • Choose a number for your machine (example: 101)
  • Choose an ubuntu version (this howto was tested with hardy, intrepid and jaunty)
  • Go to the directory where the images will be placed:
cd /vz/private/
  • Create a directory for the new machine:
mkdir 101
  • Run debootstrap:
debootstrap --arch=i386 jaunty 101/ http://br.archive.ubuntu.com/ubuntu

(you can change the mirror if you want)

  • Edit the machine configuration in /etc/vz/conf/101.conf. Configure its name, IP, memory and everything else
  • Start the machine
vzctl start 101

Fixing bugsEdit

udevEdit

If you try to enter the machine you'll see an error:

eva:/vz/private# vzctl enter 101
enter into VE 101 failed
Unable to open pty: No such file or directory

To solve this, you'll have to remove udev from the boot:

eva:/vz/private# vzctl exec 101 'update-rc.d -f udev remove'
Removing any system startup links for /etc/init.d/udev ...
/etc/rcS.d/S10udev

Then you'll be able to enter the machine after restarting it:

vzctl restart 101
vzctl enter 101

Note: when you update the udev package you'll probably have to run the "update-rc.d -f udev remove" command again.

klogdEdit

Type this command:

ps aux

You'll see that "init" didn't finish because the "klogd" process is still being run. You'll have to fix this:

update-rc.d -f klogd remove

Restart the machine and see the results:

exit
vzctl restart 101
vzctl enter 101
ps aux

networkEdit

For newer ubuntu versions, you'll notice that the network is not working. To fix this problem, you'll have to edit the /etc/init.d/networking script. You'll have to make it create the "/var/run/network" directory just after its "start":

 case "$1" in
   start)
     mkdir -p /var/run/network # -> this is the new line
     process_options

Then, start the networking:

 /etc/init.d/networking start

(important: use start, not restart)

gettyEdit

If you look at the running processes, you'll see that there are a lot of "/sbin/getty" processes. You can also remove these.

Other init stuffEdit

Feel free to use 'update-rc.d' to remove any other unneded stuff =)

FinishEdit

Now you're free to use your machine =)

You'll still probably want to add the "security" and "updates" repositories, install openssh-server, change the root password, update the system, change locales and other stuff. Enjoy =)