• LINUX > controler la température et la vitesse du ventilateur

      lm-sensors : utiliser les capteurs matériels

      Pour suivre les données : lm-sensors

      installez et configurez lm-sensors pour obtenir plus d’informations sur votre matériel.

       

      sudo apt install lm-sensors

      Configuration automatique

      Détecter les sondes :

      sudo sensors-detect

       

      Répondre yes à toutes les questions ;

      À un certain moment sensors-detect vous demande s’il doit ajouter lui même la configuration des capteurs au lancement d’Ubuntu en affichant ceci :

      ''To load everything that is needed, add this to /etc/modules:\\
      #----cut here----\\
      # Chip drivers\\
      lm90\\
      #----cut here----\\
      If you have some drivers built into your kernel, the list above will contain too many modules. \\
      Skip the appropriate ones!\\
      
      Do you want to add these lines automatically to /etc/modules? (yes/NO)'' \\

      Tapez yes, puis faites Entrée.

      important: possibilité de message d’erreur au démarrage du type "Failed to start load modules", dans ce cas éditez le fichier /etc/modules en mode administrateur et commenter avec un "#" les derniers modules ajoutés, puis recommencer la manipulation en laissant le choix par défaut à toutes les questions !

      Charger les modules que lm-sensors a rajoutés si vous ne voulez pas les charger à la main :

      sudo service kmod restart

      Test et configuration des capteurs

      Test

      Maintenant, testez les capteurs avec la commande « sensors » :

      sensors

      Ce qui devrait afficher :

      ''%%*******************************************************************%%'' \\
      ''it87-isa-0290\\
      Adapter: ISA adapter\\
      VCore 1: +1.57 V (min = +1.42 V, max = +1.57 V) ALARM\\
      VCore 2: +2.66 V (min = +2.40 V, max = +2.61 V) ALARM\\
      +3.3V: +6.59 V (min = +3.14 V, max = +3.46 V) ALARM\\
      +5V: +5.11 V (min = +4.76 V, max = +5.24 V)\\
      +12V: +11.78 V (min = +11.39 V, max = +12.61 V)\\
      -12V: -19.14 V (min = -12.63 V, max = -11.41 V) ALARM\\
      -5V: +0.77 V (min = -5.26 V, max = -4.77 V) ALARM\\
      Stdby: +5.00 V (min = +4.76 V, max = +5.24 V)\
      VBat: +3.12 V\\
      fan1: 3668 RPM (min = 0 RPM, div = \\
      fan2: 0 RPM (min = 664 RPM, div =  ALARM\\
      fan3: 0 RPM (min = 2657 RPM, div = 2) ALARM\\
      M/B Temp: +39°C (low = +15°C, high = +40°C) sensor = thermistor\\
      CPU Temp: +36°C (low = +15°C, high = +45°C) sensor = thermistor\\
      Temp3: +96°C (low = +15°C, high = +45°C) sensor = diode  \\ 
      
       %%***********************************************************************' %%''  \\

      Redémarrez Ubuntu et les capteurs devraient maintenant être détectés pendant la phase de démarrage.

      Pour des détails à propos de la configurations des capteurs, consultez la documentation spécifique au fichier sensors.conf :

      man sensors.conf

      Configuration

      Un peu de configuration est nécessaire si vous voulez :

      1. afficher des noms compréhensibles pour vos capteurs à la place de "temp1″, "fan3″, etc…
      2. corriger les informations données par les capteurs.

      Le fichier /etc/sensors3.conf est le fichier de configuration de Sensor.
      Il permet d’ajouter des fichiers de configuration spécifiques à votre matériel dans le dossier /etc/sensors.d.

      Il est préférable de ne pas modifier le fichier /etc/sensors3.conf.

      • Il faut d’abord vérifier l’existence d’un fichier de configuration pour votre carte-mère
      • puis le placer dans le dossier etc/sensors.d,
      • allez faire un tour dans le BIOS et notez les valeurs indiquées pour retrouver celles indiquées par sensors,
      • créez un fichier dans le répertoire /etc/sensors.d , le fichier de configuration est assez simple, Il faut d’abord :
        • définir le module auquel s’appliquent les modifications avec chip,
        • modifier la configuration des capteurs,

      Par exemple :

      label pour changer le nom ;
      ignore pour ignorer un capteur qui n’est pas connecté sur votre système.
      Pour une liste complète des commandes et options, consulter le manuel de sensors.conf).

      man sensors.conf

      Un petit exemple ci-dessous :

      exemple.conf
      chip "it87-isa-0290"
         label fan1 "ventilateur CPU"
         ignore fan2
         ignore fan3

      Inspirez vous des exemples de fichiers existants sur le site du lien précédent 1)

      Contrôle des ventilateurs

      Installez le paquet fancontrol.

      Voici comment contrôler la "vitesse du ventilateur" 2) :

      • Effectuez la configuration de la vitesse de vos ventilateurs avec cette commande:
      sudo pwmconfig

      Si la liste de quelques ventilateurs apparaît sans erreur, cela signifie que votre script est fonctionnel.
      Le script teste vos ventilateurs 3) et

      ☝ vous donne plusieurs éléments d’informations sur la vitesse maximum et minimum de vos ventilateurs,

      puis

      ☝ vous demande de valider chaque choix

      ☛ seuil de température minimum,
      ☛ seuil de température maximum,
      ☛ etc…

      Afin de lancer fancontrol au démarrage,

      puis

      • copiez-collez le contenu suivant :
      fancontrol
      #!/bin/sh
      #
      # Fancontrol start script.
      #
      
      set -e
      
      # Defaults
      DAEMON=/usr/sbin/fancontrol
      CONF=/etc/fancontrol
      PIDFILE=/run/fancontrol.pid
      PATH=/sbin:/bin:/usr/sbin:/usr/bin
      
      test -f $DAEMON || exit 0
      
      . /lib/lsb/init-functions
      
      case "$1" in
          start)
                     log_begin_msg "(en) : Starting fancontrol daemon... ; (fr) : Démarrage du service fancontrol…"
                     start-stop-daemon --start -o -q -m -b -p $PIDFILE -x $DAEMON $CONF
                     log_end_msg $?
                     ;;
          stop)
              log_begin_msg "(en) : Stopping fancontrol daemon... ; (fr) : Arrêt du service fancontrol…"
              start-stop-daemon --stop -o -q -p $PIDFILE
              log_end_msg $?
              rm -f $PIDFILE
              ;;
          force-reload|restart)
              sh $0 stop
              sh $0 start
              ;;
          *)
              log_success_msg " Usage: /etc/init.d/fancontrol {start|stop|restart|force-reload}"
              log_success_msg " start - starts system-wide fancontrol service"
              log_success_msg " stop  - stops system-wide fancontrol service"
              log_success_msg " restart, force-reload - starts a new system-wide fancontrol service"
              exit 1
              ;;
      esac
      
      exit 0
      • Rendez le script exécutable grâce à cette commande :
      sudo chmod +x /etc/init.d/fancontrol

      Puis

      • testez le script :
      sudo service fancontrol start

      puis:

      sudo service fancontrol stop

      Si tout marche bien, le script de démarrage du service sera automatiquement lancé au prochain démarrage d’Ubuntu.

      Sinon, il ne reste plus qu’à éditer avec les droits d’administration le fichier /etc/rc.local pour que le script se lance au démarrage, avant la ligne :

      exit 0

      insérez la ligne suivante :

      sudo service fancontrol start

      Gerer la surchauffe

      Le ventilateur du processeur ne fonctionne plus après quelques minutes, l’ordinateur portable surchauffe et s’arrête. Pour éviter cela, Ouvrez le fichier /etc/default/grub avec les droits d’administration et modifier cette ligne :

      GRUB_CMDLINE_LINUX="acpi.power_nocheck=1"

      Mettez à jour grub Voir la page grub pour plus d’information sur la modification du fichier.

      Munin

      Si vous utilisez Munin, vous pouvez inclure un graphe des capteurs dans votre page de surveillance munin.
      Il vous faut créer un lien de /usr/share/munin/sensors_ (plugin générique sensors) vers /etc/munin/plugins/sensors_fan sensors_temp :

      sudo ln -s /usr/share/munin/plugins/sensors_   /etc/munin/plugins/sensors_temp

      ou sensors_volt 4).
      Vous devrez bien sûr vérifier que le capteur peut récupérer une valeur de vitesse de ventilateur 5), de tension 6) ou de température7).

      Afficher les informations des capteurs sur le bureau ou le tableau de bord

      Par environnement

      Unity

      Pour afficher graphiquement les données des capteurs sous Unity vous pouvez installer le paquet indicator-multiload.

      GNOME Shell

      Pour afficher graphiquement les données des capteurs sous GNOME, vous pouvez installer l’extension FREON : https://extensions.gnome.org/extension/841/freon/

      MATE (et Gnome Flashback)

      Gnome Sensors Applet est un applet pour tableau de bord qui devrait convenir. Pour l’utiliser installez le paquet sensors-applet.

      Après installation, il faut ajouter l’applet au tableau de bord voulu, pour cela, consultez les pages respectives :

      Vous pouvez aussi installer hddtemp pour ajouter le contrôle de la température des disques durs.
      Il faut activer le daemon, soit à l’installation du package, soit en tapant :

      sudo dpkg-reconfigure hddtemp

      Hddtemp n’est pas indispensable à sensors-applet, mais il est préférable de l’installer pour avoir un support plus étendu des capteurs.

      KDE

      Sous Kubuntu, pour obtenir l’affichage graphique des capteurs ajoutez le composant "Température du matériel" dans votre tableau de bord.
      Cette application est recommandée pour les environnement KDE.

      Xfce

      Xfce dispose d’un logiciel permettant de voir les températures de son ordinateur. Pour cela, installez le paquet xfce4-sensors-plugin présent dans le dépôt universe. Ensuite, on peut l’utiliser en ajoutant un élément à un panneau XFCE. Il faut alors choisir l’élément appelé « Sensor plugin ». Pour le configurer, effectuez un clic droit sur l’élément du panneau puis aller dans le menu « Propriétés ».

      Pour tous les environnements

      Indicator-sensors

      Une autre possibilité est d’utiliser le paquet indicator-sensors.
      Ce logiciel n’est pas disponible dans les dépôts officiels.

      Il peut être installé depuis un dépôt PPA :

      Pour l’activer :

      Il apparaît dans la zone de notification,

      • Faites un clic droit dessus,

      dans la fenêtre qui s’ouvre vous pouvez

      • renommer les capteurs en cliquant sur l’étiquette et
      • l’activer en cochant la case "Activé" pour afficher les capteurs désirés9).

      Plus d’infos sur (en) Installation des indicateurs de sondes matérielles.

      PSensor

      PSensor ressemble à ceci en indicateur pour Unity :

      Il offre aussi une interface séparée qu’on peut lancer à la demande :

      PSensor est inclus dans la logithèque.
      Il vous faut simplement installer le paquet psensor.

      Vous trouverez une présentation plus complète sur (en) PSensor lets you easily monitor hardware temperature in Ubuntu.

      Screenlets

      L’application Screenlets peut aussi afficher les données des capteurs thermiques.

      Voir aussi

      —-

      Contributeurs: Kmeleon et Ronan,
      Modifié par Fabien26, stephaneguedon, McPeter, L’Africain

      Autres contributeurs : René Stoecklin : Mise en page, traduction, corrections rédactionnelles, conformation à la norme W3C (interface Lynx Braille).

      Page mise à jour le 26 juin 2016.


      1)Exemples de fichiers de configuration pour votre carte-mère

      2)indicateur fanspeed

      3) , 5)fan

      4)plugin spécifique à la fonction

      6)volt

      7)temp

      8) , 9)indicator sensors sur Launchpad

      --

       

      How can I control the computer’s fan speed?

      On Windows there is a wonderful program called SpeedFan.

      shareimprove this question

      edited Feb 3 ’17 at 19:49


      Thompson Dawes
      63411 gold badge55 silver badges1717 bronze badges

      asked Jan 18 ’11 at 11:26


      grizwako
      4,74555 gold badges1818 silver badges2121 bronze badges

      • 1I put simple cron solution for ATI cards here askubuntu.com/a/875241/375427Pavel Niedoba Jan 23 ’17 at 12:54
      • 1On linux, fancontrol is configured using pwmconfig. Use watch sensors to observe sensors under CPU and GPU load. Use those values at idle and full load to set MINTEMP and MAXTEMP respectively, with INTERVAL=1. This ramps your fans in realtime as load increases. This is the most active cooling, providing a baseline for further tweaking. Run pwmconfig once, and then edit /etc/fancontrol directly. Run sudo service fancontrol restart after each tweak. – Dominic Cerisano May 29 ’17 at 17:32

      add a comment

      6 Answers

      active oldest votes

      157

      Note before starting:

      This functionality depends on both your hardware and software. If your hardware doesn’t support fan speed controls, or doesn’t show them to the OS, it is very likely that you could not use this solution. If it does, but the software (aka kernel) doesn’t know how to control it, you are without luck.


      1. Install the lm-sensors and fancontrol packages.
      2. Configure lm-sensors
        1. In terminal type sudo sensors-detect and answer YES to all YES/no questions.
          (Potentially, this can damage your system or cause system crash. For a lot of systems, it is safe. There is no guarantee that this process will not damage your system permanently, I just think that chance of such critical failure is really really low. Saving all your work for eventual crashes/freezes/restarts before handling system configuration is always good idea. If you feel unsure, read the comments and try to search a web and get some high-level overview before YES-ing everything, maybe being selective with your YES-es will still be enough)
        2. At the end of sensors-detect, a list of modules that need to be loaded will be displayed. Type "yes" to have sensors-detect insert those modules into /etc/modules, or edit /etc/modules yourself.
        3. Run sudo service module-init-tools restart. This will read the changes you made to /etc/modules in step 3, and insert the new modules into the kernel.
          • Note: If you’re running Ubuntu 13.04 or higher, this 3rd step command should be replaced by sudo service kmod start.
      3. Configure fancontrol
        1. In terminal type sudo pwmconfig . This script will stop each fan for 5 seconds to find out which fans can be controlled by which PWM handle. After script loops through all fans, you can configure which fan corresponds to which temperature.
        2. You will have to specify what sensors to use. This is a bit tricky. If you have just one fan, make sure to use a temperature sensor for your core to base the fancontrol speed on.
        3. Run through the prompts and save the changes to the default location.
        4. Make adjustments to fine-tune /etc/fancontrol and use sudo service fancontrol restart to apply your changes. (In my case I set interval to 2 seconds.)
      4. Set up fancontrol service
        1. Run sudo service fancontrol start. This will also make the fancontrol service run automatically at system startup.

      In my case /etc/fancontrol for CPU I used:

      Settings for hwmon0/device/pwm2:
      (Depends on hwmon0/device/temp2_input) (Controls hwmon0/device/fan2_input)

      INTERVAL=2
      MINTEMP=40
      MAXTEMP=60
      MINSTART=150
      MINSTOP=0
      MINPWM=0
      MAXPWM=255
      

      and on a different system it is:

      INTERVAL=10
      DEVPATH=hwmon1=devices/platform/coretemp.0 hwmon2=devices/platform/nct6775.2608
      DEVNAME=hwmon1=coretemp hwmon2=nct6779
      FCTEMPS=hwmon2/pwm2=hwmon1/temp2_input
      FCFANS=hwmon2/pwm2=hwmon2/fan2_input
      MINTEMP=hwmon2/pwm2=49
      MAXTEMP=hwmon2/pwm2=83
      MINSTART=hwmon2/pwm2=150
      MINSTOP=hwmon2/pwm2=15
      MINPWM=hwmon2/pwm2=14
      MAXPWM=hwmon2/pwm2=255
      

      here is some useful info on the settings and what they really do

      shareimprove this answer

      edited Mar 20 ’19 at 22:45

      community wiki

      17 revs, 12 users 42%
      GrizzLy

      • 114I tried to follow your guide, but got stuck at step three with this error: /usr/sbin/pwmconfig: There are no pwm-capable sensor modules installed – tamale Dec 12 ’11 at 15:54
      • 6I had the same problem with pwmconfig until I ran sudo sensors-detect – Gearoid Murphy Jan 1 ’12 at 12:16
      • 5What to do if sudo sensors-detect doesn’t come up with any sensors? --> Sorry, no sensors were detected. Either your system has no sensors, or they are not supported, or they are connected to an I2C or SMBus adapter that is not supported. If you find out what chips are on your board, check lm-sensors.org/wiki/Devices for driver status. – H3R3T1K Aug 1 ’12 at 8:23
      • 5If you’re having trouble, be sure to check your dmesg for error messages. In my case, recent kernel changes prevented me from loading the necessary driver, and I had to add acpi_enforce_resources=lax to my kernel options to get the old functionality back. See also: goo.gl/tUcr36bukzor Dec 23 ’13 at 17:49
      • 20I’ve tried this and I can’t get any further than sudo pwmconfig, because I get: "There are no pwm-capable sensor modules installed". This is after the sensors-detect command does find an ‘Intel digital thermal sensor’. I’ve also tried that kernel parameter. Can anyone suggest a solution? – Sman789 Jun 2 ’14 at 0:05

      show 9 more comments

      45

      If you own a ThinkPad, there’s a piece of software called thinkfan that does exactly this. As the name obviously suggests, it is specifically made for ThinkPads (thinkpad_acpi).

      The thinkfan software is available in the standard ubuntu software repositories, but it does require a few steps to configure.

      Here’s an easy step-by-step guide:

      http://www.lxle.net/forums/discussion/821/how-to-set-up-thinkfan-on-a-lenovo-thinkpad-t430/p1

      (which is basically a translated version of this German guide: http://thinkwiki.de/Thinkfan)


      Relevant Information from Post:

      Step 1. Install the thinkfan software and the sensors:

      sudo apt-get install thinkfan lm-sensors
      

      Step 2. Make sure that the daemon controls the fan by editting the thinkpad.conf file:

      sudo nano /etc/modprobe.d/thinkfan.conf
      

      by adding the following line:

      options thinkpad_acpi fan_control=1
      

      Step 3. Make the daemon load automatically at start-up by editting the file:

      sudo nano /etc/default/thinkfan
      

      making sure that the START key is set to yes, i.e. there should be a line that says:

      START=yes
      

      Step 4. Detect your laptop’s sensors:

      sudo sensors-detect
      

      and just choose the default answers whenever you’re prompted by hitting Enter.

      Step 5. Load the new modules. From ubuntu 13.10 this done by:

      sudo service kmod start
      

      while for previous versions like 13.04 you instead will need to do:

      sudo service module-init-tools start
      

      Step 6. Figure out which sensors are in use:

      sensors
      

      (the ones that indicate 0 degrees are not in use, I don’t know why those are "detected" too). Remember which ones are in use.

      Step 7. Find out the full paths of these sensors:

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

      The output should be a list of paths like /sys/devices/…

      Step 8. Copy-paste the paths to the sensors into the configuration file /etc/thinkpad.conf. To do this, first open up the file:

      sudo nano /etc/thinkfan.conf
      

      There should already be a line like

      #sensor /proc/acpi/ibm/thermal (0, 10, 15, 2, 10, 5, 0, 3, 0, 3)
      

      (the #-symbol means that that line is commented out). Add a line starting with sensor (without the #-symbol) and copy-paste you first sensor. Repeat this if you have more than one sensor. For example, on my machine, the output in step 7 yields

      /sys/devices/virtual/hwmon/hwmon0/temp1_input
      /sys/devices/platform/thinkpad_hwmon/temp3_input
      /sys/devices/platform/thinkpad_hwmon/temp4_input
      /sys/devices/platform/thinkpad_hwmon/temp5_input
      /sys/devices/platform/thinkpad_hwmon/temp6_input
      /sys/devices/platform/thinkpad_hwmon/temp7_input
      /sys/devices/platform/thinkpad_hwmon/temp1_input
      /sys/devices/platform/thinkpad_hwmon/temp8_input
      /sys/devices/platform/thinkpad_hwmon/temp2_input
      /sys/devices/platform/coretemp.0/temp4_input
      /sys/devices/platform/coretemp.0/temp2_input
      

      The ones that are in use in my machine are the ones in the first and the last two lines, so I added the three lines:

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

      Step 9. Finally we can set the fan speed levels in the configuration file. Open the /etc/thinkpad.conf file if it wasn’t open already.

      sudo nano /etc/thinkfan.conf
      

      The fan levels I use on my ThinkPad x201 are:

      (0, 0, 51)
      (1, 50, 52)
      (2, 51, 55)
      (3, 54, 58)
      (4, 56, 63)
      (5, 60, 70)
      (6, 66, 79)
      (7, 74, 92)
      (127, 85, 32767)
      

      The last line ensures full fan speed (127 = "disengaged" i.e. unregulated). You can fiddle with these levels to fit your needs/wishes, but PLEASE BE CAREFUL!

      Step 10. Reboot. Everything should work now. In order to check whether thinkpad is runnning correctly, use

      sudo thinkfan -n
      

      which starts thinkfan in verbose mode. You might want to stop the thinkfan daemon first:

      sudo /etc/init.d/thinkfan stop
      

      If you want to start the thinkfan daemon again, type:

      sudo /etc/init.d/thinkfan start
      

      Just to be complete, my /etc/thinkfan.conf configuration file is:

      # 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)
      
      #(0, 0, 55)
      #(1, 48, 60)
      #(2, 50, 61)
      #(3, 52, 63)
      #(4, 56, 65)
      #(5, 59, 66)
      #(7, 63, 32767)
      
      # My settings for my ThinkPad X201: (kris)
      
      sensor /sys/devices/virtual/hwmon/hwmon0/temp1_input
      sensor /sys/devices/platform/coretemp.0/temp4_input
      sensor /sys/devices/platform/coretemp.0/temp2_input
      
      (0, 0, 51)
      (1, 50, 52)
      (2, 51, 55)
      (3, 54, 58)
      (4, 56, 63)
      (5, 60, 70)
      (6, 66, 79)
      (7, 74, 92)
      (127, 85, 32767)
      
      • One comment: you want to have larger overlap of temperature values as in the table commented out. Especially in the 45-55 range. Otherwise, the fan speed keeps flipping. That’s very disturbing. (Constant fan noise does not disturb so much as fluctuating noise.) – HongboZhu Feb 6 ’15 at 16:36
      • We (the linux community) really suck at UX. :( Setting a fan speed shouldn’t be a 10 step process. – Alexander - Reinstate Monica Feb 28 ’17 at 22:53
      • @Alexander If you feel strongly about this, you’re free to write and maintain a little program to automate this process. – Kris Mar 2 ’17 at 22:14
      • @Kris I’d be more inclined to modify the original program to not have such a nonsensical configuration process. Alas, I dont have a thinkpad, I was just passing by this post looking for thr fan control options available out there. – Alexander - Reinstate Monica Mar 2 ’17 at 22:18
      • /etc/modprobe.d/thinkfan.conf does not exist in my Ubuntu 14.04. What now? – Youda008 May 15 ’17 at 18:43

      For several Dell computers you can install i8kutils package:

      sudo apt install i8kutils
      

      If you have a non-tested Dell (like my Dell XPS 14z), you might have to force loading of kernel module:

      sudo modprobe i8k force=1
      
      • I have Dell XPS 14 L421X. <code>sensors</code> showed no fans. after installing i8kutils package, I get sensors coretemp-isa-0000 Adapter: ISA adapter Physical id 0: +54.0°C (high = +87.0°C, crit = +105.0°C) Core 0: +50.0°C (high = +87.0°C, crit = +105.0°C) Core 1: +52.0°C (high = +87.0°C, crit = +105.0°C) i8k-virtual-0 Adapter: Virtual device Right Fan: 0 RPM CPU: +55.0°C – philcolbourn Jan 8 ’17 at 22:21
      • Does this work for hp? – Immortal Player Sep 2 ’17 at 7:35
      • @immortal-player , I think it won’t. The kernel module is specifically designed for Dell machines. – morhook Sep 10 ’17 at 13:06
      • Maybe add, that for Apple there is macfanctld and mbpfan and for ThinkPad, there’s thinkfanrubo77 Aug 1 ’19 at 7:19

      Install and configure the lm-sensors and fancontrol packages:

      sudo apt-get install lm-sensors fancontrol
      

      Documentation for configuring them is available on their man pages.

      This is a function that is supposed to be provided by a ACPI-compliant BIOS, but it seems that most motherboard vendors don’t bother to follow the standard.

      show 2 more comments

      5

      Here is an updated answer, based on the answer recommending thinkfan but working with Ubuntu 19.04, and also on other computers than just ThinkPads.

      1. Setup

      The instructions below apply to any ThinkPad that has the /proc/acpi/ibm/fan and /proc/acpi/ibm/thermal "legacy" devices. This avoids having to install the lm-sensors package.

      However, you can still opt to install lm-sensors. It will give you more temperature sensors and more fine-grained control over your fans, namely in 256 PWM steps rather than the fixed steps "0-7 and 127″ with the legacy devices. Also, since thinkfan now can work with lm-sensors sensors, it is no longer specific for IBM / Lenovo ThinkPad computers. Please refer to man thinkfan for using these "extended" sensor devices. Also, there is up-to-date information in the German Thinkwiki.

      1. Install the required package:
        sudo apt-get install thinkfan
        
      2. Add the following line to /etc/modprobe.d/thinkfan.conf:
        options thinkpad_acpi fan_control=1
        
      3. Configure the thinkfan service to start automatically at system start:
        1. Add a line START=yes to /etc/default/thinkfan
        2. Execute the following command (source):
          sudo systemctl enable thinkfan.service
          
      4. Adapt /etc/thinkfan.conf with the right pointers to devices and the fan levels you want. The comments there provide documentation. On any Thinkpad with the legacy fan and thermal devices, the following should provide a good starting point (also should be safe for the hard disk, see comments in the file for more information). Note that this uses new keywords – the ones in the other answer are now deprecated.
        tp_fan /proc/acpi/ibm/fan
        tp_thermal /proc/acpi/ibm/thermal
        
        (0, 0, 47)
        (1, 43, 52)
        (2, 48, 55)
        (3, 51, 58)
        (4, 54, 63)
        (5, 59, 70)
        (6, 66, 79)
        (7, 74, 92)
        (127, 85, 32767)
        

      2. Test

      To test your setup (after a reboot), you can do as follows:

      • In one terminal window, run thinkfan in non-daemonized mode so you can see its messages:
        sudo service thinkfan stop && sudo thinkfan -n
        
      • In another terminal window, keep an eye on the current temperature values, supplying your temperature probe device if different:
        while true; do sleep 1; cat /proc/acpi/ibm/thermal; done
        
      • In yet another terminal window, make some heat in the CPU (and interrupt it with Ctrl + C in case something in the thermal management does not function as expected):
        sudo apt install stress-ng
        stress-ng --cpu-1
        
      • Awesome. This solved it for my T490 with Pop_OS 19.04. The fan still comes on, but not the whole time.
      • Newer ThinkPad devices don’t have /proc/acpi/ibm/thermal, so it’s necessary to do some extra work for that case (conveniently listed on that wonderful German ThinkWiki page). I seem to have gotten it working for me, so I may update your answer or create another one. Thanks! –

      Cliff, what is the correct folder for this? I’m getting this error: /proc/acpi/ibm/thermal: No such file or directory add_sensor: Error getting temperature. Refusing to run without usable config file!

      OK.. I figured it out. I used this for my T480: wmon /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp1_input hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp5_input hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp2_input (0, 0, 47) (1, 43, 52) (2, 48, 55) (3, 51, 58) (4, 54, 63) (5, 59, 70) (6, 66, 79) (7, 74, 92) (127, 85, 32767)

      Try looking in the UEFI setup (or BIOS setup) of your PC. There might be a setting for fan control where you can put your fan into Silent Mode, Performance Mode, Full Speed, Customize, etc.

      How to access the UEFI settings: Reboot your PC and the key for entering them will likely show up in one of the corners (e.g. Press F2 to enter UEFI setup)

      --

      fancontrol(8) - Linux man page

      Name

      fancontrol - automated software based fan speed regulation

      Synopsis

      fancontrol [configfile]

      Description

      fancontrol is a shell script for use with lm_sensors. It reads its configuration from a file, then calculates fan speeds from temperatures and sets the corresponding PWM outputs to the computed values.

      Warning

      Please be careful when using the fan control features of your mainboard, in addition to the risk of burning your CPU, at higher temperatures there will be a higher wearout of your other hardware components, too. So if you plan to use these components in 50 years, maybe you shouldn’t use fancontrol at all. Also please keep in mind most fans aren’t designed to be powered by a PWMed voltage.

      In practice it doesn’t seem to be a major issue, the fans will get slightly warmer, just be sure to have a temperature alarm and/or shutdown call, in case some fan fails, because you probably won’t hear it anymore ;)

      Configuration

      For easy configuration, there’s a script named pwmconfig(8) which lets you interactively write your configuration file for fancontrol. Alternatively you can write this file yourself using the information from this manpage.

      Since most of you are going to use pwmconfig(8) script, the config file syntax will be discussed last. First I’m going to describe the various variables available for changing fancontrol‘s behaviour:

      INTERVAL
      This variable defines at which interval in seconds the main loop of fancontrol will be executed
      FCTEMPS
      Maps PWM outputs to temperature sensors so fancontrol knows which temperature sensors should be used for calculation of new values for the corresponding PWM outputs.
      FCFANS
      FCFANS records the association between a PWM and a fan. Then fancontrol can check the fan speed and restart it if it stops unexpectedly.
      MINTEMP
      The temperature below which the fan gets switched to minimum speed.
      MAXTEMP
      The temperature over which the fan gets switched to maximum speed.
      MINSTART
      Sets the minimum speed at which the fan begins spinning. You should use a safe value to be sure it works, even when the fan gets old.
      MINSTOP
      The minimum speed at which the fan still spins. Use a safe value here, too.
      MINPWM
      The PWM value to use when the temperature is below MINTEMP. Typically, this will be either 0 if it is OK for the fan to plain stop, or the same value as MINSTOP if you don’t want the fan to ever stop. If this value isn’t defined, it defaults to 0 (stopped fan).
      MAXPWM
      The PWM value to use when the temperature is over MAXTEMP. If this value isn’t defined, it defaults to 255 (full speed).

      The configuration file format is a bit strange:

      VARIABLE=chip/pwmdev=value chip/pwmdev2=value2VARIABLE2=…Each variable has its own line. The variable name is followed by an equal sign
      and the device=value pairs. These consist of the path to the pwm output for which the value is valid, equal sign followed by the value and are separated by a blank. Path can be absolute or relative (from /sys/bus/i2c/devices or /sys/class/hwmon depending on the kernel version). Example:
      MINTEMP=hwmon0/device/pwm1=40 hwmon0/device/pwm2=54

      You have to play with the temperature values a bit to get happy. For initial setup I recommend using the pwmconfig script. Small changes can be made by editing the config file directly following the rules above.

      the Algorithm

      fancontrol first reads its configuration, writes it to arrays and loops its main function. This function gets the temperatures and fanspeeds from kernel driver files and calculates new speeds depending on temperature changes, but only if the temp is between MINTEMP and MAXTEMP. After that, the new values are written to the PWM outputs. Currently the speed increases quadratically with rising temperature. This way you won’t hear your fans most of the time at best.

      See Also

      pwmconfig(8), sensors(1).

       

      --

      How to find fan speed in Linux

      The procedure to find fan speed on Linux is as follows:

      1. First, install lm-sensors package using package manager.
      2. Configure sensors by running sudo sensors-detect command.
      3. Save the configuration file
      4. Finally, run sensors command in Linux to see CPU and GPU temperature, including fan speed.

      Let us see all commands and examples in details.

      How to install lm-sensors

      sudo apt-get install lm-sensors

      Setup and configuration

      Now, that lm-sensors installed, it is time to run sensors-detect command to detect and generate a list of kernel modules.
      sudo lm-sensors
      Now, hardware probing should start. Hence, press the [Enter] key to all questions to create /etc/sensors3.conf file. This file used to load Linux kernel modules and start service automatically at boot time. Display /etc/sensors3.conf using the cat command:
      cat /etc/sensors3.conf
      Sample outputs:

      # libsensors configuration file
      # -----------------------------
      #
      # This default configuration file only includes statements which do not
      # differ from one mainboard to the next. Only label, compute and set
      # statements for internal voltage and temperature sensors are included.
      #
      # In general, local changes should not be added to this file, but rather
      # placed in custom configuration files located in /etc/sensors.d. This
      # approach makes further updates much easier.
      #
      # Such custom configuration files for specific mainboards can be found in
      # "configs" directory of lm-sensors package.
      #
      # Please contribute back a configuration of your board so other users with
      # the same hardware won't need to recreate it again and again.
      
      chip "lm78-*" "lm79-*" "lm80-*" "lm96080-*"
      
          label temp1 "M/B Temp"
      
      chip "w83792d-*"
      
          label in0 "VcoreA"
          label in1 "VcoreB"
          label in6 "+5V"
          label in7 "5VSB"
          label in8 "Vbat"
      
          set in6_min  5.0 * 0.90
          set in6_max  5.0 * 1.10
          set in7_min  5.0 * 0.90
          set in7_max  5.0 * 1.10
          set in8_min  3.0 * 0.90
          set in8_max  3.0 * 1.10
      
      chip "w83793-*"

      Display fan speed and other info

      sensors

       

      You can use the grep command to filter out data:
      sensors | grep -i fan

       

      Our final example includes the watch command that displays fan speed on screen:

      watch -n1 -d sensors
      watch -n1 -d 'sensors | grep fan'
      watch -n1 -d 'sensors | egrep "fan|temp" | grep -v "0.0"'

 

Aucun commentaire

 

Laissez un commentaire