2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[ファン制御] fancontorlの初期設定とエラー対処法

Posted at

流れ

まず、sensorsコマンドを打つ

sensors

ここで、

  • システムがモジュールを認識している
  • システムがモジュールを認識していない
  • CPUファンのrmpが0のとき

上記の時のそれぞれのやり方を次に示す

その1 モジュールを認識  ◯

  1. sudo pwmconfig をして設定する。設定ファイルは、/etc/fancontrolに保存される。 
  2. systemctl enable fancontrol でサービスを有効化する。
  3. suspendの復帰後にfancontrolをrestartする設定をする。/lib/systemd/system-sleep/に設定ファイル配置する
    systemdsystem-sleep配下にsuspendから復帰したときの動作を指定するシェルを作成します。(名前は何でも良いです。)
/lib/systemd/system-sleep/restart-fancontrol
# !/bin/bash
case "$1" in
post)
  exec service fancontrol restart
esac

その2 モジュールを認識 ☓

CPUファンが0rpmの時

★こちらを参考にしました★
https://github.com/lm-sensors/lm-sensors/issues/134#issuecomment-513506723

Linuxのブート設定を変更することで解決する。
quiet splashの後にacpi_enforce_resources=laxを追記する。

/etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_enforce_resources=lax"
設定の適用と再起動
sudo update-grub
reboot
再び確認
sensors
  • その1 モジュールを認識  ◯のやり方を実行する。

エラー対処

hwmonの割当が変わってfancontrolが実行できない

これはLinuxの仕様なので根本的な解決方法はないらしいので、hwmonの割当が変わったときのfancontrolサービスを複製していくのがベストな方法っぽいです。

例) hwmon2で設定した → 再起動 → hwmon2が見つかりません!

解決方法

  1. hwmon2で設定したfancontrol.serviceを複製してfancontrol-2.serviceを作る
  2. 新しく作ったserviceのConditionPathExistsを変更する。
  3. suspendの設定に追記する。
fancontrol.serviceを複製
sudo cp /lib/systemd/system/fancontrol.service /lib/systemd/system/fancontrol-2.service
fancontorl-2.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の設定
# !/bin/bash
case "$1" in
post)
  exec service fancontrol restart
  exec service fancontrol-2 restart
esac
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?