Ubuntu – Upgraded to 15.04 init conf file doesn’t work


I've recently upgraded to 15.04. On 14.10 I had a conf file which would start a program on upstart. On 15.04 that doesn't work and the program won't start.

This is the .conf file:

# mbpfan - A simple daemon to control fan speed on all Macbook/Macbook Pros \
#   (probably all Apple computers) for Linux 3.x.x

description     "mbpfan"

start on filesystem or runlevel [2345]
stop on runlevel [!2345]

umask 022

console log

exec /usr/sbin/mbpfan -f

I install everything like with the following commands:

sudo cp mbpfan.upstart /etc/init/mbpfan.conf
sudo start mbpfan

Which gives me the error:

 start: Unable to connect to Upstart: Failed to connect to socket
 /com/ubuntu/upstart: Connection refused

Why doesn't this work and what changes do I need to make for it to start mbpfan on boot?

Best Answer

The headline news this week is that Ubuntu version 15.04 doesn't use upstart. It uses systemd.

You can go back to upstart, which is a question all to itself; or you can write a systemd service unit for your service; or you can swipe an already-written one. There are plenty of already-written ones about.

This mbpfan.service unit by Ismail Khatib has been around since 2012, for example. However, I recommend that you edit it to say

ExecStart=/usr/sbin/mbpfan -f
mbpfan's "daemonization" is entirely superfluous (under both upstart and systemd); is not functionally correct in any case; and under systemd will also result in unnecessary duplicated log information, as systemd already records the log information that mbpfan sends to its standard output.

Further reading

Related Question