Today I bought a VPS from edis.at, OVZ Starter, and I installed Ubuntu 13.04 x64 on it.

On a fresh install, running apt-get install mysql-server, freezes apt-get.

After setting the MySQL root password, I get this error: Unable to set password for the MySQL "root" user..., and apt-get freezes. I can't even CTRL-C out of it.

I've reinstalled multiple times, but the same issue always happens. What can I do?

Full shell log: from fresh install to freeze

  • Did you try to re-install mysql after a system re-start? – Saurav Kumar Oct 19 '13 at 16:47
  • @SauravKumar: I tried, but unfortunately it didn't work. – Vittorio Romeo Oct 19 '13 at 19:21
  • I don't know which way you tried to remove mysql! Although I suggest you to remove it with the configuration file using these commands: sudo apt-get autoremove mysql-* && sudo apt-get --purge remove mysql-* then execute this once removed: sudo apt-get autoremove && sudo apt-get autoclean. If everything works fine then execute and post the output of this command, which will find if you have any residual packages: sudo dpkg -l | grep "^rc" Now try to install mysql again by: sudo apt-get -f install mysql-server mysql-client Reply.. – Saurav Kumar Oct 19 '13 at 19:34

This seems similar to the issue here: 'Unable to set password for the MySQL "root" user' on a Openvz VPS

...it turned out to be a lack of memory issue. Running this script on the host fixed it for me:

vzctl set ${cid} --vmguarpages 1024M --save
vzctl set ${cid} --oomguarpages 1024M --save
vzctl set ${cid} --privvmpages 1024M:1024M --save

Feel free to change 1024 to whatever amount of memory you want your container to have. You will also need to change 104 to the ID of your container.

As you are not the host, you will need to buy a bigger plan or upgrade your ram somehow.


Ok, I think I have something. It's not the most elegant solution, but it seems to work. I also have no idea what it does or why it works, I just found it here.

sudo apt-get install mysql-server

Let it display the error message. Assume that you can't Ctrl-C out of it, so just close your terminal and reconnect.

service mysql stop
nano /etc/mysql/my.cnf

add this one line under the [mysqld] section - before [mysqldump])

innodb_use_native_aio = 0

Then run:

service mysql start

Now it should work. I recommend installing mysql-server by itself so it won't affect other installs when it crashes. It probably doesn't matter though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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