3

I'm a beginning Ubuntu user following this tutorial to enable fan management with mbpfan on my Mac Mini 4.1 running Ubuntu 18.04.

I had good success initially and then got to the point of trying to turn mbpfan into a system service. The first glitch I hit was that no mbpfan.service file was present on my system after installation, so I just downloaded it from GitHub, uploaded it via SFTP to my download folder, and then copied it as instructed with sudo cp mbpfan.service /etc/systemd/system/.

But here's the result when I try to execute sudo systemctl enable mbpfan.service:

Synchronizing state of mbpfan.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable mbpfan
Failed to enable unit: File mbpfan.service: Invalid argument

I'm kind of stuck at this point and would appreciate a nudge. Thank you.

= = = = = = = = =

Edit 1:

~$ systemctl status mbpfancs.service

Produced:

mbpfancs.service - mbpfan Custom Service
Loaded: loaded (/etc/systemd/system/mbpfancs.service; disabled; vendor preset
Active: failed (Result: exit-code) since Sat 2019-09-28 10:57:08 UTC; 27s ago
Process: 8521 ExecStart=/usr/sbin/mbpfan -f (code=exited, status=1/FAILURE)
Main PID: 8521 (code=exited, status=1/FAILURE)

Sep 28 10:57:08 macmini systemd[1]: Starting mbpfan Custom Service...
Sep 28 10:57:08 macmini systemd[1]: mbpfancs.service: Main process exited, code=
Sep 28 10:57:08 macmini systemd[1]: mbpfancs.service: Failed with result 'exit-c
Sep 28 10:57:08 macmini systemd[1]: Failed to start mbpfan Custom Service.`

And so then

~$ journalctl -xe

Sep 28 09:10:19 macmini dbus-daemon[1048]: [system] Successfully activated service 'org.freedesktop.hostname1'
Sep 28 09:10:19 macmini systemd[1]: Started Hostname Service.
-- Subject: Unit systemd-hostnamed.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit systemd-hostnamed.service has finished starting up.
-- 
-- The start-up result is RESULT.
Sep 28 09:10:19 macmini hassio-supervisor[9614]: 19-09-28 09:10:19 INFO (MainThread) [hassio.host.services] Update service information
Sep 28 09:10:19 macmini hassio-supervisor[9614]: 19-09-28 09:10:19 INFO (MainThread) [hassio.utils.gdbus] Call org.freedesktop.systemd1.Manager.L
Sep 28 09:17:01 macmini CRON[2158]: pam_unix(cron:session): session opened for user root by (uid=0)
Sep 28 09:17:01 macmini CRON[2159]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Sep 28 09:17:01 macmini CRON[2158]: pam_unix(cron:session): session closed for user root
Sep 28 09:50:53 macmini systemd-timesyncd[548]: Network configuration changed, trying to establish connection.
Sep 28 09:50:53 macmini systemd-timesyncd[548]: Synchronized to time server 91.189.89.198:123 (ntp.ubuntu.com).
Sep 28 10:17:01 macmini CRON[5657]: pam_unix(cron:session): session opened for user root by (uid=0)
Sep 28 10:17:01 macmini CRON[5658]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Sep 28 10:17:01 macmini CRON[5657]: pam_unix(cron:session): session closed for user root
Sep 28 10:36:59 macmini hassio-supervisor[9614]: 19-09-28 10:36:59 INFO (MainThread) [hassio.updater] Fetch update data from https://version.home
Sep 28 10:36:59 macmini hassio-supervisor[9614]: 19-09-28 10:36:59 INFO (MainThread) [hassio.store.git] Update add-on https://github.com/home-ass
Sep 28 10:36:59 macmini hassio-supervisor[9614]: 19-09-28 10:36:59 INFO (MainThread) [hassio.store.git] Update add-on https://github.com/danimtb/
Sep 28 10:36:59 macmini hassio-supervisor[9614]: 19-09-28 10:36:59 INFO (MainThread) [hassio.store.git] Update add-on https://github.com/hassio-a
Sep 28 10:37:00 macmini hassio-supervisor[9614]: 19-09-28 10:37:00 INFO (MainThread) [hassio.store] Load add-ons from store: 61 all - 0 new - 0 r
Sep 28 10:56:04 macmini sudo[8465]:    grant : TTY=pts/0 ; PWD=/home/grant ; USER=root ; COMMAND=/bin/nano /etc/systemd/system/mbpfancs.service
Sep 28 10:56:04 macmini sudo[8465]: pam_unix(sudo:session): session opened for user root by grant(uid=0)
Sep 28 10:56:49 macmini sudo[8465]: pam_unix(sudo:session): session closed for user root
Sep 28 10:57:08 macmini sudo[8518]:    grant : TTY=pts/0 ; PWD=/home/grant ; USER=root ; COMMAND=/bin/systemctl start mbpfancs
Sep 28 10:57:08 macmini sudo[8518]: pam_unix(sudo:session): session opened for user root by grant(uid=0)
Sep 28 10:57:08 macmini systemd[1]: Starting mbpfan Custom Service...
-- Subject: Unit mbpfancs.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit mbpfancs.service has begun starting up.
Sep 28 10:57:08 macmini mbpfan[8521]: mbpfan starting up
Sep 28 10:57:08 macmini mbpfan[8521]: A previously created .pid file exists at: /var/run/mbpfan.pid. Aborting
Sep 28 10:57:08 macmini systemd[1]: mbpfancs.service: Main process exited, code=exited, status=1/FAILURE
Sep 28 10:57:08 macmini systemd[1]: mbpfancs.service: Failed with result 'exit-code'.
Sep 28 10:57:08 macmini systemd[1]: Failed to start mbpfan Custom Service.
-- Subject: Unit mbpfancs.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit mbpfancs.service has failed.
-- 
-- The result is RESULT.
Sep 28 10:57:08 macmini sudo[8518]: pam_unix(sudo:session): session closed for user root
lines 1061-1108/1108 (END)

= = = = = = = = =

Edit 2:

~$ systemctl status mbpfancs.service
● mbpfancs.service - mbpfan Custom Service
   Loaded: loaded (/etc/systemd/system/mbpfancs.service; enabled; vendor preset:
   Active: activating (start) since Sat 2019-09-28 12:17:54 UTC; 2h 41min ago
 Main PID: 13324 (mbpfan)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/mbpfancs.service
           └─13324 /usr/sbin/mbpfan -f

Sep 28 12:17:54 macmini systemd[1]: Starting mbpfan Custom Service...
Sep 28 12:17:54 macmini mbpfan[13324]: mbpfan starting up
2

1 Answer 1

1

You can create a custom service as explained below.

You will, however, need to know the exact path to the mbpfan executable on your system. To do so, please run the following command in the terminal:

which mbpfan

You will get an output like this:

/usr/sbin/mbpfan

Copy the output and replace PATH_TO_MBPFAN in the service file below with it. Then, please proceed with the instructions below.


Firstly, create and edit a custom systemd service for mbpfan by running the following command in the terminal:

sudo nano /etc/systemd/system/mbpfancs.service 

Secondly, copy and paste the following code into the editor replacing PATH_TO_MBPFAN with the output of which mbpfan and save the file by pressing Ctrl + X then press Y then press Enter :

[Unit]
Description=mbpfan Custom Service

[Service]
Type=oneshot
ExecStart=PATH_TO_MBPFAN -f

[Install]
WantedBy=multi-user.target

Thirdly, start the service by running the following command in the terminal:

sudo systemctl start mbpfancs

Fourthly, enable the service by running the following command in the terminal:

sudo systemctl enable mbpfancs

Finally, reboot your system.

8
  • Thank you very much. I got to the point of starting the service: ~$ sudo systemctl start mbpfancs And received Job for mbpfancs.service failed because the control process exited with error code. See "systemctl status mbpfancs.service" and "journalctl -xe" for details. I would provide the results of ~$ systemctl status mbpfancs.service except that I seem to be limited in the number of characters for my reply. I'm sure it's my unfamiliarity with the forum, so my apologies. Sep 28, 2019 at 11:14
  • I went ahead and rebooted, and then I tried sudo systemctl start mbpfancs again. That seems to have worked -- the fans spun down to a normal level -- but the CLI hung at that point. Not sure if that's relevant. After ^C I went ahead and did sudo systemctl enable mbpfancs and received confirmation that a symlink had been created. So maybe everything's OK? Sep 28, 2019 at 12:21
  • @GrantLewis Please add the output of systemctl status mbpfancs.service to your question by editing it.
    – Raffa
    Sep 28, 2019 at 13:52
  • I've done that. Thank you. Sep 28, 2019 at 14:27
  • @GrantLewis Was the posted status before reboot?. If so, can you run it again now and update the post. Thank you
    – Raffa
    Sep 28, 2019 at 14:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .