You are not logged in.

#1 2012-10-28 14:49:27

Canard
Member
Registered: 2012-10-28
Posts: 8

Thinkfan daemon won't load at boot - status=4/NOPERMISSION

Hi,
I am probably missing something obvious as a new user of Arch (pure systemd installaton), sorry for the mess.
I just installed thinkfan (0.8.1, the last version up to now) on my Lenovo x121e. Launching the service using 'sudo systemctl start thinkfan.service' after login works fine. However, it seems I can't load it at boot. 'sudo systemctl status thinkfan.service' gives the following output:

thinkfan.service - Thinkfan Daemon - simple and lightweight fan control program
	  Loaded: loaded (/usr/lib/systemd/system/thinkfan.service; enabled)
	  Active: failed (Result: exit-code) since Sun, 2012-10-28 15:17:56 CET; 1min 11s ago
	 Process: 226 ExecStart=/usr/sbin/thinkfan -n -s5 -q (code=exited, status=4)
	  CGroup: name=systemd:/system/thinkfan.service

Oct 28 15:17:56 lenovo-arch systemd[1]: Started Thinkfan Daemon - simple and lightweight fan control program.
Oct 28 15:17:56 lenovo-arch systemd[1]: thinkfan.service: main process exited, code=exited, status=4/NOPERMISSION
Oct 28 15:17:56 lenovo-arch systemd[1]: Unit thinkfan.service entered failed state

My /usr/lib/systemd/system/thinkfan.service is:

[Unit]
Description=Thinkfan Daemon - simple and lightweight fan control program
After=basic.target

[Service]
ExecStart=/usr/sbin/thinkfan -n -s5 -q

[Install]
WantedBy=multi-user.target

I hope it makes sense. Please let me know if other logs are necessary. Thanks for the help.

Last edited by Canard (2012-10-28 20:53:34)

Offline

#2 2012-10-28 15:54:11

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

thinkfan reads from files in sysfs, which probably are dependent on thinkpad_acpi (just guessing here) being loaded. Presumably, they don't exist when the service runs at bootup. Either write a udev rule to launch the service (using ENV{SYSTEMD_WANTS}), or load the module explicitly.

Unrelated, you don't need After=basic.target. Every unit has a set of default dependencies (which includes After=basic.target) unless explicitly disabled.

Offline

#3 2012-10-28 18:38:23

Canard
Member
Registered: 2012-10-28
Posts: 8

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

Thank you for you answer. I have never written a udev rule but I guess it is never too late. So, I have in /etc/udev/rules.d/thinkfan-start.rules the following:

SUBSYSTEM=="module", KERNEL=="thinkpad_acpi", TAG+="systemd", ACTION=="add", ENV{SYSTEMD_WANTS}="thinkfan.service"

And it seems to work. I hope there is not too much garbage is this line.

Offline

#4 2012-10-28 19:00:40

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

Neat. The rule looks fine, but you should move the ACTION prior to the TAG. I'm actually not sure the TAG is even needed.

Last edited by falconindy (2012-10-28 19:01:43)

Offline

#5 2012-10-28 20:56:17

Canard
Member
Registered: 2012-10-28
Posts: 8

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

Well, I was maybe too enthusiastic... After boot, thinkfan sometimes still doesn't load. However, the error code has changed for a success code...
systemctl status thinkfan.service:

thinkfan.service - Thinkfan Daemon - simple and lightweight fan control program
	  Loaded: loaded (/usr/lib/systemd/system/thinkfan.service; enabled)
	  Active: inactive (dead) since Sun, 2012-10-28 20:49:33 CET; 26s ago
	 Process: 284 ExecStart=/usr/sbin/thinkfan -n -s5 -q (code=exited, status=0/SUCCESS)
	  CGroup: name=systemd:/system/thinkfan.service

Oct 28 20:49:33 lenovo-arch systemd[1]: Starting Thinkfan Daemon - simple and lightweight fan control program...
Oct 28 20:49:33 lenovo-arch systemd[1]: Started Thinkfan Daemon - simple and lightweight fan control program.

Thank you for your help.

Last edited by Canard (2012-10-28 20:58:27)

Offline

#6 2013-02-06 21:45:13

pgrond
Member
Registered: 2011-06-27
Posts: 10

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

I'm having the same problem (status=4 NOPERMISISON). Is there anyone who can point to a solutions?

Offline

#7 2013-02-06 22:07:29

pgrond
Member
Registered: 2011-06-27
Posts: 10

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

Ok, fixed it in my situation. Check if the sensors in your /etc/thinkfan.conf exist and are configured in the right way.

Offline

#8 2013-05-30 04:07:53

drrossum
Member
From: Chicago
Registered: 2009-02-24
Posts: 82

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

Any progress on this problem?  Same problem here: it sometimes starts at boot, sometimes not.

   Active: failed (Result: exit-code) since Wed 2013-05-29 19:50:36 CDT; 2h 56min ago
  Process: 157 ExecStart=/usr/sbin/thinkfan -n -s5 -q (code=exited, status=1/FAILURE)

The suggested udev rule is giving me the same issues that Canard reported.

Also manually loading thinkpad_acpi doesn't help...

Offline

#9 2013-05-30 04:31:02

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

drrossum wrote:

Also manually loading thinkpad_acpi doesn't help...

What is your idea of "manually loading thinkpad_acpi"?  By this are you simply trying to modprobe it from the command line?  Because what was meant by this is ensuring that it is loaded early at boot.  A good way to do this would probably be putting it in the initramfs so that it is loaded before the switch to /new_root.

Offline

#10 2013-05-30 05:27:47

opt1mus
Member
From: UK
Registered: 2011-12-31
Posts: 212
Website

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

I'm using a ThinkPad T60p here, I use the ThinkFan manually - in order to gain control I've added thinkpad_acpi.fan_control=1 to the end of the kernel line in syslinux.cfg, then I can issue commands.

Offline

#11 2013-05-30 06:02:56

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

I totally forgot about the part where you have to set the module to give yourself control of the fan.

@opt1mus, if you want to keep your kernel command line cleaner, you can add something like /etc/modprobe.d/thinkpad_acpi.conf that includes:

options thinkpad_acpi fan_control=1 

Also I want to mention that you should be able to control this ability by echoing enable or disable to /proc/acpi/ibm/fan.

Offline

#12 2013-05-30 06:29:08

opt1mus
Member
From: UK
Registered: 2011-12-31
Posts: 212
Website

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

@WonderWoofy, you're right, using /etc/modprobe.d/thinkpad_acpi.conf has the same result, with the added bonus of not cluttering the kernel line.

Issuing disable/enable to /proc/acpi/ibm/fan however; switches the fan itself off/on respectively, rather than affecting the ability to control it.

Offline

#13 2013-05-30 14:48:34

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

opt1mus wrote:

@WonderWoofy, you're right, using /etc/modprobe.d/thinkpad_acpi.conf has the same result, with the added bonus of not cluttering the kernel line.

Issuing disable/enable to /proc/acpi/ibm/fan however; switches the fan itself off/on respectively, rather than affecting the ability to control it.

Interestng... I did not try it myself.  But that is what the kernel docs seemed to indicate.  If you install ther linux-docs package, you can ten read all about thinkpad-acpi at /usr/src/linux-$(uname -r)/Documentation/laptops/thinkpad-acpi.txt

Offline

#14 2013-05-30 15:14:00

drrossum
Member
From: Chicago
Registered: 2009-02-24
Posts: 82

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

WonderWoofy wrote:
drrossum wrote:

Also manually loading thinkpad_acpi doesn't help...

What is your idea of "manually loading thinkpad_acpi"?  By this are you simply trying to modprobe it from the command line?  Because what was meant by this is ensuring that it is loaded early at boot.  A good way to do this would probably be putting it in the initramfs so that it is loaded before the switch to /new_root.

I tried creating a .conf file in /etc/modules-load.d/, that's what didn't help.

Thanks for your suggestion to put thinkpad_acpi in the initramfs.  I'll give that a try.

Offline

#15 2013-05-30 15:17:30

opt1mus
Member
From: UK
Registered: 2011-12-31
Posts: 212
Website

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

drrossum wrote:

I tried creating a .conf file in /etc/modules-load.d/, that's what didn't help.

Not in /etc/modprobe.d/ ?

-- edit --

I scan-read, evidently not.

Last edited by opt1mus (2013-05-30 15:20:49)

Offline

#16 2013-05-30 15:28:33

donniezazen
Member
From: Salt Lake City
Registered: 2011-06-24
Posts: 671
Website

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

packer -S thinkfan
sudo vim /etc/modprobe.d/thinkpad_acpi.conf
options thinkpad_acpi fan_control=1

Source


List sensors

find /sys/devices -type f -name "temp*_input"

Source

sudo vim /etc/thinkfan.conf


######################################################################
# thinkfan 0.7 example config file
# ================================
#
# ATTENTION: There is only very basic sanity checking on the configuration.
# That means you can set your temperature limits as insane as you like. You
# can do anything stupid, e.g. turn off your fan when your CPU reaches 70°C.
#
# That's why this program is called THINKfan: You gotta think for yourself.
#
######################################################################
#
# IBM/Lenovo Thinkpads (thinkpad_acpi, /proc/acpi/ibm)
# ====================================================
#
# IMPORTANT:
#
# To keep your HD from overheating, you have to specify a correction value for
# the sensor that has the HD's temperature. You need to do this because
# thinkfan uses only the highest temperature it can find in the system, and
# that'll most likely never be your HD, as most HDs are already out of spec
# when they reach 55 °C.
# Correction values are applied from left to right in the same order as the
# temperatures are read from the file.
#
# For example:
# sensor /proc/acpi/ibm/thermal (0, 0, 10)
# will add a fixed value of 10 °C the 3rd value read from that file. Check out
# http://www.thinkwiki.org/wiki/Thermal_Sensors to find out how much you may
# want to add to certain temperatures.

#  Syntax:
#  (LEVEL, LOW, HIGH)
#  LEVEL is the fan level to use (0-7 with thinkpad_acpi)
#  LOW is the temperature at which to step down to the previous level
#  HIGH is the temperature at which to step up to the next level
#  All numbers are integers.
#

# I use this on my T61p:
#sensor /proc/acpi/ibm/thermal (0, 10, 15, 2, 10, 5, 0, 3, 0, 3)

sensor /sys/devices/platform/coretemp.0/temp1_input
sensor /sys/devices/platform/coretemp.0/temp2_input
sensor /sys/devices/platform/coretemp.0/temp3_input
#sensor /sys/devices/virtual/hwmon/hwmon0/temp1_input

(0,	0,	60)
(1,	53,	65)
(2,	55,	66)
(3,	57,	68)
(4,	61,	70)
(5,	64,	71)
(7,	68,	32767)
sudo systemctl enable thinkfan
systemctl reboot
cat /proc/acpi/ibm/fan
status:		enabled
speed:		3589
level:		2
commands:	level <level> (<level> is 0-7, auto, disengaged, full-speed)
commands:	enable, disable
commands:	watchdog <timeout> (<timeout> is 0 (off), 1-120 (seconds))

Notes:-
[1]I am using 0.7 configuration but 0.8.1 supports advanced configuration which I have not had time to setup. Download the thinkfan package and see all three configuration methods. If you figure out 0.8.1 config please do apprise us on this thread.
[2] You might want to change sensor section and temperature limits to suit your need.
[3] As long as you see level number everything is working fine.
[4] As always setting up temp limits by yourself might be dangerous.

Last edited by donniezazen (2013-05-30 15:29:27)

Offline

#17 2013-05-30 15:46:25

drrossum
Member
From: Chicago
Registered: 2009-02-24
Posts: 82

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

Thanks.  To keep the thread on topic, this probably is the issue we're looking at:

falconindy wrote:

thinkfan reads from files in sysfs, which probably are dependent on thinkpad_acpi (just guessing here) being loaded. Presumably, they don't exist when the service runs at bootup. Either write a udev rule to launch the service (using ENV{SYSTEMD_WANTS}), or load the module explicitly.

Offline

#18 2013-05-30 21:45:07

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

I don't think this ever went off topic.  It has continued to be a discussion about how to make thinkfan work on boot, has it not?  If the module is not loaded with the fan_control parameter enabled, thinkfan will not have permission to function... no?

Anyway, did you actually try putting the thinkpad_acpi module in the initramfs?  Also you would need to ensure that the /etc/modprobe.d/thinkpad_acpi.conf file (yes the same one discussed above) is also put into the initramfs.  But these days this shoudl be done automatically as long as you have the "modconf" hook in your HOOKS.

Offline

#19 2013-06-01 06:11:50

drrossum
Member
From: Chicago
Registered: 2009-02-24
Posts: 82

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

WonderWoofy wrote:

If the module is not loaded with the fan_control parameter enabled, thinkfan will not have permission to function... no?

That would be a persistent error.  And "systemctl start thinkfan.service" would not work after login.

Anyway, did you actually try putting the thinkpad_acpi module in the initramfs?

Yes, thanks for that suggestion.  I had to wait for the next reboot(s) to find out if it works.  Unfortunately, it doesn't resolve the issue.  Even now the sysfs files are not created in time for thinkfan to start.

I can confirm falconindy's assumption was right:

thinkfan[157]: /sys/devices/virtual/thermal/thermal_zone0/temp: No such file or directory

And after boot, this file does exist.

What should work is to have the thinkfan service wait for the sysfs files to exist.

Offline

#20 2013-06-01 06:20:52

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

You could have a ghetto hack that either simply has an ExecStartPre=/usr/bin/sleep 10, or use a systemd.timer unit that calls it after waiting a bit.

Otherwise, I think the udev rule idea is probably the best one.  You may just need to tinker with it a bit.  Have you tried modifying the suggested rule in any way?

Offline

#21 2013-06-01 06:45:44

drrossum
Member
From: Chicago
Registered: 2009-02-24
Posts: 82

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

Success!  You are the man!

This is the rule that does the trick for me:

TEST{444}=="/sys/devices/virtual/thermal/thermal_zone0/temp", ENV{SYSTEMD_WANTS}="thinkfan.service"

Thanks again!

Offline

#22 2013-06-01 15:28:10

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Thinkfan daemon won't load at boot - status=4/NOPERMISSION

Yeah, that rule makes total sense.  Simple as can be.  Don't forget to mark the thread as Solved.


Edit: Oh wait, this isn't actually your thread is it... in fact it is an old thread that was revivied.

Last edited by WonderWoofy (2013-06-01 15:28:41)

Offline

Board footer

Powered by FluxBB