After upgrade laptop is heating up and high battery drain while lid closed

After the upgrade my laptop is heating up and battery is draining a lot while the lid is closed , i know its not suspending properly but i don’t know the exact problem

macaoi@nix:~/ > journalctl -b | grep -i suspend | head -40
Mar 05 22:25:44 nix kernel: Low-power S0 idle used by default for system suspend
Mar 05 22:25:44 nix kernel: nvme 0000:05:00.0: platform quirk: setting simple suspend
Mar 05 22:25:55 nix xserver-wrapper[1390]: (II) AIGLX: Suspending AIGLX clients for VT switch
Mar 05 22:26:26 nix systemd-logind[988]: Suspending...
Mar 05 22:26:27 nix systemd[1]: Starting System Suspend...
Mar 05 22:26:27 nix systemd-sleep[2184]: Performing sleep operation 'suspend'...
Mar 05 22:26:27 nix kernel: PM: suspend entry (s2idle)
Mar 05 22:26:32 nix kernel: printk: Suspending console(s) (use no_console_suspend to debug)
Mar 05 22:26:32 nix kernel: queueing ieee80211 work while going to suspend
Mar 05 22:26:32 nix kernel: amd_pmc AMDI0007:00: Last suspend didn't reach deepest state
Mar 05 22:26:32 nix systemd-sleep[2184]: System returned from sleep operation 'suspend'.
Mar 05 22:26:32 nix kernel: PM: suspend exit
Mar 05 22:26:32 nix systemd[1]: systemd-suspend.service: Deactivated successfully.
Mar 05 22:26:32 nix systemd[1]: Finished System Suspend.
Mar 05 22:26:32 nix systemd[1]: Reached target Suspend.
Mar 05 22:26:32 nix systemd[1]: Stopped target Suspend.
Mar 05 22:26:32 nix systemd-logind[988]: Operation 'suspend' finished.
Mar 05 22:26:57 nix systemd-logind[988]: Suspending...
Mar 05 22:26:58 nix systemd[1]: Starting System Suspend...
Mar 05 22:26:58 nix systemd-sleep[2521]: Performing sleep operation 'suspend'...
Mar 05 22:26:58 nix kernel: PM: suspend entry (s2idle)
Mar 05 22:27:03 nix kernel: printk: Suspending console(s) (use no_console_suspend to debug)
Mar 05 22:27:03 nix kernel: queueing ieee80211 work while going to suspend
Mar 05 22:27:03 nix kernel: amd_pmc AMDI0007:00: Last suspend didn't reach deepest state
Mar 05 22:27:03 nix systemd-sleep[2521]: System returned from sleep operation 'suspend'.
Mar 05 22:27:03 nix kernel: PM: suspend exit
Mar 05 22:27:03 nix systemd[1]: systemd-suspend.service: Deactivated successfully.
Mar 05 22:27:03 nix systemd[1]: Finished System Suspend.
Mar 05 22:27:03 nix systemd[1]: Reached target Suspend.
Mar 05 22:27:03 nix systemd[1]: Stopped target Suspend.
Mar 05 22:27:03 nix systemd-logind[988]: Operation 'suspend' finished.
Mar 05 22:27:28 nix systemd-logind[988]: Suspending...
Mar 05 22:27:29 nix systemd[1]: Starting System Suspend...
Mar 05 22:27:29 nix systemd-sleep[2807]: Performing sleep operation 'suspend'...
Mar 05 22:27:29 nix kernel: PM: suspend entry (s2idle)
Mar 05 22:27:34 nix kernel: printk: Suspending console(s) (use no_console_suspend to debug)
Mar 05 22:27:34 nix kernel: queueing ieee80211 work while going to suspend
Mar 05 22:27:34 nix kernel: amd_pmc AMDI0007:00: Last suspend didn't reach deepest state
Mar 05 22:27:34 nix systemd-sleep[2807]: System returned from sleep operation 'suspend'.
Mar 05 22:27:34 nix kernel: PM: suspend exit
macaoi@nix:~/ > journalctl -b | grep -i suspend | tail -40
Mar 05 22:59:46 nix systemd-sleep[20788]: Performing sleep operation 'suspend'...
Mar 05 22:59:46 nix kernel: PM: suspend entry (s2idle)
Mar 05 22:59:51 nix kernel: printk: Suspending console(s) (use no_console_suspend to debug)
Mar 05 22:59:51 nix kernel: queueing ieee80211 work while going to suspend
Mar 05 22:59:51 nix kernel: amd_pmc AMDI0007:00: Last suspend didn't reach deepest state
Mar 05 22:59:51 nix systemd-sleep[20788]: System returned from sleep operation 'suspend'.
Mar 05 22:59:51 nix systemd[1]: systemd-suspend.service: Deactivated successfully.
Mar 05 22:59:51 nix systemd[1]: Finished System Suspend.
Mar 05 22:59:51 nix systemd[1]: Reached target Suspend.
Mar 05 22:59:51 nix systemd[1]: Stopped target Suspend.
Mar 05 22:59:51 nix kernel: PM: suspend exit
Mar 05 22:59:51 nix systemd-logind[988]: Operation 'suspend' finished.
Mar 05 23:00:16 nix systemd-logind[988]: Suspending...
Mar 05 23:00:17 nix systemd[1]: Starting System Suspend...
Mar 05 23:00:17 nix systemd-sleep[21082]: Performing sleep operation 'suspend'...
Mar 05 23:00:17 nix kernel: PM: suspend entry (s2idle)
Mar 05 23:00:22 nix kernel: printk: Suspending console(s) (use no_console_suspend to debug)
Mar 05 23:00:22 nix kernel: queueing ieee80211 work while going to suspend
Mar 05 23:00:22 nix kernel: amd_pmc AMDI0007:00: Last suspend didn't reach deepest state
Mar 05 23:00:22 nix systemd-sleep[21082]: System returned from sleep operation 'suspend'.
Mar 05 23:00:22 nix systemd[1]: systemd-suspend.service: Deactivated successfully.
Mar 05 23:00:22 nix systemd[1]: Finished System Suspend.
Mar 05 23:00:22 nix systemd[1]: Reached target Suspend.
Mar 05 23:00:22 nix systemd[1]: Stopped target Suspend.
Mar 05 23:00:22 nix kernel: PM: suspend exit
Mar 05 23:00:22 nix systemd-logind[988]: Operation 'suspend' finished.
Mar 05 23:00:47 nix systemd-logind[988]: Suspending...
Mar 05 23:00:47 nix systemd[1]: Starting System Suspend...
Mar 05 23:00:47 nix systemd-sleep[21365]: Performing sleep operation 'suspend'...
Mar 05 23:00:47 nix kernel: PM: suspend entry (s2idle)
Mar 05 23:00:53 nix kernel: printk: Suspending console(s) (use no_console_suspend to debug)
Mar 05 23:00:53 nix kernel: queueing ieee80211 work while going to suspend
Mar 05 23:00:53 nix kernel: amd_pmc AMDI0007:00: Last suspend didn't reach deepest state
Mar 05 23:00:53 nix systemd-sleep[21365]: System returned from sleep operation 'suspend'.
Mar 05 23:00:53 nix kernel: PM: suspend exit
Mar 05 23:00:53 nix systemd[1]: systemd-suspend.service: Deactivated successfully.
Mar 05 23:00:53 nix systemd[1]: Finished System Suspend.
Mar 05 23:00:53 nix systemd[1]: Reached target Suspend.
Mar 05 23:00:53 nix systemd[1]: Stopped target Suspend.
Mar 05 23:00:53 nix systemd-logind[988]: Operation 'suspend' finished.
macaoi@nix:~/ >

Can you suspend resume with

echo 1 | sudo tee /sys/power/pm_debug_messages

It will enable debug power management logging. I suspect something is preventing from your system entering its desired suspend state. Either S3 or s0ix, more likely the latter. For a system to enter s0ix all devices must be able to enter d3cold. On my current laptop s0ix was blocked by an SSD which couldn’t enter d3cold but only d3hot.

Explanation:

We kinda recognize system power states, its not 100% correct these days but:

  1. S0 - full power on
  2. S1 - no idea, not important
  3. S2 - lowest power state the kernel can achieve by itself tradionally
  4. S3 - traditional BIOS assisted suspend
  5. S4 - hibernate? Idk
  6. S5 - power off

The linux kernel will by default go to S3 when that’s available, some newer intel CPUs however don’t have S3, instead they have s0ix which is S2 with some hardware cooperation. It allows instant suspend resume, at least theoretically and it’s actually derived from how Intel Apple Macs used to work. If your laptop doesn’t support S3, it has to go to s0ix or the battery will drain very quickly.

For linux to enter s0ix it has to be able to put all USB, PCI, SATA… devices into a lowe enough power state. For me it was a NVME SSD which couldn’t enter d3cold (which is the required power state) due to a hardware bug. The power states are d0, d1, d2, d3hot, d3cold and then idk.

This info is mostly from How to achieve S0ix states in Linux* which is not up anymore, but luckily archive.org exists. Feel free to read that page and gain more insight.

Good luck

Also experiencing this. I think it’s this bug introduced in kernel version 6.18.14, supposed to be fixed in 6.18.16 which NixOS will have shortly.