[LINUX] [Fan control] Initial setting of fancontorl and error handling

flow

First, type the sensors command

sensors

here,

--The system is aware of the module --The system does not recognize the module --When rmp of CPU fan is 0

The following shows each method in the above cases.

Part 1 Recognize module ◯

  1. Set with sudo pwmconfig. The configuration file is saved in / etc / fancontrol.
  2. Enable the service with systemctl enable fancontrol.
  3. Set to restart fancontrol after the return of suspend. Place the configuration file in / lib / systemd / system-sleep / Create a shell under system-sleep of systemd that specifies the behavior when returning from suspend. (The name can be anything.)

/lib/systemd/system-sleep/restart-fancontrol


#!/bin/bash
case "$1" in
post)
  exec service fancontrol restart
esac

Part 2 Recognize modules ☓

When the CPU fan is 0 rpm

★ I referred to this ★ https://github.com/lm-sensors/lm-sensors/issues/134#issuecomment-513506723

The solution is to change the Linux boot settings. Add ʻacpi_enforce_resources = lax after quiet splash`.

/etc/default/grub


GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_enforce_resources=lax"

Apply settings and restart


sudo update-grub
reboot

Confirm again


sensors

--Part 1 Recognize the module ◯ Execute the method.

Error handling

hwmon allocation changed and fancontrol cannot be executed

Since this is a Linux specification, there seems to be no fundamental solution, so it seems that the best way is to duplicate the fancontrol service when the hwmon allocation changes.

Example) Set with hwmon2 → Reboot → hwmon2 cannot be found!

Solution

  1. Create fancontrol-2.service by duplicating fancontrol.service set in hwmon2
  2. Change the ConditionPathExists of the newly created service.
  3. Add to the suspend setting.

fancontrol.Duplicate service


sudo cp /lib/systemd/system/fancontrol.service /lib/systemd/system/fancontrol-2.service

fancontorl-2.edit service


[Unit]
Description=fan speed regulator
# Run pwmconfig to create this file.
ConditionPathExists=/etc/fancontrol-2
After=lm-sensors.service
Documentation=man:fancontrol(8) man:pwmconfig(8)

[Service]
ExecStartPre=/usr/sbin/fancontrol --check
ExecStart=/usr/sbin/fancontrol
PIDFile=/var/run/fancontrol.pid

[Install]
WantedBy=multi-user.target

suspend settings


#!/bin/bash
case "$1" in
post)
  exec service fancontrol restart
  exec service fancontrol-2 restart
esac

Recommended Posts

[Fan control] Initial setting of fancontorl and error handling
Error divided by 0 Handling of ZeroDivisionError
pix2 pix tensorflow2 Record of trial and error
Summary of error handling methods when installing TensorFlow (2)