The officially official Devuan Forum!

You are not logged in.

#1 2020-04-21 20:50:23

scjorge
Member
Registered: 2020-04-21
Posts: 6  

how to get hibernation?

hello devuan-community!
I am happy to enrich my life with my first devuan-device!
so far I am enjoying it a lot, just one thing is missing for me: HIBERNATION!

how can I get it working?

Offline

#2 2020-04-21 22:49:28

Marjorie
Member
From: Teignmouth, UK
Registered: 2019-06-09
Posts: 219  

Re: how to get hibernation?

On my desktop I use pm-hibernate. which is part of the pm-tools package. I find this gives me gives me more control (you can run before-sleep and after-sleep scripts) than the hibernate that comes as part of the 'log out' chooser built into Cinnamon.

On ASCII pm-hibernate worked for me with the default in-kernel power management option, now I've upgraded to Beowulf I find I need to use the alternative user-space SLEEP_MODULE="uswsusp" option to get it to work.

What works for you may also depend on your hardware.

Offline

#3 2020-04-22 05:31:13

scjorge
Member
Registered: 2020-04-21
Posts: 6  

Re: how to get hibernation?

oh, thanxs!
I was hesitant about installing the pm-packages (I somehow thought they where related to init-non-freedom... I wkll read more on the subject). 

So I will give pm-hibernate a try and inform if it worked on my hardware.

Offline

#4 2020-04-22 06:21:19

scjorge
Member
Registered: 2020-04-21
Posts: 6  

Re: how to get hibernation?

Marjorie wrote:

... use pm-hibernate. which is part of the pm-tools package...

On Beowulf I find I need to use the alternative user-space SLEEP_MODULE="uswsusp" option to get it to work.

What works for you may also depend on your hardware.

oh, it didn't work. the command finishes without any output...

# pm-hibernate
#

i tried both with and without the config-file

Offline

#5 2020-04-22 07:54:18

Marjorie
Member
From: Teignmouth, UK
Registered: 2019-06-09
Posts: 219  

Re: how to get hibernation?

Are you running it as root?

# sudo pm-hibernate

I run it as a drop down option on my desktop, so have added it to my sudoers file so I don't need to ask for my password.

Offline

#6 2020-04-22 10:46:35

scjorge
Member
Registered: 2020-04-21
Posts: 6  

Re: how to get hibernation?

Marjorie wrote:

Are you running it as root?

# sudo pm-hibernate

I run it as a drop down option on my desktop, so have added it to my sudoers file so I don't need to ask for my password.

yes, as rooot.

I did:

$ su
# pm-hibernate

and less than a second later the su-command-line appeared:

#

Offline

#7 2020-04-22 12:36:25

Marjorie
Member
From: Teignmouth, UK
Registered: 2019-06-09
Posts: 219  

Re: how to get hibernation?

Sorry I previously mentioned pm-tools package. Of course that is pm-utils, but I guess you found that anyway.

I presume pm-suspend is also not working for you?

You should check /var/log/pm-suspend.log to see if it tells you anything about why it's not running (the log is common to both suspend and to hibernate). If its not there then something is very amiss.

Last edited by Marjorie (2020-04-22 12:36:44)

Offline

#8 2020-04-22 17:32:16

scjorge
Member
Registered: 2020-04-21
Posts: 6  

Re: how to get hibernation?

Marjorie wrote:

Sorry I previously mentioned pm-tools package. Of course that is pm-utils, but I guess you found that anyway.

I presume pm-suspend is also not working for you?

You should check /var/log/pm-suspend.log to see if it tells you anything about why it's not running (the log is common to both suspend and to hibernate). If its not there then something is very amiss.

yes, I knew it was pm-utils wink

and there is no pm-suspend.log file in my system ...

EDIT:

for completion I tried

# pm-suspend

and it kind of worked! surprising!
and now there is a pm-powersave.log and pm-suspend.log under /var/log/

I have to mention that I also installed the "hibernate" package in the past. could this be interfering?

Offline

#9 2020-04-22 20:14:47

Marjorie
Member
From: Teignmouth, UK
Registered: 2019-06-09
Posts: 219  

Re: how to get hibernation?

Great - we have progress.

You haven't said what your setup is. On mine I could get suspend (pm-suspend) working on both ASCII and Beowulf but, by default, hibernate (pm-hibernate) didn't work on Beowulf.

There is a 'hibernate' option on my standard logout, which I think uses upower, however it doesn't work on Beowulf. It did work and didn't interfere on my ASCII installation.

Anyway on Beowulf I fixed pm-hibernate by installing the uspsusp package, which provides user space rather than kernel hibernation and then configured pm-utils to use it.

Have a look in your /etc/pm/config.d/defaults file. Mine looks like this:

##########################################################
# DO NOT EDIT THE FILE in /usr/lib/pm-utils/             #
#                                                        #
# Edit this in /etc/pm/config.d/ instead!                #
##########################################################

# Default method to power down the system when hibernating.
# If commented out, the system will use the kernel default as a 
# default value.
#
# Check /sys/power/disk for valid values.  The default value
# will be surrounded by [square brackets].
HIBERNATE_MODE="platform"

# Whether we need to post the video card when resuming from
# hibernate. You should not normally need to set this.  
# In the future pm-utils will get this setting from HAL.
#
# Valid values are "no" and "yes"
# HIBERNATE_RESUME_POST_VIDEO="no"

# The default sleep/wake system to use.  Valid values are:
#   kernel    The built-in kernel suspend/resume support.
#             Use this if nothing else is supported on your system.
#   uswsusp   If your system has support for the userspace
#             suspend programs (s2ram/s2disk/s2both), then use this.
#   tuxonice  If your system has support for tuxonice, use this.
#
# The system defaults to "kernel" if this is commented out.
SLEEP_MODULE="uswsusp"

# These variables will be handled specially when we load files in 
# /etc/pm/config.d.
# Multiple declarations of these environment variables will result in 
# their contents being concatenated instead of being overwritten.

# If you need to unload any modules to suspend/resume, add them here.
SUSPEND_MODULES="ath9k ath9k_common ath9k_hw ath"

# If you want to keep hooks from running, add their names here.
# HOOK_BLACKLIST=""

# If you want to unconditionally add parameters to the commandline,
# add them here.
# ADD_PARAMETERS=""

# If you want to ignore commandline parameters, add them here.
# DROP_PARAMETERS=""

# If you need to synchronize the system clock across a suspend/resume or
# hibernate/thaw cycle, set this variable.
# NEED_CLOCK_SYNC="true"

In line 30 I've uncommented SLEEP_MODULE="uswsusp", which means that it now uses uwsusp rather than the kernel. I've left everything else as is, apart from lower down, where I unload my atheros wifi drivers as they refuse to power down when asked: however this is not needed to make hibernate work, even on my setup. Elsewhere I've also added a call to load a login screesaver, which does increase security a bit on resume. If you get hibernate working I'll tell you how to do this.

Lets see if that works better.

If not you may want to look at alternatives to HIBERNATE_MODE="platform" and/or install and try tuxonice as an alternative to uspsusp.

Offline

#10 2020-08-04 12:35:33

scjorge
Member
Registered: 2020-04-21
Posts: 6  

Re: how to get hibernation?

hello again, and sorry for the late reply! other projects have taken away my time...

very useful hints! thanks for the help!

I tried tuxonice, but w/o success...

it seems that my system has no hibernation-module available (how could I confirm this?) this is the system:

https://leste.maemo.org/Motorola_Droid_4

smile it's experimental but worth it!

I kind of vaguely remember trying to install the uswsusp/uspsusp package but not being able to find it for the Droid4... this seems to be connected to a hibernation-module in the kernel, right? or is it just about the devices repositories?

I don't know anything about compiling kernels (yet!), but, if I do learn, will it be possible to compile it for that device with the "hibernation-module/functionality" activated? or is it another module? another technique?

how can I get hibernation? i love hibernation smile

... I don't have my device handy, so I can't post more information for now...

Last edited by scjorge (2020-08-04 12:44:58)

Offline

#11 2020-10-03 06:46:13

Danielsan
Member
Registered: 2020-07-14
Posts: 172  

Re: how to get hibernation?

Cool, I have completely forgot about pm-utils and uswsusp, those were the default tools before the era of systemd...

Offline

#12 2020-10-03 08:32:57

GlennW
Member
From: Brisbane, Australia
Registered: 2019-07-18
Posts: 582  

Re: how to get hibernation?

scjorge wrote:
Marjorie wrote:

Are you running it as root?

# sudo pm-hibernate

I run it as a drop down option on my desktop, so have added it to my sudoers file so I don't need to ask for my password.

yes, as rooot.

I did:

$ su
# pm-hibernate

and less than a second later the su-command-line appeared:

#

Hi, when you "su" to root you need "su -" instead.

This may help you, I hope so.

Regards Glenn


pic from 1993, new guitar day.

Offline

#13 2020-10-03 15:26:57

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: how to get hibernation?

How about

# echo disk > /sys/power/state

EDIT: see also https://www.kernel.org/doc/Documentatio … states.txt

Last edited by Head_on_a_Stick (2020-10-03 15:27:37)


Brianna Ghey — Rest In Power

Offline

#14 2020-10-03 16:05:13

Marjorie
Member
From: Teignmouth, UK
Registered: 2019-06-09
Posts: 219  

Re: how to get hibernation?

scjorge wrote:

I kind of vaguely remember trying to install the uswsusp/uspsusp package but not being able to find it for the Droid4... this seems to be connected to a hibernation-module in the kernel, right? or is it just about the devices repositories?

I don't know anything about compiling kernels (yet!), but, if I do learn, will it be possible to compile it for that device with the "hibernation-module/functionality" activated? or is it another module? another technique?

how can I get hibernation? i love hibernation smile

You can achieve hibernation either through kernel mode, which requires the appropriate kernel module, or in userspace, using uswsusp or tuxonice.

If your device https://leste.maemo.org/Motorola_Droid_4 lacks both kernel support (available kernels don't have the appropriate kernel module) and you don't have the package uswsusp in your sources then I think that means that you would have to compile one or the other to get hibernation (though even then it could be possible that your hardware lacks the appropriate hooks to make it work).

NB. Just as an update on my earlier posts I do now have hibernate running using kernel mode on Beowulf on my (pretty ordinary) AMD64 hardware, though I also still use pm-hibernate to call it as I have a few things I want to invoke in the pre-sleep and post-wake scripts.

You also need to have a resume=UUID=your.swap.drive.UUID (or similar) command in the linux vmlinux line in your grub menuentry. This tells the kernel where to store/restore your memory image.

Last edited by Marjorie (2020-10-03 16:18:58)

Offline

#15 2020-10-03 18:36:31

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: how to get hibernation?

For already built-in automagic options...

man loginctl

...or...

loginctl --help

I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

#16 2020-10-04 19:23:43

kapqa
Member
Registered: 2019-01-02
Posts: 324  

Re: how to get hibernation?

hello ,

i am also having problems with hibernate on lenovo t400 and devuan beowulf. if remember correctly it functioned on ascii.

suspend works (although not when closing laptop lid, but when evoked manually through dedicated keyboard combination or when typing "sudo pm-suspend").

hibernation however, fails.

sudo hibernate

does not go full hibernation (does not count the per-cents of progress) and from black screen resumes to active state with message

hibernate:Warning: Tuxonice binary signature file not found.
sudo pm-hibernate

also seems to go hibernation mode, but then resumes to normal with no terminal output whatsoever.

EDIT: tried also other suggestion

 echo disk > /sys/power/state
-bash: echo: write error: No space left on device

Last edited by kapqa (2020-10-04 19:26:41)

Offline

#17 2020-10-04 20:02:48

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: how to get hibernation?

Hmm, can we see

cat /sys/power/state /proc/swaps
free -h

You did run my suggested command from a root prompt, right?


Brianna Ghey — Rest In Power

Offline

#18 2020-10-06 01:35:57

kapqa
Member
Registered: 2019-01-02
Posts: 324  

Re: how to get hibernation?

sorry, but i don§t remember if root or sudo, but i think was after "su -"

cat /sys/power/state /proc/swaps
freeze mem disk
Filename				Type		Size	Used	Priority
/swapfile                               file		262140	0	-2
root@devuan:~# free -h
              total        used        free      shared  buff/cache   available
Mem:          2.8Gi       491Mi       1.8Gi        85Mi       601Mi       2.1Gi
Swap:         255Mi          0B       255Mi

Offline

#19 2020-10-06 01:39:22

kapqa
Member
Registered: 2019-01-02
Posts: 324  

Re: how to get hibernation?

no, it was done with "sudo"

sudo  echo disk > /sys/power/state

echo: write error: No space left on device

when evoked with root it gives

 echo disk > /sys/power/state
-bash: echo: write error: No such device

Offline

#20 2020-10-06 09:53:48

Marjorie
Member
From: Teignmouth, UK
Registered: 2019-06-09
Posts: 219  

Re: how to get hibernation?

kapqa wrote:
root@devuan:~# free -h
              total        used        free      shared  buff/cache   available
Mem:          2.8Gi       491Mi       1.8Gi        85Mi       601Mi       2.1Gi
Swap:         255Mi          0B       255Mi

Whatever the other issues , this looks problematic for successful hibernation since the Mem in use (491Mi), which is what needs to be written to disk on hibernation, is nearly twice as large as Swap you have (255Mi, all free).
Usually you would want to have as much swap as memory.

Last edited by Marjorie (2020-10-06 09:54:29)

Offline

#21 2020-10-06 16:22:21

kapqa
Member
Registered: 2019-01-02
Posts: 324  

Re: how to get hibernation?

well, i have just let devuan installer do automatic partitioning, there must be an error then -
surely i have forgot to double check the partitioning process.

Offline

#22 2020-10-06 17:15:28

Marjorie
Member
From: Teignmouth, UK
Registered: 2019-06-09
Posts: 219  

Re: how to get hibernation?

kapqa wrote:

well, i have just let devuan installer do automatic partitioning, there must be an error then -
surely i have forgot to double check the partitioning process.

I doubt if the automatic configuration of the partitioning would have allowed for your wish to use swap for hibernation.

Offline

#23 2020-10-06 21:42:11

kapqa
Member
Registered: 2019-01-02
Posts: 324  

Re: how to get hibernation?

Marjorie wrote:
kapqa wrote:

well, i have just let devuan installer do automatic partitioning, there must be an error then -
surely i have forgot to double check the partitioning process.

I doubt if the automatic configuration of the partitioning would have allowed for your wish to use swap for hibernation.

sorry, but i don't understand,
i was under the impression that the ratio on debian/ubuntu for automatic partitioning > swapfile size is around 1:1.5 (memorysize:swapfile) .. it should hence be around 4.5 GB with 3GB RAM.

Offline

#24 2020-10-06 22:21:24

Marjorie
Member
From: Teignmouth, UK
Registered: 2019-06-09
Posts: 219  

Re: how to get hibernation?

You are probably right.

I can't find what the default is for the Devuan/Debian Installer, but you are right that the general recommendation is that you should have more swap than memory, and mostly the recommendation is x2.

This doesn't explain why yours has much less.

I've never used automatic partitioning, usually because I'm configuring something more complicated like LVM or RAID or have other live OS already on other partitions and don't want to lose them.

My mail sever has no swap (well it never hibernates and I'd rather it kill processes than try and use swap).

My desktop machine has lots of disks, from various generations of installs, most have swap partitions and I actually use a different partition for hibernation, which is x2 RAM, than the primary one, which is about 1.5 x RAM, that I use for swap as such.

Offline

#25 2020-10-07 19:42:18

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: how to get hibernation?

For hibernation you need the swap to equal the available RAM. It is possible to hibernate with less swap than RAM but only if all the memory isn't in use.

IIRC the Debian installer assigns the swap space to be equal to the available RAM if automated partitioning is used but I always pre-partition so I might be wrong.

Last edited by Head_on_a_Stick (2020-10-07 19:42:53)


Brianna Ghey — Rest In Power

Offline

Board footer