Welcome!
Forum users
  • Please read this before asking for help, and don't forget to add Quick System Info to help requests!
  • Please follow the Forum Rules

Current releases
--MX-19.4 release info here
--Migration information to MX-19.4 here
--antiX-19.4 (Grup Yorum) release info here

Important information
-- Spectre and Meltdown vulnerabilities

News
-- MX Linux on social media: here
-- New Forum Features, Marking Solved and Referencing a User: here

Hibernation & hybrid-sleep in MX 19 & how I got them working

Message
Author
User avatar
Stevo
Developer
Posts: 23422
Joined: Fri Dec 15, 2006 8:07 pm

Hibernation & hybrid-sleep in MX 19 & how I got them working

#1 Post by Stevo »

For hibernation (suspend to disk), I've found it necessary to first run

Code: Select all

sudo dpkg-reconfigure uswsusp
and then just hit "Next" to accept its default settings. This seems to write the location of the swap partition to the initramfs file, and gets hibernation working after a reboot. Contrary to what the MX installer says, the RAM is compressed by a factor of maybe three times by default before it's written to the disk file, so swap doesn't necessarily have to be the same size as physical RAM. Compressing RAM beforehand actually speeds up the hiberfile write and read process, too.

The hybrid sleep button is currently broken, but I can do it from the terminal with "sudo s2both", and maybe there's other commands that do the same thing. Hybrid sleep first writes a hibernation file to disk, then suspends to RAM. If the machine loses power in that sleep state, it would then later be able to resume from the hibernation file instead of RAM, and nothing would be lost. If no power outage occurs, it just quickly resumes from RAM.

Maybe we can get the hybrid sleep button working, since I ended up having it visible due to preserving my home during the MX 18 to 19 upgrade.

User avatar
Horaciomed
Posts: 1
Joined: Thu Nov 07, 2019 7:23 am

Re: Hibernation & hybrid-sleep in MX 19 & how I got them working

#2 Post by Horaciomed »

Is setting up the hybrid sleep button technically challenging?

User avatar
Stevo
Developer
Posts: 23422
Joined: Fri Dec 15, 2006 8:07 pm

Re: Hibernation & hybrid-sleep in MX 19 & how I got them working

#3 Post by Stevo »

I still don't have the button working--I don't know what command it's passing to the OS. Do you have both suspend to RAM and hibernation working well separately first?

XFCE 4.14 had the hybrid sleep button by default, and MX did something to hide it on fresh installs. I'm pretty sure dolphin_oracle was involved in that, so he'd be the one to ask.

I can see hybrid sleep being a belt-and-suspenders type of thing if you put your machine in that mode overnight.

User avatar
m_pav
Developer
Posts: 3324
Joined: Sun Aug 06, 2006 3:02 pm

Re: Hibernation & hybrid-sleep in MX 19 & how I got them working

#4 Post by m_pav »

Nice find Stevo :rock:
Stevo wrote: Fri Nov 08, 2019 3:41 pm I still don't have the button working--I don't know what command it's passing to the OS.
I set my power manager to ask when each PM event button is pressed and tried the power button on T560 laptop after running the following;
watch "dmesg |tail -25" into a terminal

It brought up "systemd-logind" as the command sent to the OS, so I wonder if you can use that to discover what yours sends. I tried it with tail -f /var/log/dmesg but as no kernel messages are captured, nothing was printed to the display, hence the old faithful watch command.
Mike P

Regd Linux User #472293
(Mine)Lenovo T560, i7-6600U, 16GB, 2.0TB SSD, MX19_ahs
(Desktop) Asus M4A88TD-M, AMD Phenom II x4 955 CPU, nVidia GF610, 8Gb, 500GB+320GB, MX19
(Wifes)Lenovo T440s i5 4300u 12GB 240GB SSD MX19

User avatar
andyprough
MX Packager
Posts: 1009
Joined: Tue Jul 23, 2019 10:16 pm

Re: Hibernation & hybrid-sleep in MX 19 & how I got them working

#5 Post by andyprough »

Thanks for this Stevo. I simply made a panel launcher that brings up and runs "sudo s2both" in a terminal. Good enough for me. Save to disk and save to RAM are both definitely working on my MX19 64-bit machine.

I found a cute sleeping penguin I'm using for the launcher button icon.
You do not have the required permissions to view the files attached to this post.
Primary Computer - Commodore 64: Processor - MOS 6510/8500, 1.023MHz; Memory - 64kb RAM, 20kB ROM - 8k BASIC V2, 8k Kernel, 4k Character ROM; Display output - 320x200, 16 colours; OS - BASIC V2.0; Weight: 1.8kg

User avatar
oops
Posts: 1373
Joined: Tue Apr 10, 2018 5:07 pm

Re: Hibernation & hybrid-sleep in MX 19 & how I got them working

#6 Post by oops »

FI: Hybrid Sleep via dbus

Code: Select all

Hybrid Sleep (suspend + hibernate):
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.HybridSleep  boolean:true
Seen here:
https://www.linuxquestions.org/question ... ost6008833

Code: Select all

Shut down:
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop

Restart:
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart

Suspend:
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Suspend  boolean:true

Hibernate (suspend to disk):
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Hibernate  boolean:true

Hybrid Sleep (suspend + hibernate):
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.HybridSleep  boolean:true
Edit: I just tried it and it works, but I needed to be root. I assume that is because of this (from the link above):
Quote:
This method assumes that you are given permission to shut the system down via PolicyKit. The default group for this is wheel. To change this, edit /etc/polkit-1/localauthority.conf.d/50-localauthority.conf as root.
... And for one computer I had to mofify the UUID resume device into: /etc/uswsusp.conf

Code: Select all

sudo dpkg-reconfigure uswsusp
cat /etc/uswsusp.conf
# and add via mx-boot-options:
resume=UUID=swap-value-xxxxxxxx other-option=value quiet
( parameter: "acpi_sleep=s4_nohwsig" can help too, to restore after hibernate)

# and:
sudo update-initramfs -u -k all

... and at resume hibernation times the keys: Alt+SysRq+K (if the process stop)
Last edited by oops on Tue Jun 30, 2020 8:39 pm, edited 4 times in total.
$ quick-system-info-mx or inxi -zv8 : System: MX-19_x64 & antiX19_x32

User avatar
pevin96
Posts: 3
Joined: Fri Nov 22, 2019 11:14 am

Re: Hibernation & hybrid-sleep in MX 19 & how I got them working

#7 Post by pevin96 »

Thank you, the command is working, from now I can hibernate my system :happy:

User avatar
nikapos
Posts: 1
Joined: Tue Jan 28, 2020 10:43 am

Re: Hibernation & hybrid-sleep in MX 19 & how I got them working

#8 Post by nikapos »

after struggling with hibernation with swapfile i gave up and tried with swap partition and worked like a charm... moreover i assigned "systemctl hibernate" to the calculator key and now the pc goes to hibernation with the press of a button. mind you, i had to use systemd to do that,,

User avatar
oops
Posts: 1373
Joined: Tue Apr 10, 2018 5:07 pm

Re: Hibernation & hybrid-sleep in MX 19 & how I got them working

#9 Post by oops »

andyprough wrote: Sat Nov 09, 2019 2:05 am Thanks for this Stevo. I simply made a panel launcher that brings up and runs "sudo s2both" in a terminal. Good enough for me. Save to disk and save to RAM are both definitely working on my MX19 64-bit machine.

I found a cute sleeping penguin I'm using for the launcher button icon.
FI: I used yad and the Moka icons for that:
viewtopic.php?f=143&t=58930&start=20
Image

Image

My yad config mx-exit-custom.sh , tooltips in French (with i3lock and 8 Moca action *.png icons 64x64 into /usr/bin/

Code: Select all

#!/bin/bash
yad --width=250 --height=30 --mouse --on-top --borders=3 --skip-taskbar --timeout=10 \
	--buttons-layout=center \
	--button="<span font='Monospace'></span>!/usr/bin/system-log-out.png!LightDM_écran_démarrage:dm-tool switch-to-greeter" \
	--button="<span font='Monospace'></span>!/usr/bin/system-lock-screen1.png!Verrou_écran_i3lock:i3lock -c 000000" \
    --button="<span font='Monospace'></span>!/usr/bin/system-sleep.png!Veille_PC_pm-suspend:sudo 'pm-suspend' " \
--button="L<span font='Monospace'></span>!/usr/bin/system-sleep.png!Veille_PC_i3lock+pm-suspend:sh -c 'i3lock -c 000000 && sleep 3s && sudo pm-suspend' " \
	--button="<span font='Monospace'></span>!/usr/bin/system-suspend.png!Hibernation_PC_pm-hibernate:sudo 'pm-hibernate' " \
    --button="<span font='Monospace'></span>!/usr/bin/system-restart.png!Redémarrer_PC_sudo_init_6_ou_reboot:sudo reboot" \
    --button="<span font='Monospace'></span>!/usr/bin/system-shutdown.png!Éteinde_PC_sudo_init_0_ou_poweroff:sudo poweroff" \
    --text "EXIT auto. dans 10s: Pour changer de session utilisateur: Ctrl-Alt-F7/F8/F9" \
exit 0
You do not have the required permissions to view the files attached to this post.
$ quick-system-info-mx or inxi -zv8 : System: MX-19_x64 & antiX19_x32

User avatar
gsm
Posts: 122
Joined: Wed Dec 19, 2018 10:16 am

Re: Hibernation & hybrid-sleep in MX 19 & how I got them working

#10 Post by gsm »

I can simply add a sleep button to the commands of the Menu (Properties of the Whisker Menu button).
Also i can add action buttons to the XFCE panel and activate the Sleep button and other buttons.
With MX Tweak (Configuration Options), the Sleep button can be added to the Logout menu.
When using the systemd kernel, it works.
After the power was off the system is resumed. Looks to me like hibernation.
When booting the systemd kernel there is no need to first run the command "sudo dpkg-reconfigure uswusp" and to use "sudo s2both" for sleep.

The command for the Sleep button is:

Code: Select all

xfce4-session-logout --hibernate

Post Reply

Return to “General”