Linux: Dell Laptop Fan Control And Get CPU Temperature
Tutorial details | |
---|---|
Difficulty | Intermediate (rss) |
Root privileges | Yes |
Requirements | i8k driver |
Estimated completion time | N/A |
- Cpu temperature
- Left or right fan status
- Left or right fan speed
- Ac power status
- Fn buttons status
Say hello to i8k driver
You need to load a driver called i8k. It is used for accessing SMM BIOS on Dell laptops. It is well supported on business class Dell laptop modules such as Latitude, Inspiron, Vostro and so on. This module is included with Linux kernel version 3.0 or above.How do I load the driver?
Type the following modprobe command to load the i8k driver:$ sudo modprobe -v i8k
OR
# modprobe -v i8k
Sample outputs:
insmod /lib/modules/3.5.0-30-generic/kernel/drivers/char/i8k.ko
Install i8kutils package on Debian / Ubuntu
Open a terminal and type the following command:$ sudo apt-get install i8kutils
Sample outputs:
Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: i8kutils 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/35.4 kB of archives. After this operation, 184 kB of additional disk space will be used. Selecting previously unselected package i8kutils. (Reading database ... 256376 files and directories currently installed.) Unpacking i8kutils (from .../i8kutils_1.33_amd64.deb) ... Processing triggers for man-db ... Processing triggers for ureadahead ... Setting up i8kutils (1.33) ... * Not starting. Disabled via /etc/default/i8kmon. * Not starting. Disabled via /etc/default/i8kbuttons.Edit the file /etc/default/i8kbuttons and /etc/default/i8kmon and set ENABLED to 1:
ENABLED=1Alternatively, use the sed command to do all your dirty work:
sed -i.bak 's/ENABLED=0/ENABLED=1/' /etc/default/{i8kmon,i8kbuttons}Start the service (this is equivalent of running the modprobe -v i8k command):
# /etc/init.d/i8kmon start
Sample outputs:
* Starting Dell Inspiron fan/cpu-temperature monitor i8kmon [ OK ]
How do I see the current status?
Type the following command$ i8kctl
Sample outputs:
1.0 (null) XYZABC123 43 1 1 77130 78120 0 -1Where,
- 1.0 i8k format version
- (null) bios version
- XYZABC123 machine id (Dell serial number)
- 43 cpu temperature
- 1 left fan status
- 1 right fan status
- 7713 left fan speed
- 7812 right fan speed
- 0 ac power status
- -1 : fn buttons status
$ i8kctl temp
Sample outputs:
52
Controlling fan speed on Dell laptop
First, just print the fan status info:$ i8kctl fan
Sample outputs:
1 1The fan command can accept two optional parameters which specify the new fan state for left and right fans. The state parameter can be:
Where,
- 0 : turn the fan off (not recommended)
- 1 : set low speed
- 2 : set high speed
- - : don't change the state of this fan
$ i8kctl fan 2 -
In this example, sets the left fan (usually used by CPU) to high speed and leaves the left unchanged:
$ i8kctl fan - 2
The following will set both fans to low speed:
$ i8kctl fan 1 1
This is equivalent of running the following commands:
## the syntax is ## i8kfan leftFan rightFan # Set left fan on high and leaves the right unchanged i8kfan 2 - # Set right fan on high and leaves the left unchanged i8kfan - 2 # Set both fans to low i8kfan 1 1Please note that the service /etc/init.d/i8kmon starts i8kmon in daemon mode. So setting the speed with i8kfan is pointless since the daemon will override the speed with its own value on fly as per system temperature.
Using sensors command
First, install and configure lm_sensors package as described here and type the following command to see information about your FAN and cpu core temperature:$ sensors
Sample outputs:
I also suggest that you use the acpi -V command to see the current battery status and thermal temperature under Linux operating systems.