unable to connect to system bus: failed to connect to socket /var/run/dbus/system_bus_socket

mt0s picture mt0s · Mar 12, 2013 · Viewed 35.4k times · Source

I started to use a new VPS system with ubuntu 12.04

After following the commands here I installed php, mysql, apache2

PHP and apache are working great but when I run :

service mysql start 

I get : unable to connect to system bus: failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory.

I googled but didn't find enough to help me.

There is no /var/run/dbus/ directory and I don't know what I need to create one or even if this is the problem for mysql.

Answer

JW. picture JW. · Oct 8, 2013

I had this error message and discovered that it was a sign that initctl (the 'init daemon control tool') was being called (indirectly) without the necessary privileges.

In other words:

It failed because:

  • I was not logged in as the root user,
  • nor was I prefixing my 'daemon control' command with sudo.

Either one would have solved the issue.

It's a bit confusing because you would have thought a 'privilage issue' would trigger an error message that talks about 'privilage thangs'. But, no. It talks about being "unable to connect to system bus".

So, may I suggest:

Try temporarily elevating your privileges by prefixing your command with sudo.

Assuming that the hash symbol (#) indicates your command prompt, run the following command instead:

# sudo service mysql start 

Then, type in your user password as prompted.

OR

If you have set a password for the root user on your installation of Ubuntu, you could elevate to that Super User by typing:

# su

Then, type in the root password as prompted.

Then, in this context, your original command should, now, work:

# service mysql start 

See it's man page DESCRIPTION for more information about initctl's connection to service start, stop, restart, reload and status commands.