1

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]

respawn
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?

1 Answers1

3

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

Type=simple
and
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

kiri
  • 28,246
  • 16
  • 81
  • 118
JdeBP
  • 3,959
  • JDEBP is correct here that mbpfan demonization is not suitable for systems such as systemd. Development began under Slackware, so I decided to make mbpfan not tied up to any particular distribution/service manager. On the other hand, it is easy to make it work under all possible managers using small adjustements (e.g., the -f flag). Pull requests on the service files are very welcome. Also PR in general are very welcome :-) –  May 06 '15 at 09:49