zcfan icon indicating copy to clipboard operation
zcfan copied to clipboard

Fan keeps running during suspend

Open samwilson opened this issue 11 months ago • 3 comments

I have a ThinkPad X1 Carbon Gen 12 and with zcfan everything is working great — until I suspend the laptop. Then, the fan kicks into high speed and stays there. I thought perhaps it was related to being on AC vs battery, but that doesn't make any difference.

When I wake it up again, the fan speed returns to normal.

I think the fan is supposed to keep running for a short time when suspending, to cool things down more quickly, but that shouldn't take too long. On my old X1 Carbon it was never more than about 10 seconds, and that was only if it was very hot.

It looks like thinkfan has a similar problem: https://github.com/vmatare/thinkfan/issues/247

My current workaround is to turn off the zcfan service before suspending.

samwilson avatar Jan 06 '25 08:01 samwilson

We don't generically know anything about going into suspend, only resuming from it. That's more a platform limitation than anything else. When using external tools one can tell some programs in advance that they are going to sleep, but these solutions exist purely in software and as signalling.

What suspend state are you going into? Does a deeper state resolve it?

cdown avatar Jan 06 '25 10:01 cdown

That said, I guess we could stop on sleep.target in the shipped systemd unit template, or have an optional DBus subscription to org.freedesktop.login1.Manager's PrepareForSleep. None of these are foolproof, but they probably cover at least 80% of the cases.

cdown avatar Jan 06 '25 10:01 cdown

What suspend state are you going into? Does a deeper state resolve it?

I'm not sure, but it's just suspend, not hibernate (that doesn't seem to be available as an option).

I guess we could stop on sleep.target in the shipped systemd unit template

Not that I know much, but that sounds like it'd work! Without the zcfan service running, the fans currently run for a short while after entering suspend, so I assume that'd still happen.

samwilson avatar Jan 08 '25 05:01 samwilson

Wouldn't it be useful to include zcfan-sleep.service and zc-resume.service files much like thinkfan here?

vevais avatar Mar 28 '25 11:03 vevais

Please have a test of 3efa99b97a8c72819a95ab5e8e561f158454aeb6 and let me know how it goes. Thanks!

cdown avatar Apr 10 '25 14:04 cdown

Thanks for the swift commit! I've compiled it and it works for me; I can hear it switch to bios/auto when suspended, which will then eventually stop. It then resumed as intended. Thanks! 👍

#systemctl status zcfan-sleep

Apr 22 14:26:56 lucy systemd[1]: Starting Notify zcfan of imminent sleep... Apr 22 14:26:57 lucy systemd[1]: zcfan-sleep.service: Deactivated successfully. Apr 22 14:26:57 lucy systemd[1]: Finished Notify zcfan of imminent sleep. Apr 22 14:28:57 lucy systemd[1]: Starting Notify zcfan of imminent sleep... Apr 22 14:28:58 lucy systemd[1]: zcfan-sleep.service: Deactivated successfully. Apr 22 14:28:58 lucy systemd[1]: Finished Notify zcfan of imminent sleep. Apr 22 14:36:44 lucy systemd[1]: Starting Notify zcfan of imminent sleep... Apr 22 14:36:45 lucy systemd[1]: zcfan-sleep.service: Deactivated successfully. Apr 22 14:36:45 lucy systemd[1]: Finished Notify zcfan of imminent sleep.

#systemctl status zcfan-resume

Apr 22 14:28:14 lucy systemd[1]: Starting Reload zcfan after waking up from suspend... Apr 22 14:28:15 lucy systemd[1]: zcfan-resume.service: Deactivated successfully. Apr 22 14:28:15 lucy systemd[1]: Finished Reload zcfan after waking up from suspend. Apr 22 14:33:25 lucy systemd[1]: Starting Reload zcfan after waking up from suspend... Apr 22 14:33:26 lucy systemd[1]: zcfan-resume.service: Deactivated successfully. Apr 22 14:33:26 lucy systemd[1]: Finished Reload zcfan after waking up from suspend. Apr 22 14:37:09 lucy systemd[1]: Starting Reload zcfan after waking up from suspend... Apr 22 14:37:09 lucy systemd[1]: zcfan-resume.service: Deactivated successfully. Apr 22 14:37:09 lucy systemd[1]: Finished Reload zcfan after waking up from suspend.

vevais avatar Apr 22 '25 12:04 vevais

Great! Closed in fdd95531ebd5fa5bc3fa93ccee261a7edc754ed7 to go out next release then :) Thanks for checking.

cdown avatar Apr 23 '25 18:04 cdown