You are not logged in.

#1 2017-10-28 07:31:02

BLizgreat!
Resident Babbler - vll!
Registered: 2015-10-03
Posts: 1,217

A fix to try if hibernate isn't working on your Debian system.

I don't use hibernate anyway but been trolling the Linux Mint forums somewhat lately and many were complaining of hibernation not working. Got me curious tried "systemctl hibernate" on my laptops Debian Stretch install and nope, didn't work. Curious booted Hydrogen iso on usb and tried it there, nope, same thing.

Anyway found what appears to be a solution and may work for somebody here, so posting it. Just going to cut/paste. This worked for me.

Believe you need a dedicated swap partition at least as big ( or slightly larger) than the amount of RAM on the system. Don't quote me as I'm not the gnu/nix hibernation expert but don't believe someone using a swap-file can hibernate. Anyway ... never really even use hibernation and all the people asking about it got me wondering, so tried it and nope on my box hibernate wasn't working either.

Enter google, smile answer for me as root or sudo of course I had to edit this file "/etc/initramfs-tool/conf.d/resume" It's default contents were (no quotes) "RESUME=NONE" so I changed it to be my swap partitions UUID as follows ...

"RESUME=UUID=4ae4f18d-76a0-321d-a950-7h5829055dcb" which you can find your partitions UUID's well lotsa places but generally use "sudo blkid". After changing it to be the swaps UUID also went ahead and ran "sudo update-initramfs -u" not sure if required did it anyway.

Tested both "sudo systemctl hibernate" and "sudo systemctl suspend" are working now. Though needs sudo, when the laptop hibernates, yep just shutsdown, I let the hdd spin down for 10secs to avoid any poss head crashes, press the power button and yep, when the lappy wakes up I'm back to where I was when hibernated. Also saw some recent version ubuntu users saying they didn't even have the resume file. Something to try I guess. This worked for me.

Just for the sake of being thorough or make that anal, here's the link that led me to a solution.

Also note the hibernation process is not the smoothest I've ever seen. Enter the "sudo systemctl hibernate" command, initially screen goes black, then pops back up briefly, then laptop appears to shut-off, I let the disks spin down just cause I'm cautious and have an old mechanical rust-drive. When I press the power button and select the entry for the OS I had in hibernation, it then runs through the boot-up process telling me xyz% of image restored and when finally gets back up, it's in the same state and session as when it was hibernated. Another related thought, if I were to boot another distro and during usage swap was altered, can see resuming the other install from hibernate afterwards ... could lead to issues.

Suspend works great, calling this a sorta win and going back to not ever really using hibernate anyway. big_smile

Last edited by BLizgreat! (2017-10-28 08:15:05)

Offline

#2 2017-10-28 09:20:12

BLizgreat!
Resident Babbler - vll!
Registered: 2015-10-03
Posts: 1,217

Re: A fix to try if hibernate isn't working on your Debian system.

Updated cut/paste babblings on the on-going thread and this topic.

Afterthought to afterthought: A solution to the problem above could be setting up more than one swap partition and using a dedicated one for each install ? Then contents of swap would never get altered between operating systems, so any potential problems or corruption thus mitigated. Though that's much aggravation to go through just for hibernate. Even this dinosaur dell inspiron 1545 boots from power-on to full working desktop in around 30secs. So if resuming from hibernate saves me all of 5secs or whatever, really doesn't even seem worth using it.

And

Asked about creating the resume file in the location shown above if it doesn't exist. Responded with the following.

Read that link, the person using ubuntu said as much I believe. Can always give it a shot, doesn't work ... then you're no worse off and can easily reverse it aka: Remove or leave the created file if it's not causing any problems on the operating system. Though given what occurred to me in the post above, why is hibernation so important ? Only wanted to try to help nixers here and to figure out how to get it working just for the sake of it but again ... don't see myself bothering with hibernation. As it really doesn't give many advantages in my view.

As per the sentiments above, really don't see much advantage to hibernate but why not share this info in case it's useful or interesting to anyone here. Didn't bother timing the resume from boot process but can't be by much if any compared to from a cold boot state. So what's the point imo ?


Vll!

PS, Oops ... one more

OP responded with suspend wasn't working either, so that was their real issue and what they wanted resolved. Responded with ...

^ Now that one, yeah ... Now it makes sense, lol but you should've titled the thread a bit differently me thinks suspend/hibernate not working in Mint blahblah. Oh well ... during this process also installed a couple packages not sure if they're significant but will list them and perhaps check and see if they're installed on your system.

One was pm-utils and the other uswsusp ( which believe can have a significant impact on suspend). So would you check and see if they're installed and let us know ? They may've played a part in getting it working too but didn't think so, thus didn't bother mentioning them in the thread. Suspend on this OS was working before installed them, hibernation wasn't.

Btw: pm-utils isn't installed on the Hydrogen iso it seems, as mentioned system wouldn't hibernate while using the live usb session either. Not sure if either of these packages make a difference in this but did go ahead and install both, shrugs. May or not be significant.

Last edited by BLizgreat! (2017-10-28 09:36:43)

Offline

#3 2017-11-06 08:00:54

easysid
Member
Registered: 2016-01-01
Posts: 49

Re: A fix to try if hibernate isn't working on your Debian system.

A dedicated swap partition isn't required. I have hibernate working with a swapfile on Debian Stretch.

I followed ArchWiki's instructions to get it working (Debian's own wiki is quite bad, and more often than not, incomplete). Added resume, and resume_offset in grub, and resume device in /etc/initramfs-tools/conf.d/resume.

I do not require sudo with systemctl hibernate (Isn't that a major point of systemd?), and process is quite smooth. The screen turns off, then the laptop shuts down after a few seconds.

The process I followed was:

  1. find swapfile offset (the first row of physical_offset)

    # filefrag -v /swapfile 
    Filesystem type is: ef53
    File size of /swapfile is 1073741824 (262144 blocks of 4096 bytes)
     ext:     logical_offset:        physical_offset: length:   expected: flags:
       0:        0..       0:    2185216..   2185216:      1:            
       1:        1..   10239:    2185217..   2195455:  10239:             unwritten
        :
        :
      10:   256000..  262143:    2447360..   2453503:   6144:             last,unwritten,eof
    /swapfile: 2 extents found
  2. add resume options in /etc/default/grub

    GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=3be275d4-c74d-41bd-a112-44ceb0959c5b resume_offset=2185216.."

    ** The UUID is of the partition where the swapfile resides. In my case, this is the root partition.

  3. add resume hook in /etc/iniramfs-tools/conf.d/resume

    RESUME=UUID=3be275d4-c74d-41bd-a112-44ceb0959c5b
  4. Regenerate grub.cfg, and initramfs

  5. Reboot

Now compare this process to the one mentioned in Debian Wiki

Offline

#4 2017-11-06 18:09:37

BLizgreat!
Resident Babbler - vll!
Registered: 2015-10-03
Posts: 1,217

Re: A fix to try if hibernate isn't working on your Debian system.

^Woah, one of the MANY great things about tech and gnu/Linux, it's always friggin changing and evolving to be better !

Thanks for posting this, is really good to know hibernation is possible even with a swapfile. Never even use hibernate, was only noticing a bunch of people using that distro having problems with it and tried to help. Figured out how to fix it on my OS/hardware.

Actually ended up being fairly interesting. Think I established the actual cause could be their lack of using systemd in all it's glory and still allowing users to use systemd-shim + sysv hacks.

Relevant snippet I added to thread, after finding this junk out.

So graph here looks like.

* Debian 9 w systemd suspend/hibernate works.
* Bunsenlabs Linux/Debian 9 hybrid w systemd suspend/hibernate works.
* Ubuntu 16.04 live-session w systemd suspend works, hibernation appeared to also and am almost 100% would've had it been a bare-metal install.
* Bunsenlabs (Hydrogen) live-session w systemd suspend works, hibernation didn't appear to but may've if it'd actually been installed.
* LM 18.2 w choice of systemd/sysV ... on your and apparently other users systems hibernate and/or suspend aren't working.

Believe it may be causing plenty of additional odd borkage among that distro's userbase to. Other than just power management issues. Pulseaudio/audio issues and other stuff too, shrugs.

Anyway ... thanks for letting me/people know you can use a swapfile with hibernation. Cool stuff !

Vll! smile

Offline

#5 2017-12-27 23:54:50

stevep
MX Linux Developer
Registered: 2016-08-08
Posts: 381

Re: A fix to try if hibernate isn't working on your Debian system.

For what it's worth, I had it working in MX 16 (jessie-based) with both systemd and sysvinit boots.  With the sysvinit boots, I got a nice terminal screen with a compression/restore percentage readout for the hibernation shutdown and resume. 

I also have it working on stretch-based MX 17, but some configuration must have carried over from my MX 16 upgrade, because I lost the terminal percentage screen.  It's probably just tweak, since we added a tool to MX 17 that almost everyone can check off to get hibernation working, and they report that they get the percentage screen.

The swap does NOT have to match the amount of RAM you have.  The hibernation process only saves the amount of RAM in use, and compresses that in addition.  There's no need to have a 64 GB swap partition if you have 64 GB of RAM and make sure you don't have much in use before hibernation--I have 8 GB of RAM and a 3 GB swap partition.

Offline

#6 2017-12-28 00:54:05

BLizgreat!
Resident Babbler - vll!
Registered: 2015-10-03
Posts: 1,217

Re: A fix to try if hibernate isn't working on your Debian system.

^ Thanks for the add. Still tend to do the 1/1 RAM to swap just out of habit I guess. Junk like you mention compressed swap, zswap/zram etc. Will keep it in  mind though Stevep, if ever get a personal comp with a respectable amount of RAM ie: 12/16gbs etc. Easy enough to live with 4gbs of disk space being used I guess. Didn't know someone could hibernate with a swapfile, actually never even bothered setting up a swapfile.

Cool stuff guys ... Vll! smile

Offline

#7 2017-12-28 08:49:40

ohnonot
...again
Registered: 2015-09-29
Posts: 5,568

Re: A fix to try if hibernate isn't working on your Debian system.

BLizgreat! wrote:

hibernation process is not the smoothest I've ever seen. Enter the "sudo systemctl hibernate" command, initially screen goes black, then pops back up briefly, then laptop appears to shut-off

i have observed the same behavior. wonder why this happens. i understand gpu-related glitches but this is clearly a Xorg(?) thing.

also, i still don't fully understand the difference between susbend and hibernate.
i thought
hibernate is the swap partition (or file) thing where the computer effectively shuts off, and
suspend is some sort os stand-by status, i.e. the hardware has to support it and it's not fully shut off?


Give to COVAX! Here or here. (explanation)
My Repos: notabug | framagit

Offline

#8 2017-12-28 09:25:29

BLizgreat!
Resident Babbler - vll!
Registered: 2015-10-03
Posts: 1,217

Re: A fix to try if hibernate isn't working on your Debian system.

^ In same boat as you are Ohnonot, don't intimately understand anything gnu/Linux power management related either and believe the same as what you posted above as regards hibernate/suspend and how they work. Though I'm grateful there's A LOT more skilled people involved in open source than a dork like meself. They keep on pushing the envelope and improving on things despite what I think/know or think I know. big_smile

Still really do think there's something behind this systemd vs systemd-shim thing and likely all manner of problems it could be causing, weird quirks etc. I just can't seem to work up the interest to investigate how the shim actually works anyway. Not anything Bunsenlabs userbase needs to worry about, since BL teams (rightly imo) going with systemd as init and not resorting to fighting the tide on the subject. Don't want to open a systemd can of worms, so had better leave off.

Vll! smile

Offline

#9 2017-12-28 09:53:40

jr2
Member
Registered: 2017-12-24
Posts: 62

Re: A fix to try if hibernate isn't working on your Debian system.

ohnonot wrote:

...the difference between susbend and hibernate.
i thought
hibernate is the swap partition (or file) thing where the computer effectively shuts off, and
suspend is some sort os stand-by status, i.e. the hardware has to support it and it's not fully shut off?

Not an expert, but fwiw my understanding is something like:

H: store system state on disk (usually in the swap partition), set some boot flag and shutdown completely.

S: store system state in memory and go into a semi-shutdown state, with low but non-zero power consumption (to keep the memory alive).


normal service will be resumed as soon as possible

Offline

#10 2018-05-05 09:39:55

pm3747
New Member
Registered: 2018-05-05
Posts: 1

Re: A fix to try if hibernate isn't working on your Debian system.

Confirm that easysid's solution worked for me for hibernate.
Suspend to RAM was working out of the box, hibernate to disk was not. Fresh install of debian 9 from debian-9.4.0-amd64-netinst.iso (Linux version 4.9.0-6-amd64) onto a Dell Optiplex 9010 i5 machine. Before fix hibernate to disk worked, but was unable to wake the machine from either keyboard or power button. Now wake from hibernate works from power button. No wake from keyboard. Suspect that all USB's have no power (further investigation needed). Wake from USB is set in BIOS. Also note I am using LVM for swap file so just used UUID for swap, no offset.

Last edited by pm3747 (2018-05-05 09:43:19)

Offline

#11 2021-11-13 14:12:47

voy
New Member
Registered: 2021-11-13
Posts: 1

Re: A fix to try if hibernate isn't working on your Debian system.

Confirm that easysid's solution worked for me for hibernate.

BUT...

extra notes about GRUB_CMDLINE_LINUX_DEFAULT:
- I have no trailing dots
- I obtained UUID with command:

findmnt / -o UUID -n

("blkid" was not what i was looking for)

Use following command to generate proper resume params:

RESUME_PARAMS="resume=UUID=$(findmnt / -o UUID -n) resume_offset=$(sudo filefrag -v /swapfile|awk 'NR==4{gsub(/\./,"");print $4;}') " && echo $RESUME_PARAMS

also good guide: https://forums.linuxmint.com/viewtopic. … 2&t=284100

Offline

#12 2021-11-13 20:46:58

rbh
Moderator
From: Sweden/Vasterbotten/Rusfors
Registered: 2016-08-11
Posts: 1,295

Re: A fix to try if hibernate isn't working on your Debian system.

voy wrote:

Confirm that easysid's solution worked for me for hibernate.


I am curious; What is "easysid's solution"? Can not fins any explanation in the thread...

extra notes about GRUB_CMDLINE_LINUX_DEFAULT:
- I have no trailing dots

Yes, you should not have them there...

"blkid" was not what i was looking for)

Yes, if you use swapfile instead of swap-partion, you can't use a block-device tool like "blkid".

Use following command to generate proper resume params:

RESUME_PARAMS="resume=UUID=$(findmnt / -o UUID -n) resume_offset=$(sudo filefrag -v /swapfile|awk 'NR==4{gsub(/\./,"");print $4;}') " && echo $RESUME_PARAMS

That will find your $RESUME_PARAMS, but you still have to ad it to file /etc/initramfs-tools/conf.d/resume:

echo $RESUME_PARAMS > /etc/initramfs-tools/conf.d/resume

// Regards rbh

Please read before requesting help: Guide to getting help,
Introduction to the Bunsenlabs Lithium Desktop and other help topics under "Help Resources" on the BunsenLabs menu

Offline

#13 2021-11-14 05:08:01

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 8,424
Website

Re: A fix to try if hibernate isn't working on your Debian system.

rbh wrote:
voy wrote:

Confirm that easysid's solution worked for me for hibernate.

I am curious; What is "easysid's solution"? Can not fins any explanation in the thread...

This?
https://forums.bunsenlabs.org/viewtopic … 302#p63302


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

Board footer

Powered by FluxBB