Suspend-then-hibernate when laptop lid is closed


Objective: when closing my laptop lid (on battery), I would like my system to suspend-then-hibernate

Running systemctl suspend-then-hibernate works like a charm (followed Power management - ArchWiki)

Still following the archwiki (Power management - ArchWiki) I uncommented HandleLidSwitch and set it to HandelLidSwitch=suspend-then-hibernate in /etc/systemd/logind.conf. Then I ran systemctl kill -s HUP systemd-logind to apply changes. Also rebooted just to be sure.

But it seems that kde plasma’s power management tool overrides systemd settings… Or something else, because it doesn’t work (I set a timeout to 60sec for hibernating so I can test it). I thought that the config files in /etc/systemd/* override any program’s own config? see systemd-sleep.conf(5) — Arch manual pages

So if anybody has an idea as to why it’s not working… :slight_smile:

Just in case:

$ inxi -Fazy
  Kernel: 5.10.2-2-MANJARO x86_64 bits: 64 compiler: gcc v: 10.2.0 
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.10-x86_64 
  root=UUID=c9136c9f-47f5-4078-8d4c-af348b4a9581 rw quiet udev.log_priority=3 
  threadirqs resume=/dev/disk/by-uuid/c9136c9f-47f5-4078-8d4c-af348b4a9581 
  Desktop: KDE Plasma 5.20.4 tk: Qt 5.15.2 wm: kwin_x11 dm: SDDM 
  Distro: Manjaro Linux 
  Type: Laptop System: LENOVO product: 24295F3 v: ThinkPad T530 
  serial: <filter> Chassis: type: 10 serial: <filter> 
  Mobo: LENOVO model: 24295F3 serial: <filter> UEFI [Legacy]: LENOVO 
  v: G4ET93WW (2.53 ) date: 02/22/2013 
  ID-1: BAT0 charge: 67.5 Wh condition: 73.9/86.6 Wh (85%) volts: 12.1/11.1 
  model: LGC 45N1011 type: Li-ion serial: <filter> status: Discharging 
  Device-1: hidpp_battery_0 model: Logitech Wireless Mouse M315/M235 
  serial: <filter> charge: 100% (should be ignored) rechargeable: yes 
  status: Discharging 
  Info: Quad Core model: Intel Core i7-3840QM bits: 64 type: MT MCP 
  arch: Ivy Bridge family: 6 model-id: 3A (58) stepping: 9 microcode: 21 
  L2 cache: 8 MiB 
  flags: avx lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 44719 
  Speed: 1339 MHz min/max: 1200/3800 MHz Core speeds (MHz): 1: 1339 2: 1220 
  3: 1516 4: 1464 5: 1491 6: 1510 7: 1221 8: 1198 
  Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled 
  Type: l1tf 
  mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable 
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable 
  Type: meltdown mitigation: PTI 
  Type: spec_store_bypass 
  mitigation: Speculative Store Bypass disabled via prctl and seccomp 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional, 
  IBRS_FW, STIBP: conditional, RSB filling 
  Type: srbds status: Vulnerable: No microcode 
  Type: tsx_async_abort status: Not affected 
  Device-1: Intel 3rd Gen Core processor Graphics vendor: Lenovo driver: i915 
  v: kernel bus ID: 00:02.0 chip ID: 8086:0166 
  Device-2: Acer ThinkPad Integrated Camera type: USB driver: uvcvideo 
  bus ID: 1-1.6:6 chip ID: 5986:02d2 
  Display: x11 server: X.Org 1.20.10 compositor: kwin_x11 driver: intel 
  unloaded: modesetting alternate: fbdev,vesa display ID: :0 screens: 1 
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2") 
  s-diag: 582mm (22.9") 
  Monitor-1: LVDS1 res: 1920x1080 hz: 60 dpi: 143 size: 340x190mm (13.4x7.5") 
  diag: 389mm (15.3") 
  OpenGL: renderer: Mesa DRI Intel HD Graphics 4000 (IVB GT2) 
  v: 4.2 Mesa 20.3.1 compat-v: 3.0 direct render: Yes 
  Device-1: Intel 7 Series/C216 Family High Definition Audio vendor: Lenovo 
  driver: snd_hda_intel v: kernel bus ID: 00:1b.0 chip ID: 8086:1e20 
  Sound Server: ALSA v: k5.10.2-2-MANJARO 
  Device-1: Intel 82579LM Gigabit Network vendor: Lenovo driver: e1000e 
  v: kernel port: 5080 bus ID: 00:19.0 chip ID: 8086:1502 
  IF: enp0s25 state: down mac: <filter> 
  Device-2: Intel Centrino Advanced-N 6205 [Taylor Peak] driver: iwlwifi 
  v: kernel port: efa0 bus ID: 03:00.0 chip ID: 8086:0085 
  IF: wlp3s0 state: up mac: <filter> 
  Device-3: Ericsson Business Mobile Networks BV H5321 gw Mobile Broadband 
  type: USB driver: cdc_acm,cdc_mbim,cdc_wdm bus ID: 3-4:3 chip ID: 0bdb:1926 
  serial: <filter> 
  IF: wwp0s20u4i6 state: down mac: <filter> 
  Local Storage: total: 489.05 GiB used: 141.73 GiB (29.0%) 
  SMART Message: Unable to run smartctl. Root privileges required. 
  ID-1: /dev/sda maj-min: 8:0 vendor: Crucial model: CT525MX300SSD1 
  size: 489.05 GiB block size: physical: 512 B logical: 512 B speed: 6.0 Gb/s 
  serial: <filter> rev: R060 
  ID-1: / raw size: 100 GiB size: 97.93 GiB (97.93%) used: 24.3 GiB (24.8%) 
  fs: ext4 dev: /dev/sda5 maj-min: 8:5 
  ID-2: /home raw size: 375.19 GiB size: 294.29 GiB (78.44%) 
  used: 117.43 GiB (39.9%) fs: ext4 dev: /dev/sda6 maj-min: 8:6 
  Kernel: swappiness: 60 (default) cache pressure: 100 (default) 
  ID-1: swap-1 type: file size: 8 GiB used: 0 KiB (0.0%) priority: -2 
  file: /swapfile 
  System Temperatures: cpu: 49.0 C mobo: 0.0 C 
  Fan Speeds (RPM): cpu: 1977 
  Processes: 254 Uptime: 18m wakeups: 6 Memory: 15.34 GiB 
  used: 2.39 GiB (15.6%) Init: systemd v: 247 Compilers: gcc: 10.2.0 Packages: 
  pacman: 1445 lib: 476 Shell: Bash v: 5.1.0 running in: konsole inxi: 3.2.01

Ok so I found a solution thanks to

[Solved] By creating a symlink from systemd-suspend-then-hibernate to systemd-suspend you can force suspend-then-hibernate to happen instead of plain old suspend

# ln -s /usr/lib/systemd/system/systemd-suspend-then-hibernate.service /etc/systemd/system/systemd-suspend.service

And by modifying /etc/systemd/sleep.conf you can adjust the delay before hibernate.

It now works as expected :slight_smile:

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.