Severity: normal
Tags: patch
Subject: thinkfan.service fails at boot on systems with asynchronous
hwmon drivers (amdgpu/coretemp) due to missing Restart policy
Description:
On modern laptops (such as AMD Ryzen APUs with amdgpu hwmon sensors),
the kernel
loads GPU and thermal monitoring modules asynchronously via udev during
boot.
Because thinkfan.service specifies:
After=sysinit.target
After=systemd-modules-load.service
thinkfan attempts to start before udev finishes creating the hwmon
nodes for
amdgpu (or discrete GPUs / certain coretemp sensors). If thinkfan.yaml
configures
the GPU sensor without 'optional: true', thinkfan exits immediately
with:
ERROR: hwmon sensor driver: /sys/class/hwmon: Could not find a
hwmon with this name: amdgpu
Because thinkfan.service does not define a restart policy, systemd
permanently
leaves the service in a failed state. The laptop fan reverts to
emergency BIOS/EC
control (running at full speed / 6500 RPM) indefinitely.
Expected behavior:
systemd should automatically retry starting thinkfan once the necessary
hwmon devices
have finished initializing.
Suggested fix:
Add a restart policy to /usr/lib/systemd/system/thinkfan.service:
[Service]
Restart=on-failure
RestartSec=3s
Optionally, adjust [Unit] dependencies to:
After=multi-user.target