Bug 66041

Summary: 2 attempts needed to hibernate
Product: Power Management Reporter: Eric Lan (tenoreamer)
Component: Hibernation/SuspendAssignee: Rafael J. Wysocki (rjw)
Status: CLOSED DUPLICATE    
Severity: normal CC: aaron.lu, lenb, rui.zhang, tianyu.lan
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 3.10-2 Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg after failed "s2disk"

Description Eric Lan 2013-11-28 07:32:49 UTC
I am using linux mint debian edition (LMDE). If I hibernate the system shortly after logging in, it might succeed. After some operations, it takes two times of attempts of s2disk to hibernate successfully.

$ dmesg
[142528.245031] PM: Creating hibernation image:
[142528.248008] PM: Need to copy 530249 pages
[142528.248008] PM: Normal pages needed: 530249 + 1024, available pages: 518040
[142528.248008] PM: Not enough free memory
[142528.248008] PM: Error -12 creating hibernation image
[142528.248008] CPU0: Thermal monitoring handled by SMI
[142528.248008] Enabling non-boot CPUs ...
[142528.248008] smpboot: Booting Node 0 Processor 1 APIC 0x1
[142528.144009] CPU1: Thermal monitoring handled by SMI
[142528.256966] CPU1 is up
[142528.261997] ACPI: Waking up from system sleep state S4

Supposedly, the free space in the swap may not be adequate. I then swapped off and then on to clean up the swap space to make all swap space available, which is confirmed by "free -h" command.

Then, s2disk still needs 2 attempts to hibernate successfully.
Comment 1 Lan Tianyu 2013-11-28 07:52:46 UTC
Could you try the latest upstream kernel v3.13-rc1?
Comment 2 Eric Lan 2013-11-29 03:06:29 UTC
Is there easier way to help you debug this ? The linux environment is a production system for me and I don't want to risk damaging it by upgrading to a release-candidate kernel.
Comment 3 Lan Tianyu 2013-11-29 03:27:24 UTC
You can't upgrade kernel? So how can you test a fix patch?

So far, I know a fix about hibernation swap allocation fix in the v3.13. This may fix the issue.

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=fd432b9f8c7c88428a4635b9f5a9c6e174df6e36
Comment 4 Eric Lan 2013-11-29 08:15:46 UTC
Because I had only 4G RAM and I used 64-bit LMDE, that might not fix it.

I am not familiar with the procedure. I found the most forefront Debian sid used the kernel 3.11-2, still lesser than v3.13. So it would involve re-compile and re-configure the kernel by myself right ?
Comment 5 Lan Tianyu 2013-12-02 08:35:58 UTC
(In reply to Eric Lan from comment #4)
> Because I had only 4G RAM and I used 64-bit LMDE, that might not fix it.
> 
> I am not familiar with the procedure. I found the most forefront Debian sid
> used the kernel 3.11-2, still lesser than v3.13. So it would involve
> re-compile and re-configure the kernel by myself right ?

Yes, you can follow this link to rebuild kernel.
http://kernelnewbies.org/KernelBuild
Comment 6 Aaron Lu 2013-12-11 07:20:33 UTC
It doesn't have anything to do with swap, it may be that we didn't preallocate/free enough memory during the start of hibernation. Please attach full dmesg after a failed hibernation.
Comment 7 Eric Lan 2013-12-15 17:37:47 UTC
Created attachment 118501 [details]
dmesg after failed "s2disk"

dmesg after failed "s2disk" (the first time)
Comment 8 Zhang Rui 2014-06-03 05:58:41 UTC

*** This bug has been marked as a duplicate of bug 47931 ***