fancontrol does not work after sleep/wakeup
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lm-sensors |
New
|
Unknown
|
|||
lm-sensors (Debian) |
New
|
Unknown
|
|||
lm-sensors (Ubuntu) |
Fix Released
|
Low
|
Unassigned | ||
Bionic |
Fix Released
|
Low
|
Andreas Hasenack | ||
Focal |
Fix Released
|
Low
|
Andreas Hasenack |
Bug Description
[Impact]
When resuming from suspend, the fancontrol service is in a failed state. Fans might be stopped, at full speed, or in an indeterminate state.
A restart of the service after resume gets it working again, and this fix uses a system-sleep hook script to accomplish that.
The change here also includes the change from bug #1967432, so that the service is only restarted if it was active before.
[Test Plan]
There are two hardware requirements to fully test this SRU:
- a machine capable of suspend/resume, like a laptop
- a machine with hardware fan control compatible with fancontrol/
A valid /etc/fancontrol configuration file must be generated, either manually or via pwmconfig(8). Without this file, the fancontrol service won't start.
I didn't have any of those when preparing the fix, so I used a similarly configured systemd service to emulate what would happen (rsync in this case, which also depends on a config file to start).
With the above setup, this is the test plan.
For the following combinations, check that the desired result wrt fancontrol.service is achieved when resuming from suspend:
At suspend time -> When resuming:
Service is enabled and active --> is restarted
Service is disabled and active --> is restarted
Service is enabled and inactive --> is not restarted
Service is disabled and inactive --> is not restarted
[Where problems could occur]
If the script in /lib/systemd/
In some cases, to achieve manual fancontrol, a BIOS setting has to be adjusted to allow for that. In that case, I think the biggest danger of not having this fix is the indeterminate state of the fans when the system resumes. For example, they could be entirely disabled without this service running, and lead to overheating. This is just an assumption, though, as I don't have such a system to experiment with.
Depending on the hardware, users might not experience this bug, and fancontrol works fine after a resume. These users would now have a fancontrol restart in that scenario, which should be harmless. That being said, the usual case of having made an invalid config file change without restarting the service right away might show its head the first time they suspend/resume.
[Other Info]
This update uses the original fix from Debian in 3.6.0-6, plus our fix for bug #1967432.
While preparing the fix, since I didn't have hardware compatible with fancontrol, I used a similar service (rsync) and the same script in /lib/systemd/
[Original Description]
fancontrol system daemon works great. If I suspend to RAM and wake up again it fails:
> sudo service fancontrol status
fancontrol.service - fan speed regulator
Loaded: loaded (/lib/systemd/
Active: failed (Result: exit-code) since Fri 2020-06-05 18:47:10 CEST; 6s ago
Docs: man:fancontrol(8)
Process: 624293 ExecStartPre=
Process: 624444 ExecStart=
Main PID: 624444 (code=exited, status=1/FAILURE)
Jun 05 18:33:43 jeeves fancontrol[624444]: Adjusing hwmon0/
Jun 05 18:33:43 jeeves fancontrol[624444]: Enabling PWM on fans...
Jun 05 18:33:43 jeeves fancontrol[624444]: Starting automatic fan control...
Jun 05 18:47:09 jeeves fancontrol[624444]: /usr/sbin/
Jun 05 18:47:10 jeeves fancontrol[624444]: /usr/sbin/
Jun 05 18:47:10 jeeves fancontrol[624444]: Error writing PWM value to /sys/class/
Jun 05 18:47:10 jeeves fancontrol[624444]: Aborting, restoring fans...
Jun 05 18:47:10 jeeves fancontrol[624444]: Verify fans have returned to full speed
Jun 05 18:47:10 jeeves systemd[1]: fancontrol.service: Main process exited, code=exited, status=1/FAILURE
Jun 05 18:47:10 jeeves systemd[1]: fancontrol.service: Failed with result 'exit-code'.
BUGFIX: add file to /lib/systemd/
#!/bin/bash
case "$1" in
post)
exec service fancontrol restart;;
esac
ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: fancontrol 1:3.6.0-2ubuntu1
ProcVersionSign
Uname: Linux 5.4.0-31-generic x86_64
NonfreeKernelMo
ApportVersion: 2.20.11-0ubuntu27
Architecture: amd64
CasperMD5CheckR
CurrentDesktop: KDE
Date: Fri Jun 5 18:41:51 2020
InstallationDate: Installed on 2020-05-08 (28 days ago)
InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
PackageArchitec
SourcePackage: lm-sensors
UpgradeStatus: No upgrade log present (probably fresh install)
Related branches
- Sergio Durigan Junior (community): Approve
- Canonical Server: Pending requested
-
Diff: 44 lines (+19/-0)3 files modifieddebian/changelog (+7/-0)
debian/fancontrol-systemd-sleep (+10/-0)
debian/rules (+2/-0)
- Sergio Durigan Junior (community): Approve
- Canonical Server: Pending requested
-
Diff: 58 lines (+21/-1)4 files modifieddebian/changelog (+7/-0)
debian/control (+2/-1)
debian/fancontrol-systemd-sleep (+10/-0)
debian/rules (+2/-0)
Changed in lm-sensors (Ubuntu): | |
importance: | Undecided → Low |
Changed in lm-sensors (Debian): | |
status: | Unknown → New |
Changed in lmsensors: | |
status: | Unknown → New |
Changed in lm-sensors (Debian): | |
status: | New → Fix Released |
tags: | added: server-todo |
Changed in lm-sensors (Ubuntu Focal): | |
assignee: | nobody → Andreas Hasenack (ahasenack) |
status: | New → In Progress |
Changed in lm-sensors (Ubuntu Bionic): | |
assignee: | nobody → Andreas Hasenack (ahasenack) |
status: | New → In Progress |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
Changed in lm-sensors (Debian): | |
status: | Fix Released → New |
Bug filed in Debian in 2012 (!). There are comments in the Debian bug also suggesting a post-wakeup service restart, but I don't agree it's the correct solution unless there's a good reason for the service to stop before the system goes to sleep.