Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For some reason the Upstart script for the MySQL server isn't working when I boot my server, however it does work once the server has booted and I execute sudo start mysql manually.

I'm running an OpenVZ VPS with Ubuntu 10.04 installed and MySQL version 5.1.41 (latest stable from the repository). MySQL is a fresh install with no config changed.


# MySQL Service

description     "MySQL Server"
author          "Mario Limonciello <>"

start on (net-device-up
          and local-filesystems
      and runlevel [2345])
stop on runlevel [016]


env HOME=/etc/mysql
umask 007

pre-start script
    #Sanity checks
    [ -r $HOME/my.cnf ]
    [ -d /var/run/mysqld ] || install -m 755 -o mysql -g root -d /var/run/mysqld
    # Load AppArmor profile
    if aa-status --enabled 2>/dev/null; then
        apparmor_parser -r /etc/apparmor.d/usr.sbin.mysqld || true
    LC_ALL=C BLOCKSIZE= df --portability /var/lib/mysql/. | tail -n 1 | awk '{ exit ($4<4096) }'
end script

exec /usr/sbin/mysqld

post-start script
    for i in `seq 1 30` ; do
        /usr/bin/mysqladmin --defaults-file="${HOME}"/debian.cnf ping && {
            exec "${HOME}"/debian-start
            # should not reach this line
            exit 2
        sleep 1
    exit 1
end script
share|improve this question
What is the output of runlevel? What does /etc/init/mysql.conf contain at the top? It should read something like start on (net-device-up and local-filesystems and runlevel [2345]) – evgeny Nov 28 '10 at 8:09
I've added the contents of the /etc/init/mysql.conf file. Also using /etc/rc*.d isn't working any more, however manual starting is still working. Where can I get the runlevel output? – Rowno Nov 29 '10 at 10:22
Just run the runlevel command. The config looks similar to mine... – evgeny Nov 29 '10 at 11:34
The output of runlevel is N 2. – Rowno Nov 29 '10 at 20:16
up vote 7 down vote accepted

Turns out Upstart start up jobs can have problems on OpenVZ.


start on (net-device-up
          and local-filesystems
      and runlevel [2345])


start on runlevel [2345]

fixed the problem for me.

share|improve this answer
+1, can you maybe also add a link to other accounts of OpenVZ instances having problems w/ upstart? I'm guessing its because there's no filesystems mounting going on, so local-filesystems never gets triggered. – SpamapS Nov 30 '10 at 18:50
This didn't work for me on Ubuntu 11.10 with Mediatomb. Tried it. – djangofan Dec 20 '11 at 16:38
I ended up switching to Linode because they use Xen servers, due to the numerous problems I was having with OpenVZ like this one. – Rowno Dec 30 '11 at 1:56

You can configure the upstart scripts with a simple GUI tool named jobs-admin Install jobs-admin. You can install it by typing sudo apt-get install jobs-admin in a terminal.

Once installed you can manage all upstart scripts including MySQL using this tool.

alt text

Hope this helps.

share|improve this answer
+1 for the new tool! – theTuxRacer Nov 29 '10 at 17:22
I don't see how a GUI tool will help me on Ubuntu Server... – Rowno Nov 29 '10 at 20:14
This gui , version 0.8.0 didnt work for me on Ubuntu 11.10. I think it is too buggy still. – djangofan Dec 20 '11 at 16:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.