As root, I run
root@myself:~# echo disable | sudo tee /proc/acpi/ibm/fan; sleep 5; echo enable | sudo tee /proc/acpi/ibm/fan
but I get
disable
tee: /proc/acpi/ibm/fan: Invalid argument
enable
tee: /proc/acpi/ibm/fan: Invalid argument
How is it possible, when I run as root?
What do I need to do to make it work?
The problem is not with your
tee
command - although since you are already in a root shell you could have used a simple redirectionecho disable > /proc/acpi/ibm/fan
(and could certainly have removed thesudo
).Although "everything in Linux is a file", the reality is that "files" in
/proc
are really interfaces to the running kernel and don't behave exactly like regular files - if we usestrace
we can see that the error doesn't really come fromtee
, but from the underlyingwrite
call to the open file descriptor (I changed the syntax from a pipe to a here-string to make sure that we are tracing thetee
not theecho
):The reason the argument is invalid is that by default, the
thinkpad_acpi
module does not enable fan control - if youcat
the file, you will likely see just a few lines as follows:In order to enable fan control, you need to pass an option to the module during loading, which you can do using a configuration file:
which you can either create in a text editor, or using
(this is just a regular file, so no issues with
tee
this time). Then you will need to reboot - unfortunately it does not seem to be possible to remove and re-load thethinkpad_acpi
module on the fly.After rebooting to re-load the module with its new option, you should see that it now lists some additional
fan_control
commands:Now you should be able to enable/disable/modify the fan parameters, either by writing to
/proc/acpi/ibm/fan
directly with a command such as yourtee
, or using thethinkfan
utility described in your link.For further background about
/proc
, see What happens when I run the command cat /proc/cpuinfo?