Upgrade Ubuntu 9.10 OpenVZ Templates

This post is for those wanting to upgrade existing Ubuntu 9.10 openvz templates to Ubuntu 10.04 (Lucid Lynx) which is a LTS release (supported server side for 5 years).

Caution: Back up your data before you upgrade. This upgrade works on a minimal server and you may need to edit (upstart) init scripts (mysql in particular) and I make no guarantees this upgrade procedure will work for you (use at your own risk).

Assuming your template is 101 …

sudo vzctrl enter 101

Update 9.10

Start by updating 9.10:

apt-get update
apt-get dist-upgrade

Upgrade to 10.04

Upgrade – Instructions from This link

apt-get install -y update-manager-core

Edit /etc/update-manager/release-upgrades , make sure Prompt=normal

Prompt=normal

It was normal already on my VPS …

Upgrade to 10.04

do-release-upgrade

Follow the on screen directions, accept the new configuration files.

Continue installing without GURB – answer “yes”

At the end of the upgrade, do not restart (yet)

Post -upgrade

We need some post-upgrade configuration:

Start by removing unnecessary packages

apt-get purge eject kbd laptop-detect linux-generic linux-image-2.6.32-21-generic os-prober ubuntu-keyring update-manager-core
apt-get autoremove

Put mountall and upstart on hold

echo "mountall hold"|dpkg --set-selections
echo "upstart hold"|dpkg --set-selections

Remove / Fix the init scripts.

cd /etc/init
rm -f console* dmesg.conf failsafe* mount* network-interface* openvz.conf plymouth*

The only init scripts I have are:

hostname.conf
networking.conf
rc-sysinit.conf
rc-S.conf
rc.conf

Edit /etc/init/rc.conf and comment out the following lines:

#console output
#env INIT_VERBOSE

Make an openvz.conf (run (copy-paste) the “cat” command):

cat <<EOF > /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 devpts devpts /dev/pts
mount -t tmpfs varrun /var/run
mount -t tmpfs varlock /var/lock
mkdir -p /var/run/network
if [ ! -e /etc/mtab ]; then
cat /proc/mounts > /etc/mtab
fi
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
EOF

Fix ssh

sed -i -e 's_oom never_#oom never_g' /etc/init/ssh.conf

Fix mysql

Edit /etc/init/mysql.conf , change the start line to

start on start on runlevel [2345]

I advise you replace rsyslog with syslog-ng (rsyslog is default in Ubuntu, but IMO does not work well in Openvz VPS).

apt-get purge rsyslog
apt-get -y install syslog-ng

That’s it, exit and restart your VPS.

If all went well you should have a fully functional Ubuntu 10.04 VPS. If you broke it, you get to keep both pieces.

This entry was posted in Linux. Bookmark the permalink.

6 Responses to Upgrade Ubuntu 9.10 OpenVZ Templates

  1. Pingback: Webmaster Crap » Blog Archive » Shadows of epiphany » Blog Archive » Upgrade Ubuntu 9.10 OpenVZ …

  2. chris says:

    Hi,

    does not work for me. Got the same settings (openvz.conf) in 9.10 without any problems.
    After upgrading to 10.04 i got the “Unable to open pty: No such file or directory.” error when i try to enter the box.

    When I run vzctl exec vzid mount -t devpts devpts /dev/pts on HN after starting the machine so i can enter the vz.
    After that i run inside the container your openvz.conf without the init tags.

    Its not really comfortable, but it works.
    Any ideas why the etc/init/openvz.conf doesn’t work ?

    Greets chris

  3. bodhi.zazen says:

    @chris : Sorry you are having a problem. I have had my share of problems upgrading to Ubuntu 10.04 as well …

    From your description I suggest you check your openvz.conf for typos or errors.

  4. Philon says:

    I finally had time to play with the update. I had problems getting do-release-upgrade through. It kept dying with a problem in mountall:
    E: Internal Error, Could not perform immediate configuration (2) on mountall

    I consulted Google and found some problems in combination with my Centos host running an older (stable) kernel.

    What did work, was updating mountall manually:
    dpkg –force-all -i /var/cache/apt/archives/mountall_2.15_i386.deb

    then do-release-upgrade did run through without any problem.

    I copied over the whole init-directory from your LAMP-template. Copy&Paste did make some issues the last time.

    Once again, I appreciate your efforts and sharing this useful information with the community!

  5. Duckula says:

    Thanks, that’s really helpful.

    I think there’s a bug in the Mysql fix. The “start on” is duplicate.

  6. Flavien says:

    Thank you so much for the init script, you saved my day !

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>