Since upgrade, my laptop does not go to sleep when closing the lid

Since I upgraded my system, my laptop (Dell latitude 5500) often fails to go to sleep when I close the lid (I’m still trying to find a pattern since sometimes it works fine): when I open the lid again, I need to type my password (if the computer has not already ran out of battery), but I see that the battery has been drained way more than usual.

Any idea how to troubleshot this? I’m running KDE plasma, and the options to go to sleep mode are properly configured.

Here are some logs (21:12 is when is turned off my laptop (I actually turned it off first, then on, and my bluetooth reconnected, and off again), 22:40 when I turned it on again)

$ journalctl -e -n 10000
mars 26 21:12:46 bestos systemd-timesyncd[125629]: Disabling NSCD because DNSSEC validation is turned off
mars 26 21:12:46 bestos systemd[1]: Started Network Time Synchronization.
mars 26 21:12:46 bestos nm-dispatcher[125619]: Done!
mars 26 21:12:47 bestos kernel: input: JBL TUNE710BT (AVRCP) as /devices/virtual/input/input31
mars 26 21:12:47 bestos systemd-udevd[1124]: /nix/store/kkf7gy7w6h6xk1d7nvwnih8xbss1bjqq-udev-rules/99-local.rules:1 Invalid operator for TAGS.
mars 26 21:12:47 bestos systemd-logind[1566]: Watching system buttons on /dev/input/event20 (JBL TUNE710BT (AVRCP))
mars 26 21:12:47 bestos xserver-wrapper[1758]: (II) config/udev: Adding input device JBL TUNE710BT (AVRCP) (/dev/input/event20)
mars 26 21:12:47 bestos xserver-wrapper[1758]: (**) JBL TUNE710BT (AVRCP): Applying InputClass "Keyboard catchall"
mars 26 21:12:47 bestos xserver-wrapper[1758]: (**) JBL TUNE710BT (AVRCP): Applying InputClass "evdev keyboard catchall"
mars 26 21:12:47 bestos xserver-wrapper[1758]: (**) JBL TUNE710BT (AVRCP): Applying InputClass "libinput keyboard catchall"
mars 26 21:12:47 bestos xserver-wrapper[1758]: (II) Using input driver 'libinput' for 'JBL TUNE710BT (AVRCP)'
mars 26 21:12:47 bestos xserver-wrapper[1758]: (**) JBL TUNE710BT (AVRCP): always reports core events
mars 26 21:12:47 bestos xserver-wrapper[1758]: (**) Option "Device" "/dev/input/event20"
mars 26 21:12:47 bestos xserver-wrapper[1758]: (II) event20 - JBL TUNE710BT (AVRCP): is tagged by udev as: Keyboard
mars 26 21:12:47 bestos xserver-wrapper[1758]: (II) event20 - JBL TUNE710BT (AVRCP): device is a keyboard
mars 26 21:12:47 bestos xserver-wrapper[1758]: (II) event20 - JBL TUNE710BT (AVRCP): device removed
mars 26 21:12:47 bestos xserver-wrapper[1758]: (**) Option "config_info" "udev:/sys/devices/virtual/input/input31/event20"
mars 26 21:12:47 bestos xserver-wrapper[1758]: (II) XINPUT: Adding extended input device "JBL TUNE710BT (AVRCP)" (type: KEYBOARD, id 21)
mars 26 21:12:47 bestos xserver-wrapper[1758]: (**) Option "xkb_model" "pc104"
mars 26 21:12:47 bestos xserver-wrapper[1758]: (**) Option "xkb_layout" "fr"
mars 26 21:12:47 bestos xserver-wrapper[1758]: (**) Option "xkb_variant" "oss"
mars 26 21:12:47 bestos xserver-wrapper[1758]: (**) Option "xkb_options" "ctrl:swapcaps"
mars 26 21:12:47 bestos xserver-wrapper[1758]: (II) event20 - JBL TUNE710BT (AVRCP): is tagged by udev as: Keyboard
mars 26 21:12:47 bestos xserver-wrapper[1758]: (II) event20 - JBL TUNE710BT (AVRCP): device is a keyboard
mars 26 21:12:48 bestos kernel: Filesystems sync: 2.019 seconds
mars 26 21:12:48 bestos bluetoothd[1569]: src/profile.c:ext_io_disconnected() Unable to get io data for Hands-Free Voice gateway: getpeername: Transport endpoint is not connected (107)
mars 26 21:12:48 bestos xserver-wrapper[1758]: (II) event20 - JBL TUNE710BT (AVRCP): device removed
mars 26 22:40:27 bestos kernel: Freezing user space processes
mars 26 22:40:27 bestos kernel: Freezing user space processes completed (elapsed 0.002 seconds)
mars 26 22:40:27 bestos kernel: OOM killer disabled.
mars 26 22:40:27 bestos kernel: Freezing remaining freezable tasks
mars 26 22:40:27 bestos kernel: Freezing remaining freezable tasks completed (elapsed 0.000 seconds)
mars 26 22:40:27 bestos kernel: printk: Suspending console(s) (use no_console_suspend to debug)
mars 26 22:40:27 bestos kernel: e1000e: EEE TX LPI TIMER: 00000011
mars 26 22:40:27 bestos kernel: ACPI: EC: interrupt blocked
mars 26 22:40:27 bestos kernel: intel_pch_thermal 0000:00:12.0: CPU-PCH is cool [49C] after 24200 ms delay
mars 26 22:40:27 bestos kernel: ACPI: EC: interrupt unblocked
mars 26 22:40:27 bestos kernel: ata1: SATA link down (SStatus 4 SControl 300)
mars 26 22:40:27 bestos kernel: OOM killer enabled.
mars 26 22:40:27 bestos kernel: Restarting tasks ... 
mars 26 22:40:27 bestos kernel: mei_hdcp 0000:00:16.0-b638ab7e-94e2-4ea2-a552-d1c54b627f04: bound 0000:00:02.0 (ops i915_hdcp_ops [i915])
mars 26 22:40:27 bestos kernel: done.
mars 26 22:40:27 bestos kernel: random: crng reseeded on system resumption
mars 26 22:40:27 bestos zed[125326]: Exiting
mars 26 22:40:27 bestos systemd[1]: zfs-zed.service: Deactivated successfully.
mars 26 22:40:27 bestos cupsd[1746]: Subscription 3845 has expired...
mars 26 22:40:27 bestos systemd[1]: NetworkManager-dispatcher.service: Deactivated successfully.
mars 26 22:40:27 bestos dbus-daemon[1465]: [system] Rejected send message, 0 matched rules; type="method_return", sender=":1.61" (uid=1000 pid=2328 comm="/nix/store/nj6q57lrmq0kxpk3l2khmjrh15bwlql8-wirepl" lab>
mars 26 22:40:27 bestos xserver-wrapper[125642]: The XKEYBOARD keymap compiler (xkbcomp) reports:
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Symbol map for key <PRSC> redefined
mars 26 22:40:27 bestos xserver-wrapper[125642]: >                   Using last definition for conflicting fields
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Symbol map for key <PAUS> redefined
mars 26 22:40:27 bestos xserver-wrapper[125642]: >                   Using last definition for conflicting fields
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Symbol map for key <KPDV> redefined
mars 26 22:40:27 bestos xserver-wrapper[125642]: >                   Using last definition for conflicting fields
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Symbol map for key <KPMU> redefined
mars 26 22:40:27 bestos xserver-wrapper[125642]: >                   Using last definition for conflicting fields
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Symbol map for key <KPSU> redefined
mars 26 22:40:27 bestos xserver-wrapper[125642]: >                   Using last definition for conflicting fields
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Symbol map for key <KPAD> redefined
mars 26 22:40:27 bestos xserver-wrapper[125642]: >                   Using last definition for conflicting fields
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Could not resolve keysym XF86CameraAccessEnable
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Could not resolve keysym XF86CameraAccessDisable
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Could not resolve keysym XF86CameraAccessToggle
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Could not resolve keysym XF86NextElement
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Could not resolve keysym XF86PreviousElement
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Could not resolve keysym XF86AutopilotEngageToggle
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Could not resolve keysym XF86MarkWaypoint
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Could not resolve keysym XF86Sos
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Could not resolve keysym XF86NavChart
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Could not resolve keysym XF86FishingChart
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Could not resolve keysym XF86SingleRangeRadar
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Could not resolve keysym XF86DualRangeRadar
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Could not resolve keysym XF86RadarOverlay
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Could not resolve keysym XF86TraditionalSonar
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Could not resolve keysym XF86ClearvuSonar
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Could not resolve keysym XF86SidevuSonar
mars 26 22:40:27 bestos xserver-wrapper[125642]: > Warning:          Could not resolve keysym XF86NavInfo
mars 26 22:40:27 bestos xserver-wrapper[125642]: Errors from xkbcomp are not fatal to the X server
mars 26 22:40:27 bestos systemd[1]: Starting Refresh fwupd metadata and update motd...
mars 26 22:40:27 bestos kdeconnectd[2278]: org.kde.pulseaudio: No object for name "bluez_output.D8_AA_59_8A_34_85.1"
mars 26 22:40:27 bestos systemd[1]: Started Logrotate Service.
mars 26 22:40:27 bestos systemd[1]: Starting ZFS auto-snapshotting every 15 mins...
mars 26 22:40:27 bestos systemd[1]: Starting ZFS auto-snapshotting every hour...
mars 26 22:40:27 bestos systemd[1]: zfs-zed.service: Scheduled restart job, restart counter is at 14.
mars 26 22:40:27 bestos systemd-timesyncd[125629]: Network configuration changed, trying to establish connection.
mars 26 22:40:27 bestos systemd[1]: Started ZFS Event Daemon (zed).
mars 26 22:40:27 bestos zed[125654]: ZFS Event Daemon 2.2.3-1 (PID 125654)
mars 26 22:40:27 bestos zed[125654]: Processing events since eid=12
mars 26 22:40:27 bestos xserver-wrapper[1758]: (II) config/udev: removing device JBL TUNE710BT (AVRCP)
mars 26 22:40:27 bestos xserver-wrapper[1758]: (II) UnloadModule: "libinput"

I’ve started having lid/sleep regressions myself. I assumed it was a kernel bug.

What is your hardware/kernel? Mine is 6.6.19.

I just reopened my laptop today… ran out of battery again in the night, really annoying. But today I’ve a more helpful message that might be related (or not):

Failed to lock home directories: Unknown object '/org/freedesktop/home1'.

Full log:

mars 27 00:01:33 bestos systemd-logind[1566]: Lid closed.
mars 27 00:01:33 bestos systemd-logind[1566]: The system will suspend now!
mars 27 00:01:33 bestos ModemManager[2612]: <msg> [sleep-monitor-systemd] system is about to suspend
mars 27 00:01:33 bestos kded5[2211]: org.kde.plasma.nm.kded: Unhandled active connection state change:  3
mars 27 00:01:33 bestos dbus-daemon[1465]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.8' (uid=0 pid=1588 comm="/nix/store/vmrxihb4jw0hvpr4j5c91zbq0gc25gyx-networ" label="kernel")
mars 27 00:01:33 bestos systemd[1]: Starting Network Manager Script Dispatcher Service...
mars 27 00:01:33 bestos wpa_supplicant[1761]: wlo1: CTRL-EVENT-SIGNAL-CHANGE above=0 signal=-60 noise=9999 txrate=144400
mars 27 00:01:33 bestos dbus-daemon[1465]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
mars 27 00:01:33 bestos systemd[1]: Started Network Manager Script Dispatcher Service.
mars 27 00:01:33 bestos kernel: wlo1: deauthenticating from 68:02:b8:06:55:02 by local choice (Reason: 3=DEAUTH_LEAVING)
mars 27 00:01:33 bestos ksmserver[258723]: Qt: Session management error: networkIdsList argument is NULL
mars 27 00:01:33 bestos wpa_supplicant[1761]: wlo1: CTRL-EVENT-DISCONNECTED bssid=YY:YY:YY:YY:YY:YY reason=3 locally_generated=1
mars 27 00:01:33 bestos wpa_supplicant[1761]: wlo1: CTRL-EVENT-DSCP-POLICY clear_all
mars 27 00:01:33 bestos wpa_supplicant[1761]: wlo1: CTRL-EVENT-SIGNAL-CHANGE above=0 signal=-9999 noise=9999 txrate=0
mars 27 00:01:33 bestos avahi-daemon[1462]: Withdrawing address record for XXXX::XXXX::XXXX:XXXX on wlo1.
mars 27 00:01:33 bestos avahi-daemon[1462]: Interface wlo1.IPv4 no longer relevant for mDNS.
mars 27 00:01:33 bestos avahi-daemon[1462]: Leaving mDNS multicast group on interface wlo1.IPv4 with address 192.168.X.X.
mars 27 00:01:33 bestos avahi-daemon[1462]: Withdrawing address record for 192.168.X.X on wlo1.
mars 27 00:01:33 bestos avahi-daemon[1462]: Joining mDNS multicast group on interface wlo1.IPv4 with address 192.168.X.X.
mars 27 00:01:33 bestos avahi-daemon[1462]: New relevant interface wlo1.IPv4 for mDNS.
mars 27 00:01:33 bestos avahi-daemon[1462]: Registering new address record for 192.168.X.X on wlo1.IPv4.
mars 27 00:01:33 bestos systemd[1]: Stopped target Host and Network Name Lookups.
mars 27 00:01:33 bestos systemd[1]: Stopping Host and Network Name Lookups...
mars 27 00:01:33 bestos systemd[1]: Stopped target User and Group Name Lookups.
mars 27 00:01:33 bestos systemd[1]: Stopping User and Group Name Lookups...
mars 27 00:01:33 bestos systemd[1]: Stopping Name Service Cache Daemon (nsncd)...
mars 27 00:01:33 bestos systemd[1]: nscd.service: Deactivated successfully.
mars 27 00:01:33 bestos avahi-daemon[1462]: Got SIGHUP, reloading.
mars 27 00:01:33 bestos avahi-daemon[1462]: No service file found in /etc/avahi/services.
mars 27 00:01:33 bestos avahi-daemon[1462]: Withdrawing address record for 192.168.X.X on wlo1.
mars 27 00:01:33 bestos avahi-daemon[1462]: Leaving mDNS multicast group on interface wlo1.IPv4 with address 192.168.X.X.
mars 27 00:01:33 bestos avahi-daemon[1462]: Interface wlo1.IPv4 no longer relevant for mDNS.
mars 27 00:01:33 bestos systemd[1]: Stopped Name Service Cache Daemon (nsncd).
mars 27 00:01:33 bestos systemd[1]: nscd.service: Consumed 175ms CPU time, received 14.5K IP traffic, sent 8.6K IP traffic.
mars 27 00:01:33 bestos systemd[1]: Starting Name Service Cache Daemon (nsncd)...
mars 27 00:01:33 bestos nsncd[258810]: Mar 27 03:01:33.883 INFO started, config: Config { ignored_request_types: {}, worker_count: 8, handoff_timeout: 3s }, path: "/var/run/nscd/socket"
mars 27 00:01:33 bestos systemd[1]: Started Name Service Cache Daemon (nsncd).
mars 27 00:01:33 bestos systemd[1]: Reached target Host and Network Name Lookups.
mars 27 00:01:33 bestos systemd[1]: Reached target User and Group Name Lookups.
mars 27 00:01:33 bestos systemd[1]: Stopping Network Time Synchronization...
mars 27 00:01:33 bestos systemd[1]: systemd-timesyncd.service: Deactivated successfully.
mars 27 00:01:33 bestos systemd[1]: Stopped Network Time Synchronization.
mars 27 00:01:33 bestos systemd[1]: systemd-timesyncd.service: Consumed 82ms CPU time, received 425B IP traffic, sent 306B IP traffic.
mars 27 00:01:33 bestos systemd[1]: Starting Network Time Synchronization...
mars 27 00:01:33 bestos wpa_supplicant[1761]: p2p-dev-wlo1: CTRL-EVENT-DSCP-POLICY clear_all
mars 27 00:01:33 bestos wpa_supplicant[1761]: p2p-dev-wlo1: CTRL-EVENT-DSCP-POLICY clear_all
mars 27 00:01:33 bestos wpa_supplicant[1761]: nl80211: deinit ifname=p2p-dev-wlo1 disabled_11b_rates=0
mars 27 00:01:33 bestos wpa_supplicant[1761]: wlo1: CTRL-EVENT-DSCP-POLICY clear_all
mars 27 00:01:33 bestos wpa_supplicant[1761]: wlo1: CTRL-EVENT-DSCP-POLICY clear_all
mars 27 00:01:33 bestos wpa_supplicant[1761]: nl80211: deinit ifname=wlo1 disabled_11b_rates=0
mars 27 00:01:34 bestos systemd-timesyncd[258830]: Disabling NSCD because DNSSEC validation is turned off
mars 27 00:01:34 bestos systemd[1]: Started Network Time Synchronization.
mars 27 00:01:34 bestos nm-dispatcher[258822]: Done!
mars 27 00:01:34 bestos ksmserver[258723]: kf.kirigami: Failed to find a Kirigami platform plugin
mars 27 00:01:34 bestos ksmserver[258723]: qml: The backend got an unknown wallpaper provider type. The wallpaper will now fall back to the default. Please check your wallpaper configuration!
mars 27 00:01:34 bestos ksmserver[258723]: libpng warning: iCCP: known incorrect sRGB profile
mars 27 00:01:34 bestos ksmserver[258723]: qml: The backend got an unknown wallpaper provider type. The wallpaper will now fall back to the default. Please check your wallpaper configuration!
mars 27 00:01:34 bestos systemd[1]: Starting Pre-Sleep Actions...
mars 27 00:01:34 bestos systemd[1]: pre-sleep.service: Deactivated successfully.
mars 27 00:01:34 bestos systemd[1]: Finished Pre-Sleep Actions.
mars 27 00:01:34 bestos systemd[1]: Reached target Sleep.
mars 27 00:01:34 bestos systemd[1]: Starting System Suspend...
mars 27 00:01:34 bestos systemd-sleep[258844]: Failed to lock home directories: Unknown object '/org/freedesktop/home1'.
mars 27 00:01:34 bestos kernel: PM: suspend entry (s2idle)
mars 27 00:01:34 bestos systemd-sleep[258844]: Performing sleep operation 'suspend'...

Seems like we are not the only ones, and apparently it is fixed upstream in systemd:

https://bbs.archlinux.org/viewtopic.php?id=291408

Ok, so the PRs that closes suspend and hibernate does not longer work · Issue #29938 · systemd/systemd · GitHub seems to solve the issue.

I submitted a NixOs bug in Upgrade systemd to fix sleep mode issue · Issue #299464 · NixOS/nixpkgs · GitHub

Any idea how to fix this locally in the meantime? Can I just apply an overlay of systemd with an updated src field?

So I tried to do:

            (final: prev: {
              # systemd is buggy https://github.com/NixOS/nixpkgs/issues/299464
              systemd = (import inputs.nixpkgs-23-11 {inherit system;}).systemd;
            })

but it is not working as I get an error:

       error: function 'anonymous lambda' called with unexpected argument 'withIptables'

       at /nix/store/h947mznq84fnw1igj3jgyisswqfma0hi-source/pkgs/os-specific/linux/systemd/default.nix:3:1:

            2|
            3| { stdenv
             | ^
            4| , lib

I’m now trying:

          nixpkgs.overlays = [
            # inputs.nix-software-center.overlays.pkgs
            (final: prev: {
              # systemd is buggy https://github.com/NixOS/nixpkgs/issues/299464
              systemd = prev.systemd.overrideAttrs (finalAttrs: previousAttrs: {
                version = "255.4";
                src = pkgs.fetchFromGitHub {
                  owner = "systemd";
                  repo = "systemd-stable";
                  rev = "v255.4";
                  hash = "sha256-P1mKq+ythrv8MU7y2CuNtEx6qCDacugzfsPRZL+NPys=";
                };
              });
            })
          ];

but I’m a bit worried as the mkDerivation contains other occurences of src that rely on a version defined before in a let close.

Whoo, it is rebuilding the world, downloading 31G of data, including postgresql etc… I’m quite surprised, why is this the case?

Ok, just did instead:

systemd.package = (import inputs.nixpkgs-23-11 {inherit system;}).systemd;

(I’m using flake to pin the good nixpkgs version via nixpkgs-23-11.url = "nixpkgs/nixos-23.11"; in my inputs)

and now it does not recompile the world, and I could reboot successfully. I’ll check if this solves the issue!

Update: Seems like the above fix is not working (at least I experienced once again this issue), so maybe the version packed in stable is also buggy.

I tried instead

          systemd.package = pkgs.systemd.overrideAttrs (finalAttrs: previousAttrs: {
              version = "255.4";
              src = pkgs.fetchFromGitHub {
                owner = "systemd";
                repo = "systemd-stable";
                rev = "v255.4";
                hash = "sha256-P1mKq+ythrv8MU7y2CuNtEx6qCDacugzfsPRZL+NPys=";
              };
            });

and so far it seems to work… lets’s hope it will continue!

Uhm, sadly it does not solve the problem, as someone suggested here

I put the full log here, if it rings a Bell I’d be curious to hear it Upgrade systemd to fix sleep mode issue · Issue #299464 · NixOS/nixpkgs · GitHub

Definitely not solved, yet another fail:

mars 29 00:00:34 bestos systemd-logind[1694]: Lid closed.
mars 29 00:00:34 bestos systemd-logind[1694]: The system will suspend now!
mars 29 00:00:34 bestos ModemManager[2758]: <msg> [sleep-monitor-systemd] system is about to suspend
mars 29 00:00:34 bestos dbus-daemon[1589]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.7' (uid=0 pid=1700 co>
mars 29 00:00:34 bestos kded5[2344]: org.kde.plasma.nm.kded: Unhandled active connection state change:  3
mars 29 00:00:34 bestos systemd[1]: Starting Network Manager Script Dispatcher Service...
mars 29 00:00:34 bestos dbus-daemon[1589]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
mars 29 00:00:35 bestos systemd[1]: Started Network Manager Script Dispatcher Service.
mars 29 00:00:35 bestos kernel: wlo1: deauthenticating from 68:02:b8:06:54:fd by local choice (Reason: 3=DEAUTH_LEAVING)
mars 29 00:00:35 bestos wpa_supplicant[1835]: wlo1: CTRL-EVENT-DISCONNECTED bssid=68:02:b8:06:54:fd reason=3 locally_generated=1
mars 29 00:00:35 bestos wpa_supplicant[1835]: wlo1: CTRL-EVENT-DSCP-POLICY clear_all
mars 29 00:00:35 bestos wpa_supplicant[1835]: wlo1: CTRL-EVENT-SIGNAL-CHANGE above=0 signal=-9999 noise=9999 txrate=0
mars 29 00:00:35 bestos avahi-daemon[1585]: Withdrawing address record for fe80::deb9:164a:c086:4afa on wlo1.
mars 29 00:00:35 bestos avahi-daemon[1585]: Interface wlo1.IPv4 no longer relevant for mDNS.
mars 29 00:00:35 bestos avahi-daemon[1585]: Leaving mDNS multicast group on interface wlo1.IPv4 with address 192.168.178.150.
mars 29 00:00:35 bestos avahi-daemon[1585]: Withdrawing address record for 192.168.178.150 on wlo1.
mars 29 00:00:35 bestos avahi-daemon[1585]: Joining mDNS multicast group on interface wlo1.IPv4 with address 192.168.178.150.
mars 29 00:00:35 bestos avahi-daemon[1585]: New relevant interface wlo1.IPv4 for mDNS.
mars 29 00:00:35 bestos avahi-daemon[1585]: Registering new address record for 192.168.178.150 on wlo1.IPv4.
mars 29 00:00:35 bestos systemd[1]: Stopped target Host and Network Name Lookups.
mars 29 00:00:35 bestos systemd[1]: Stopping Host and Network Name Lookups...
mars 29 00:00:35 bestos systemd[1]: Stopped target User and Group Name Lookups.
mars 29 00:00:35 bestos systemd[1]: Stopping User and Group Name Lookups...
mars 29 00:00:35 bestos systemd[1]: Stopping Name Service Cache Daemon (nsncd)...
mars 29 00:00:35 bestos systemd[1]: nscd.service: Deactivated successfully.
mars 29 00:00:35 bestos systemd[1]: Stopped Name Service Cache Daemon (nsncd).
mars 29 00:00:35 bestos systemd[1]: nscd.service: Consumed 15.023s CPU time, received 1.1M IP traffic, sent 653.4K IP traffic.
mars 29 00:00:35 bestos avahi-daemon[1585]: Got SIGHUP, reloading.
mars 29 00:00:35 bestos avahi-daemon[1585]: No service file found in /etc/avahi/services.
mars 29 00:00:35 bestos avahi-daemon[1585]: Withdrawing address record for 192.168.178.150 on wlo1.
mars 29 00:00:35 bestos avahi-daemon[1585]: Leaving mDNS multicast group on interface wlo1.IPv4 with address 192.168.178.150.
mars 29 00:00:35 bestos avahi-daemon[1585]: Interface wlo1.IPv4 no longer relevant for mDNS.
mars 29 00:00:35 bestos systemd[1]: Starting Name Service Cache Daemon (nsncd)...
mars 29 00:00:35 bestos nsncd[123073]: Mar 29 03:00:35.161 INFO started, config: Config { ignored_request_types: {}, worker_count: 8, handoff_timeout: 3s }, path: "/var/run/nscd/socket"
mars 29 00:00:35 bestos systemd[1]: Started Name Service Cache Daemon (nsncd).
mars 29 00:00:35 bestos systemd[1]: Reached target Host and Network Name Lookups.
mars 29 00:00:35 bestos systemd[1]: Reached target User and Group Name Lookups.
mars 29 00:00:35 bestos systemd[1]: Stopping Network Time Synchronization...
mars 29 00:00:35 bestos systemd[1]: systemd-timesyncd.service: Deactivated successfully.
mars 29 00:00:35 bestos wpa_supplicant[1835]: p2p-dev-wlo1: CTRL-EVENT-DSCP-POLICY clear_all
mars 29 00:00:35 bestos wpa_supplicant[1835]: p2p-dev-wlo1: CTRL-EVENT-DSCP-POLICY clear_all
mars 29 00:00:35 bestos wpa_supplicant[1835]: nl80211: deinit ifname=p2p-dev-wlo1 disabled_11b_rates=0
mars 29 00:00:35 bestos systemd[1]: Stopped Network Time Synchronization.
mars 29 00:00:35 bestos systemd[1]: systemd-timesyncd.service: Consumed 101ms CPU time, received 577B IP traffic, sent 458B IP traffic.
mars 29 00:00:35 bestos wpa_supplicant[1835]: wlo1: CTRL-EVENT-DSCP-POLICY clear_all
mars 29 00:00:35 bestos systemd[1]: Starting Network Time Synchronization...
mars 29 00:00:35 bestos wpa_supplicant[1835]: wlo1: CTRL-EVENT-DSCP-POLICY clear_all
mars 29 00:00:35 bestos wpa_supplicant[1835]: nl80211: deinit ifname=wlo1 disabled_11b_rates=0
mars 29 00:00:35 bestos systemd-timesyncd[123103]: Disabling NSCD because DNSSEC validation is turned off
mars 29 00:00:35 bestos systemd[1]: Started Network Time Synchronization.
mars 29 00:00:35 bestos nm-dispatcher[123092]: Done!
mars 29 00:00:35 bestos ksmserver[123032]: Qt: Session management error: networkIdsList argument is NULL
mars 29 00:00:36 bestos ksmserver[123032]: kf.kirigami: Failed to find a Kirigami platform plugin
mars 29 00:00:36 bestos ksmserver[123032]: qml: The backend got an unknown wallpaper provider type. The wallpaper will now fall back to the default. Please check your wallpaper configuration!
mars 29 00:00:36 bestos ksmserver[123032]: libpng warning: iCCP: known incorrect sRGB profile
mars 29 00:00:36 bestos ksmserver[123032]: qml: The backend got an unknown wallpaper provider type. The wallpaper will now fall back to the default. Please check your wallpaper configuration!
mars 29 00:00:36 bestos systemd[1]: Starting Pre-Sleep Actions...
mars 29 00:00:36 bestos systemd[1]: pre-sleep.service: Deactivated successfully.
mars 29 00:00:36 bestos systemd[1]: Finished Pre-Sleep Actions.
mars 29 00:00:36 bestos systemd[1]: Reached target Sleep.
mars 29 00:00:36 bestos systemd[1]: Starting System Suspend...
mars 29 00:00:36 bestos systemd-sleep[123132]: Performing sleep operation 'suspend'...
mars 29 00:00:36 bestos kernel: PM: suspend entry (s2idle)
mars 29 00:00:36 bestos plasmashell[2381]: qt.qpa.clipboard: QXcbClipboard::setMimeData: Cannot set X11 selection owner
mars 29 00:00:36 bestos plasmashell[2381]: qt.qpa.clipboard: QXcbClipboard::setMimeData: Cannot set X11 selection owner
mars 29 00:00:38 bestos cupsd[1911]: Printer "25_26_103_MFP_LIP6_color_cups" stopped by "root".
mars 29 00:00:38 bestos cupsd[1911]: REQUEST localhost - root "POST /admin/ HTTP/1.1" 200 215 Pause-Printer successful-ok
mars 29 00:00:41 bestos kernel: Filesystems sync: 4.705 seconds


mars 29 09:18:10 bestos kernel: Freezing user space processes
mars 29 09:18:10 bestos kernel: Freezing user space processes completed (elapsed 0.011 seconds)
mars 29 09:18:10 bestos kernel: OOM killer disabled.

Yet another bug, this time on 6.1… Next step is 5.9… but first I’m starting to wonder if it is not ZFS and/or related to https://www.kernel.org/doc/Documentation/power/states.txt. I indeed always see avril 02 21:13:03 bestos kernel: PM: suspend entry (s2idle) while I would like to go into deep mode. Now I need to find what is triguering s2idle mode instead of deep mode (the braket is currently used mode)…

$ cat /sys/power/mem_sleep
[s2idle] deep
$ sudo su
root@bestos:/home/me/ > echo "deep" > /sys/power/mem_sleep
root@bestos:/home/me/ > cat /sys/power/mem_sleep      
s2idle [deep]

Hum…

EDIT
Seems like doing both:

root@bestos:/home/leo/ > echo "deep" > /sys/power/mem_sleep
root@bestos:/home/leo/ > cat /sys/power/state
freeze mem
root@bestos:/home/leo/ > echo "mem" > /sys/power/state
# system immediately goes to deep sleep mode

forced my system to go (directly) to the deep mode:

avril 02 23:17:16 bestos kernel: PM: suspend entry (deep)

EDIT2

Might be related to nixos-hardware/dell/xps/13-9370 at master · NixOS/nixos-hardware · GitHub

The laptop uses the S2 sleep mode by default instead of S3, which leads to draining a lot of battery during sleep.

Though this is intentional by the manufacturer and might cause lockups when forced I - @moredread - never had any issues with it.

See Dell XPS 13 (9370) - ArchWiki and 199689 – s2idle does not work in Dell XPS 9370 for reference

I just tried boot.kernelParams = [ "mem_sleep_default=deep" ]; as recommended in both links above, let’s see!

This is really interesting Power management/Suspend and hibernate - ArchWiki Long story short : S2Idle is supposed to be the “modern” way to put the computer in sleep mode, but it might drain battery more (for instance, in Windows they can use network while being in sleep mode… hence the battery drains faster). The deep mode completely powers off the component but the RAM, hence is more battery friendly, but apparently some manufacturers stop fixing bugs there as they advertise the s2idle mode.

Ok, so I tried to add

boot.kernelParams = [ "mem_sleep_default=deep" ];

and after a reboot, the system goes to deep mode:

avril 03 00:31:06 bestos kernel: PM: suspend entry (deep)

Dell seems to slowly disable deep mode at the firmware level, so on more modern laptops this might not work, in which case it seems to quite fundamentally drain battery (apparently Windows wants a more phone-like experience on laptops, where we can receive messages/emails even when in sleep mode…):

The S3 deep sleep mode is not available on the XPS 13 9310. This is by design.

When using a Dell Ubuntu image, the battery discharge issue was resolved with kernel update to 5.8. However, there will be some amount of battery discharge due to the Connected / Modern Standby feature. If there are any issues with battery draining with the Dell Ubuntu image, reply to the private messages sent to you by the DELL-Cares agent on your unique case number with the Service Tag, issue, etc.

which is the official Dell answer to this issue https://www.dell.com/community/en/conversations/xps/xps-13-9310-ubuntu-deep-sleep-missing/647f8daff4ccf8a8dee4f308?page=3 Some people here reported fixes when enabling AHCI drive instead of RAID in BIOS.

What I don’t undersand, yet, is why sometimes the battery drains like 20% a night, and why sometimes it’s 100%… Anyway, hopefully the above fix works!

Arggg, I really thought it would work this time… but got again a 18% drop of battery in the night. What’s weird is that all messages about putting CPU offline etc… arrive after the system wakes up, and I don’t know if it is normal/a bug/just that the messages are being written too late.

avril 03 01:17:47 bestos systemd[1]: pre-sleep.service: Deactivated successfully.
avril 03 01:17:47 bestos systemd[1]: Finished Pre-Sleep Actions.
avril 03 01:17:47 bestos systemd[1]: Reached target Sleep.
avril 03 01:17:47 bestos systemd[1]: Starting System Suspend...
avril 03 01:17:47 bestos systemd-sleep[9833]: Performing sleep operation 'suspend'...
avril 03 01:17:47 bestos kernel: PM: suspend entry (deep)
avril 03 01:17:47 bestos plasmashell[2486]: qt.qpa.clipboard: QXcbClipboard::setMimeData: Cannot set X11 selection owner
avril 03 01:17:48 bestos kernel: Filesystems sync: 0.839 seconds

avril 03 10:03:27 bestos kernel: Freezing user space processes
avril 03 10:03:27 bestos kernel: Freezing user space processes completed (elapsed 0.002 seconds)
avril 03 10:03:27 bestos kernel: OOM killer disabled.
avril 03 10:03:27 bestos kernel: Freezing remaining freezable tasks
avril 03 10:03:27 bestos kernel: Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
avril 03 10:03:27 bestos kernel: printk: Suspending console(s) (use no_console_suspend to debug)
avril 03 10:03:27 bestos kernel: e1000e: EEE TX LPI TIMER: 00000011
avril 03 10:03:27 bestos kernel: ACPI: EC: interrupt blocked
avril 03 10:03:27 bestos kernel: ACPI: PM: Preparing to enter system sleep state S3
avril 03 10:03:27 bestos kernel: ACPI: EC: event blocked
avril 03 10:03:27 bestos kernel: ACPI: EC: EC stopped
avril 03 10:03:27 bestos kernel: ACPI: PM: Saving platform NVS memory
avril 03 10:03:27 bestos kernel: Disabling non-boot CPUs ...
avril 03 10:03:27 bestos kernel: smpboot: CPU 1 is now offline
avril 03 10:03:27 bestos kernel: smpboot: CPU 2 is now offline
avril 03 10:03:27 bestos kernel: smpboot: CPU 3 is now offline
avril 03 10:03:27 bestos kernel: smpboot: CPU 4 is now offline
avril 03 10:03:27 bestos kernel: smpboot: CPU 5 is now offline
avril 03 10:03:27 bestos kernel: smpboot: CPU 6 is now offline
avril 03 10:03:27 bestos kernel: smpboot: CPU 7 is now offline
avril 03 10:03:27 bestos kernel: ACPI: PM: Low-level resume complete
avril 03 10:03:27 bestos kernel: ACPI: EC: EC started
avril 03 10:03:27 bestos kernel: ACPI: PM: Restoring platform NVS memory
avril 03 10:03:27 bestos kernel: Enabling non-boot CPUs ...
avril 03 10:03:27 bestos kernel: x86: Booting SMP configuration:
avril 03 10:03:27 bestos kernel: smpboot: Booting Node 0 Processor 1 APIC 0x2
avril 03 10:03:27 bestos kernel: CPU1 is up
avril 03 10:03:27 bestos kernel: smpboot: Booting Node 0 Processor 2 APIC 0x4
avril 03 10:03:27 bestos kernel: CPU2 is up