ASUS (Zenbook) fan(s) control and monitor kernel module.
The following Notebooks should be supported - be aware that it's still not in production state
Single Fan | Two Fans (NVIDIA) | Limited or no support |
---|---|---|
UX21E | UX32VD | UX3300UAR |
UX31E | UX42VS | UX3410UA |
UX21A | UX52VS | Zenbook 3U |
UX31A | U500VZ | |
UX32A | NX500 | |
UX301LA | UX32LN | |
UX302LA | UX303LB | |
N551JK | N552VX | |
N56JN | N550JV | |
UX303UB |
Dynamic Kernel Module Support (DKMS) is a program/framework that enables generating Linux kernel modules whose sources generally reside outside the kernel source tree. The concept is to have DKMS modules automatically rebuilt when a new kernel is installed. - Wikipedia
Installing the asus-fan kernel module with DKMS means that when you upgrade to a new kernel you do not need to repeat the process outlined below in the Quickstart section each time. The asus-fan kernel module will automatically be rebuilt when a new kernel is installed.
More information on DKMS: Ubuntu Help - DKMS
ubuntu_dkms_sudo_install.sh
script from the misc
folder of this repository. (ie. right-click over Raw > select Save link as...)chmod +x ubuntu_dkms_sudo_install.sh
)./ubuntu_dkms_sudo_install.sh
)lsmod | grep asus_fan
. If you get something like asus_fan 14880 0 you are good. If you get nothing the module is not loaded.Symlinks will need to be created each time. The asus-fan-create-symlinks.sh
is designed for this purpose, however it must be run after each reboot to create these links.
If you used the ubuntu_dkms_sudo_install.sh
installation script above the asus-fan-ubuntu-create-symlinks.sh
will have been installed at /usr/local/sbin/asus-fan-create-symlinks.sh
.
For Ubuntu 14.04 using the Upstart init system add the following to the Thermald upstart configuration file, /etc/init/thermald.conf
pre-start script
if [ ! -d /tmp/asus-fan-shm ]; then
/usr/local/sbin/asus-fan-create-symlinks.sh
echo " * creating symlinks ..."
fi
end script
My full /etc/init/thermald.conf
looks like this:
# thermald - thermal daemon
# Upstart configuration file
# Manages platform thermals
description "thermal daemon"
start on runlevel [2345] and started dbus
stop on stopping dbus
#
# don't respawn on error
#
normal exit 1
For newer Ubuntu versions that use systemd
init system the following line can be added to /etc/systemd/system/dbus-org.freedesktop.thermald.service
in the [Service]
section to create the links when thermald starts.
ExecStartPre=/usr/local/sbin/asus-fan-create-symlinks.sh
With this line added on Ubuntu 18.04 /etc/systemd/system/dbus-org.freedesktop.thermald.service
looks like this:
[Unit]
Description=Thermal Daemon Service
[Service]
Type=dbus
SuccessExitStatus=1
BusName=org.freedesktop.thermald
ExecStartPre=/usr/local/sbin/asus-fan-create-symlinks.sh
ExecStart=/usr/sbin/thermald --no-daemon --dbus-enable
[Install]
WantedBy=multi-user.target
Alias=dbus-org.freedesktop.thermald.service
cd /usr/src
sudo wget -o asus-fan-master.tar.gz https://github.com/daringer/asus-fan/archive/master.tar.gz
sudo mkdir asus_fan-master
cd asus_fan-master
sudo tar xpvf ../asus_fan.tar.gz --strip-components=1
sudo tar xpvf ../asus_fan.tar.gz --strip-component
sudo mv dkms.conf dkms.conf.archlinu
sudo mv dkms-ubuntu.conf dkms.conf
cd ..
sudo dkms add -m asus_fan -v master
sudo dkms install -m asus_fan -v master
sudo echo asus_fan >>/etc/modules
sudo cp misc/asus-fan-create-symlinks.sh /usr/local/sbin/asus-fan-create-symlinks.sh
For Ubuntu 14.04 you will also need to add the lines mention above in the Ubuntu - Symlink Creation on reboot section to /etc/init/thermald.conf
so that symlinks get created at each reboot by the Upstart init system. Newer versions of Ubuntu use the Systemd init system and not Upstart.
Just get the PKGBUILD and the install script and run makepkg
:
cd /tmp
mkdir asus-fan-build
cd asus-fan-build
wget wget https://raw.githubusercontent.com/daringer/asus-fan/master/buildscripts/archlinux/PKGBUILD
wget https://raw.githubusercontent.com/daringer/asus-fan/master/buildscripts/archlinux/asus-fan-dkms-git/asus-fan-dkms-git.install
makepkg
sudo pacman -U asus-fan-dkms-git-*.pkg.tar.xz
Or simply use the AUR package and your fav. AUR tooling...
Runing ls -l /tmp/asus-fan-shm/
will list the sysmlinks created. If it looks like you are missing some (this depends on the Asus laptop you have as to how many and which ones you will have) you can run sudo asus-fan-create-symlinks.sh
. This will delete the links in the folder and recreate them. A number of them are only created if they are readable.
Build - just run make
inside the directory
Install - run sudo make install
inside the directory
Load - simply as usual:
modprobe asus_fan
Interface - the fan(s) is/are exposed as hwmon
, thus available in:
fpath="/sys/class/hwmon/hwmonX"
Monitor Fan speed - simply use xsensors or psensors for graphical, or sensors for console monitoring. My personal preference is conky---there are alot linux system monitors.
Set Fan Speed - write anything from 0 to 255 to pwmX
, like:
echo 123 > ${fpath}/pwmX # set to 123
echo 0 > ${fpath}/pwmX # switch fan off (DANGEROUS!)
echo 255 > ${fpath}/pwmX # set to max speed
ATTENTION - the fan is now in manual mode - do not burn your machine!
Set Auto-Fan(s): to reactivate the automatic fan control write "0" to pwmX_enable
:
echo 0 > ${fpath}/pwmX_enable # reset to auto-mode (always for all fans)
Max fan speed There is an additional file for controling the maximum fan speed. It's r/w and controls both, automatic mode and manual mode maximum speed. Value range: 0-255 reset value:256
asus_wmi
module, which is maybe the only way to submit it for the upstream kernel, nevertheless support for the second fan is not available through wmi. Sister project, closely related to the one shown here.So this project distinguishes itself from the others by providing a hwmon standard state-of-art interface with a wide variety of supported zenbook models realized as a kernelspace driver. Guess you found the right one ;)
There is a script called "fancontrol" that can be configured according to temperature source, fans to control, minimum and maximum temperature, thats done by "pwmconfig" Nevertheless that script did it worse for me than the original controller - thus you can tell it to stop the fan completely...
DEBUG=1
may be passed to make to build the module in debug-mode. dmesg
will then contain alot more debug output for the module:
make DEBUG=1
sudo rmmod asus-fan
sudo insmod asus-fan.ko
USE THIS ONLY WITH CAUTION FOR TESTING, UNFORSEEABLE THINGS MAY HAPPEN! YOU'VE BEEN WARNED...
force_load=1
may be passed as an argument during module loading to skip the device checks and tests:
sudo rmmod asus-fan
sudo insmod asus-fan.ko force_load=1