Raúl Benencia


Controlling nVidia cards fans with nouveau in Debian

Unlike few years ago, current nouevau drivers work like a charm. The only major feature I was missing was the ability to control the fans because by default they’re very noisy, and for me silence is a feature. Fortunately, as Christmas gift one of the last commits of 2012 introduced this functionality.

Yesterday I finally found some time to play with this feature, and here I’ll describe the steps I’ve followed to make it work in Debian. My video card is a GTS 250, but this procedure should also work on similar cards. I’m using sid, but I don’t see why this shouldn’t work in wheezy. Be aware, we’ll have to change the kernel and this may very well introduce bugs in your system.

Anyway, lets begin. The feature to play with nVidia cards fans was merged in the Linux kernel 3.7 or 3.8, I’m not sure, so we’ll have to install one of them in our system. One option to do it is to download and compile the kernel from kernel.org, but an easier way is to install it from the Debian experimental repository, as at the moment of writing this wheezy and sid have Linux kernel version 3.2. In order to do it, add the experimental repository to your sources.list:

# echo "deb http://debian.unlp.edu.ar/debian/ experimental main" >> /etc/apt/sources.list

Our next step is to install the kernel:

# apt-get update && apt-get -t experimental install linux-image-3.8-trunk-amd64

Note that this step will quickly be outdated, as in a few months this kernel version will reach sid.

Before rebooting your system to try your shiny new kernel, you may have to do one extra step. I had to do it with my GTS 250 card in order to make this procedure work. Whenever you load the nouveau module, you have to load it with an extra parameter. I’ve decided to do it from GRUB, but you can choose to do it with modprobe. In order to do it from GRUB, add the nouveau.perflvl_wr=7777 parameter to the variable GRUB_CMDLINE_LINUX_DEFAULT in the /etc/default/grub file. It should look like this:

cat /etc/default/grub | grep nouveau
GRUB_CMDLINE_LINUX_DEFAULT="quiet nouveau.perflvl_wr=7777"

Then we have to tell GRUB to re-generate the menu. As root:

# update-grub2

Go now and reboot your system. You should have the followings files available:

ls /sys/class/drm/card0/device | grep pwm1
pwm1
pwm1_enable
pwm1_max
pwm1_min

pwm1_enable represents the current fan management mode (NONE, MANUAL or AUTO). pwm1 represents the current power percentage of the fan. Ours steps we’ll be to put the fan in MANUAL management mode and then lower the power percentage to something reasonable. Lets try it:

# echo 1 > /sys/class/drm/card0/device/pwm1_enable
# echo 40 > /sys/class/drm/card0/device/pwm1

You should be now enjoying silence. In order to do this automatically whenever your system boots, just add the previous command to /etc/rc.local file.