OpenVZ Ubuntu 9.10 Templates
Note: This blog post has been completely re-written, thanks to Stephane Graber (see coment #1).
Although Ubuntu has been working well in OpenVZ, recently the boot scripts are no longer working.
You may make a template as outlined here, but the guest will not start properly.
Fortunately they can be started by writing an init script.
Save the following script, in your Ubuntu 9.10 VE (NOT the host node) as /etc/init/openvz.conf
# OpenVZ – Fix init sequence to have OpenVZ working with upstart
description “Fix OpenVZ”
start on startup
task
pre-start script
mount -t proc proc /proc
mount -t devpts devpts /dev/pts
mount -t sysfs sys /sys
mount -t tmpfs varrun /var/run
mount -t tmpfs varlock /var/lock
mkdir -p /var/run/network
touch /var/run/utmp
chmod 664 /var/run/utmp
chown root.utmp /var/run/utmp
if [ "$(find /etc/network/ -name upstart -type f)" ]; then
chmod -x /etc/network/*/upstart || true
fi
end script
script
start networking
initctl emit filesystem –-no-wait
initctl emit local-filesystems –-no-wait
initctl emit virtual-filesystems –-no-wait
init 2
end script
Note: you need two “– -” with the “initctl emit filesystem –-no-wait” lines
This init script works perfectly with my ubuntu templates, if you have difficulty, see Stephane Graber’s comment.
Posted in Linux
I’ve developed that simple init script for upstart to fix that kind of issue, works great here:
# OpenVZ – Fix init sequence to have OpenVZ working with upstart
description “Fix OpenVZ”
start on startup
task
pre-start script
mount -t proc proc /proc
mount -t devpts devpts /dev/pts
mount -t sysfs sys /sys
mount -t tmpfs varrun /var/run
mount -t tmpfs varlock /var/lock
mkdir -p /var/run/network
cat /proc/mounts > /etc/mtab
touch /var/run/utmp
chmod 664 /var/run/utmp
chown root.utmp /var/run/utmp
if [ "$(find /etc/network/ -name upstart -type f)" ]; then
chmod -x /etc/network/*/upstart || true
fi
end script
script
start networking
initctl emit filesystem –no-wait
initctl emit local-filesystems –no-wait
initctl emit virtual-filesystems –no-wait
init 2
end script
Comment by Stephane Graber — October 27, 2009 @ 3:47 pm
[...] the rest here: Bodhi.Zazen: OpenVZ Ubuntu 9.10 Templates Share and [...]
Pingback by Bodhi.Zazen: OpenVZ Ubuntu 9.10 Templates | TuxWire : The Linux Blog — October 27, 2009 @ 5:40 pm
THANK YOU Stephane Graber !!!
If you look at my templates, I do some of this already, in particular:
ln -s /proc/mounts /etc/mtab
So …
I made an upstart script, /etc/init/openvz.conf
# OpenVZ – Fix init sequence to have OpenVZ working with upstart
description “Fix OpenVZ”
start on startup
task
pre-start script
mount -t proc proc /proc
mount -t devpts devpts /dev/pts
mount -t sysfs sys /sys
mount -t tmpfs varrun /var/run
mount -t tmpfs varlock /var/lock
mkdir -p /var/run/network
touch /var/run/utmp
chmod 664 /var/run/utmp
chown root.utmp /var/run/utmp
if [ "$(find /etc/network/ -name upstart -type f)" ]; then
chmod -x /etc/network/*/upstart || true
fi
end script
script
start networking
initctl emit filesystem – -no-wait
initctl emit local-filesystems – -no-wait
initctl emit virtual-filesystems – -no-wait
init 2
end script
Note: you need two – - with the “initctl emit filesystem – -no-wait” lines
Comment by bodhi.zazen — October 27, 2009 @ 5:44 pm
[...] a part of “IBM's Smart Work”Related posts on ubuntuUbuntu Enterprise Cloud « vizz.infoShadows of epiphany » Blog Archive » OpenVZ Ubuntu 9.10 TemplatesKarmic Koala: Ubuntu 9.10 « Technological Innovation and Social …Related PostsInternet for [...]
Pingback by Windows 7 is ‘Restrictive’ for Netbooks and Claims as Linux Rival — October 27, 2009 @ 8:36 pm
Bodhi,
Copying the script that you posted into /etc/init/openvz.conf doesn’t work on boot. The commands are right and work if exec on the host node. So am I missing some kind of step?
Comment by Levis Bakalinsky — November 6, 2009 @ 12:33 pm
Those commands are for the Guest (VPS) not the host node.
I use my own templates for Ubuntu, as outlined here :
http://blog.bodhizazen.net/linux/openvz-ubuntu-templates/
Stephane Graber posted his script, which I modified.
Without further information I would be guessing.
1. Make sure the script is on the GUEST VS in /etc/init/ (NOT /etc/init.d )
2. The script does not need to be executable, but it does need to end with a .conf (thus I called it openvz.conf )
3. When copy – paste from Wordpress, some of the special symbols get changed, so confirm the syntax especially watch two – - .
4. I you wish, I posted the script here :
http://bodhizazen.net/openvz.conf
you can, in the guest
cd /etc/init/
wget http://bodhizazen.net/openvz.conf
5. Run the script manually and see if you get errors :
service openvz start
Comment by bodhi.zazen — November 6, 2009 @ 3:16 pm
[...] templates have been generated according to this how to and include this init script (which is modified from the script provieded by Stephane [...]
Pingback by Bodhi.Zazen: Download Ubuntu 9.10 OpenVZ Templates | L&C Tech Talk — November 13, 2009 @ 5:05 pm
Thanks! That just saved my day… I tried Copy&Paste first, but did not work with the double –. The wget worked just fine…
Comment by Philon — December 16, 2009 @ 2:37 pm
I upgraded a container running Ubuntu 9.04 and afterwards, I was getting errors about tty devices and networking didn’t work. After several hours of trying to hunt down the sources of the problems, I came across your blog. You instructions on how to create a 9.10 template and this config file fixed all the problems my container had. Thanks you!!
Comment by Alexander — February 11, 2010 @ 6:55 pm