You are not logged in.
Pages: 1
Topic closed
Hi,
I used to hibernate my Samsung NP730U3E Laptop after 2 hours suspend time. Therefor the suspend-to-hibernate script from Power management with systemd is very useful.
But since pacman system update, perhaps systemd change to 227 is reasonable, the hibernate is not happen anymore. In journalctl i can find this line when hibernate gets triggered in suspend-to-hibernate.service:
Okt 25 22:09:46 sonstwo systemd[1]: Starting restart netctl-auto on resume....
Okt 25 22:09:46 sonstwo systemd-logind[369]: Operation finished.
Okt 25 22:09:46 sonstwo systemd[1]: Stopped target Suspend.
Okt 25 22:09:46 sonstwo systemd[1]: suspend.target: Unit is bound to inactive unit systemd-suspend.service. Stopping, too.
Okt 25 22:09:46 sonstwo systemd[1]: Reached target Suspend.
Okt 25 22:09:46 sonstwo systemd[1]: Stopped Delayed hibernation trigger.
Okt 25 22:09:46 sonstwo sh[1169]: Failed to hibernate system via logind: There's already a shutdown or sleep operation in progress
Okt 25 22:09:46 sonstwo sh[1169]: hibernate triggered
Okt 25 22:09:45 sonstwo systemd[1]: Stopping Delayed hibernation trigger...
Okt 25 22:09:45 sonstwo systemd[1]: suspend-to-hibernate.service: Unit not needed anymore. Stopping.
Okt 25 22:09:45 sonstwo systemd[1]: Stopped target Sleep.
Okt 25 22:09:45 sonstwo systemd[1]: sleep.target: Unit not needed anymore. Stopping.
Okt 25 22:09:45 sonstwo systemd[1]: Started Suspend.
Okt 25 22:09:45 sonstwo systemd-sleep[1041]: System resumed.
I already unsuccessfully tried to set my /etc/systemd/logind.conf back to default (all lines uncommented) and back to his settings enabled:
HandlePowerKey=ignore
HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore
Normal hibernate with systemctl hibernate works fine. I'm wondering which power action is still in place?
===
After deeper journal research i found the service was working before 2015/11/10.
Why is the trigger stopped before my service's echo hibernate triggered?
GOOD CASE journalctl -r
Okt 14 19:11:04 sonstwo systemd[1]: Stopped Delayed hibernation trigger.
Okt 11 22:54:39 sonstwo sh[5287]: hibernate triggered
Okt 11 22:54:39 sonstwo systemd[1]: Stopping Delayed hibernation trigger...
Okt 11 22:54:39 sonstwo systemd[1]: suspend-to-hibernate.service: Unit not needed anymore. Stopping.
Okt 11 20:54:37 sonstwo systemd[1]: Started Delayed hibernation trigger.
Okt 11 20:54:37 sonstwo sh[5156]: alarm set for 1444596877
Okt 11 20:54:37 sonstwo systemd[1]: Starting Delayed hibernation trigger...
BAD CASE journalctl -r
Okt 21 23:18:21 sonstwo sh[6903]: Failed to hibernate system via logind: There's already a shutdown or sleep operation in progress
Okt 21 23:18:21 sonstwo sh[6903]: hibernate triggered
Okt 21 23:18:21 sonstwo systemd[1]: Stopped Delayed hibernation trigger.
Okt 21 23:18:20 sonstwo systemd[1]: Stopping Delayed hibernation trigger...
Okt 21 23:18:20 sonstwo systemd[1]: suspend-to-hibernate.service: Unit not needed anymore. Stopping.
Okt 21 23:15:19 sonstwo systemd[1]: Started Delayed hibernation trigger.
Okt 21 23:15:19 sonstwo sh[6776]: alarm set for 1445462299
Okt 21 23:15:19 sonstwo systemd[1]: Starting Delayed hibernation trigger...
I appreciate your help! Thianks in advance.
Regards,
Dropedout
Last edited by dropedout (2015-11-02 20:46:32)
Offline
I have this problem a long time but yesterday I investigated it. You are right on time :-) This is because handling dependencies is incorrectly and the suspend.target stopping before our suspend-to-hibernate.service, which requires early. We need to change suspend.target and add the Requires=suspend-to-hibernate.service line in unit section to make it work. In order not to change the main file in /usr/lib/systemd/system we replace it in /etc/systemd/system. And we don't need to change /etc/systemd/logind.conf file. Sorry for my poor English.
Offline
Hi,
Thanks for this. Just got hit with the same issue, but I can confirm that adding Requires=suspend-to-hibernate.service to suspend.target fixes it. Can't pretend that I understand why though...
Thanks!
"Cared thou not, thou would have abstained." - Xyne
Offline
Hi Sheykhnur,
thanks for this hint. Your fix worked well for me too. I copied the suspend.target file from /usr/lib/systemd/system/ to the corresponding etc folder and edited it afterwards by adding the advised line. Hope this is the correct way.
Regards!
Offline
Updated arch wiki.
This can thread can be closed now.
Last edited by dropedout (2015-11-02 20:47:24)
Offline
Hi,
I had the same problem and fixed it by copying and suspend.target to /etc/systemd.system and adding Requires=suspend-to-hibernate.service but I have another problem now...
Lets say I set the timeout to 1 minute. My notebook suspends after I close the lid, after 1 minute it hibernates, perfect. But after another minute it wakes up and goes to sleep again, and again, and again... Every minute.
This is my service file:
[Unit]
Description=delayed hibernation trigger
Before=suspend.target
StopWhenUnneeded=true
[Service]
Type=oneshot
RemainAfterExit=yes
Environment="WAKEALARM=/sys/class/rtc/rtc0/wakealarm"
ExecStart=-/bin/sh -c 'echo -n "alarm set for "; date +%%s -d+1minute | tee $WAKEALARM'
ExecStop=-/bin/sh -c '\
alarm=$(cat $WAKEALARM); \
now=$(date +%%s); \
if [ -z "$alarm" ] || [ "$now" -ge "$alarm" ]; then \
echo "hibernate triggered"; \
systemctl hibernate; \
else \
echo "normal wakeup"; \
fi; \
echo 0 > $WAKEALARM; \
'
[Install]
WantedBy=sleep.target
and this the output of journalctl
Nov 03 22:24:00 x230 systemd[1]: Starting delayed hibernation trigger...
Nov 03 22:24:00 x230 sh[776]: alarm set for 1446589500
Nov 03 22:24:00 x230 systemd[1]: Started delayed hibernation trigger.
Nov 03 22:25:01 x230 systemd[1]: suspend-to-hibernate.service: Unit not needed anymore. Stopping.
Nov 03 22:25:01 x230 systemd[1]: Stopping delayed hibernation trigger...
Nov 03 22:25:01 x230 sh[826]: hibernate triggered
Nov 03 22:25:01 x230 systemd[1]: Starting delayed hibernation trigger...
Nov 03 22:25:01 x230 systemd[1]: Started delayed hibernation trigger.
Nov 03 22:25:01 x230 sh[836]: alarm set for 1446589561
Nov 03 22:26:11 x230 systemd[1]: suspend-to-hibernate.service: Unit not needed anymore. Stopping.
Nov 03 22:26:11 x230 systemd[1]: Stopping delayed hibernation trigger...
Nov 03 22:26:11 x230 sh[861]: hibernate triggered
Nov 03 22:26:11 x230 systemd[1]: Starting delayed hibernation trigger...
Nov 03 22:26:11 x230 sh[871]: alarm set for 1446589631
Nov 03 22:26:11 x230 systemd[1]: Started delayed hibernation trigger.
Nov 03 22:27:21 x230 systemd[1]: suspend-to-hibernate.service: Unit not needed anymore. Stopping.
Nov 03 22:27:21 x230 systemd[1]: Stopping delayed hibernation trigger...
Nov 03 22:27:21 x230 sh[892]: hibernate triggered
Nov 03 22:27:21 x230 systemd[1]: Starting delayed hibernation trigger...
Nov 03 22:27:21 x230 systemd[1]: Started delayed hibernation trigger.
Nov 03 22:27:21 x230 sh[909]: alarm set for 1446589701
Nov 03 22:27:45 x230 systemd[1]: suspend-to-hibernate.service: Unit not needed anymore. Stopping.
Nov 03 22:27:45 x230 systemd[1]: Stopping delayed hibernation trigger...
Nov 03 22:27:45 x230 sh[924]: normal wakeup
Nov 03 22:27:45 x230 systemd[1]: Stopped delayed hibernation trigger.
Last edited by burn (2015-11-03 21:39:10)
Offline
Hi burn,
why did you remove this line from unit section?
Conflicts=hibernate.target hybrid-suspend.target
Looks like the service is again triggered with hibernate.target.
Last edited by dropedout (2015-11-04 20:19:01)
Offline
Duh..... I feel so stupid now xD
I had copied the code from the other thread and not from the wiki. It works flawless with the "conflicts" line!
Thanks dropedout
Offline
This problem applies to scripts placed in /usr/lib/systemd/system-sleep/ as well, how should them be handled?
Offline
Also do not forget to enable Timer Wake with Battery Operation option in laptop (thinkpad in my case) BIOS https://superuser.com/a/749493/131522.
Last edited by mxl (2017-03-17 17:38:49)
Offline
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Pages: 1
Topic closed