Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: [EN] Hibernation problem  (Read 4811 times)

Offline lanig

  • User
  • Posts: 52
[EN] Hibernation problem
« on: 2023/12/02, 21:33:11 »
Hi all,

I have a Ryzen system since a few years which couldn't be hibernated by Debian 10, 11, and 12.
Siduction is the first one that could actually hibernate it although in a little bit funky way:
  • Sometimes pm-hibernate returns without hibernating but wil hibernate properly if the command is launched again
  • Sometimes hibernate without power shutdown (manually switching off the system is then ok)
  • Sometimes it works exactly like pm-hibernate is supposed to do it.
Since a few days pm-hibernates fails more often and in a way that requires a forced shutdown.
At this time, a have never ending switch between X and the console with a message that says something like "unable to create image" without the possibility to CTRL-C the pm-hibernate process.
I do have a swap, which is a little less than twice my memory size.
I suspect the last kernel upgrade being linked to the occurrence of this problem.
Any idea ?

sda                                             8:0    0 447,1G  0 disk  
├─sda1                                          8:1    0   476M  0 part 
├─sda2                                          8:2    0  14,9G  0 part  [SWAP]
├─sda3                                          8:3    0 139,7G  0 part 



Offline eriefisher

  • User
  • Posts: 266
Re: Hibernation problem
« Reply #1 on: 2023/12/03, 12:50:59 »

I suspect the last kernel upgrade being linked to the occurrence of this problem.
Any idea ?



Can you confirm this by booting another kernel?

Offline lanig

  • User
  • Posts: 52
Re: Hibernation problem
« Reply #2 on: 2023/12/14, 08:11:56 »
Sorry for being late.
linux-image-6.6.6-1-siduction-amd64   fails systematically to hibernate on my box :  after pm-hibernate, either I my session is interrupted and I am sent to login screen, screen switchs endlessly off and on or after reboot I have the login screen instead of my session.

linux-image-6.6.4-1-siduction-amd64 seems to be fine.

Online hendrikL

  • Administrator
  • User
  • *****
  • Gravatar
  • Posts: 933
Re: Hibernation problem
« Reply #3 on: 2023/12/14, 09:09:01 »
Mh, maybe dmesg or journalctl showing some error or failure messages?

Offline Mister00X

  • User
  • Posts: 198
Re: Hibernation problem
« Reply #4 on: 2023/12/14, 10:26:07 »
Additionally to what hendrikL said have you tried invoking hibernate via systemd?
Does
Code: [Select]
# systemctl hibernate
fail too?

Also just out of interest, what does
Code: [Select]
$ dmesg | grep "ACPI: PM: (supports" say?
Arguing that you don't care about the right to privacy because you have nothing to hide is no different than saying you don't care about free speech because you have nothing to say. – Edward Snowden

Offline lanig

  • User
  • Posts: 52
Re: Hibernation problem
« Reply #5 on: 2023/12/14, 23:52:05 »
For journalctrl :
Code: [Select]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xfec02000-0xfec0ffff]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xfec10000-0xfec10fff]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xfec11000-0xfec2ffff]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xfec30000-0xfec30fff]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xfec31000-0xfecfffff]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xfed00000-0xfed00fff]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xfed01000-0xfed3ffff]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xfed40000-0xfed44fff]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xfed45000-0xfed7ffff]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xfed80000-0xfed8ffff]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xfed90000-0xfedc1fff]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xfedc2000-0xfedcffff]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xfedd0000-0xfedd3fff]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xfedd4000-0xfedd5fff]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xfedd6000-0xfedfffff]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xfee00000-0xfeefffff]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xfef00000-0xfeffffff]
déc. 13 07:02:47 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0xff000000-0xffffffff]
déc. 13 07:29:17 logodenn kernel: PM: hibernation: hibernation entry
déc. 13 07:29:27 logodenn kernel: PM: hibernation: Preallocating image memory
déc. 13 07:29:27 logodenn kernel: PM: hibernation: Allocated 578288 pages for snapshot
déc. 13 07:29:27 logodenn kernel: PM: hibernation: Allocated 2313152 kbytes in 5.52 seconds (419.04 MB/s)
déc. 13 07:29:27 logodenn kernel: PM: hibernation: Creating image:
déc. 13 07:29:27 logodenn kernel: PM: hibernation: Need to copy 775258 pages
déc. 13 07:29:27 logodenn kernel: pm-hibernate: page allocation failure: order:0, mode:0x820(GFP_ATOMIC), nodemask=(null),cpuset=/,mems_allowed=0
déc. 13 07:29:27 logodenn kernel: CPU: 0 PID: 16838 Comm: pm-hibernate Not tainted 6.6.6-1-siduction-amd64 #1  siduction 6.6-6
déc. 13 07:29:27 logodenn kernel:  hibernation_snapshot+0x2f1/0x420
déc. 13 07:29:27 logodenn kernel:  hibernate+0xbb/0x280
déc. 13 07:29:28 logodenn kernel: PM: hibernation: Memory allocation failed
déc. 13 07:29:28 logodenn kernel: PM: hibernation: Error -12 creating image
déc. 13 07:29:28 logodenn kernel: PM: hibernation: hibernation exit
déc. 13 13:34:44 logodenn kernel: PM: hibernation: Registered nosave memory: [mem 0x00000000-0x00000fff]

The last line was repeated many times. This was with kernel 6.6.6-1-siduction-amd64

With kernel 6.6.4-1-siduction-amd64  I got (and it works)
Code: [Select]
14 07:57:54 logodenn kernel: PM: hibernation: hibernation entry
déc. 14 08:01:42 logodenn kernel: PM: hibernation: Preallocating image memory
déc. 14 08:01:42 logodenn kernel: PM: hibernation: Allocated 568142 pages for snapshot
déc. 14 08:01:42 logodenn kernel: PM: hibernation: Allocated 2272568 kbytes in 0.56 seconds (4058.15 MB/s)
déc. 14 08:01:42 logodenn kernel: PM: hibernation: Creating image:
déc. 14 08:01:42 logodenn kernel: PM: hibernation: Need to copy 620774 pages
déc. 14 08:01:42 logodenn kernel: PM: hibernation: hibernation exit
déc. 14 11:59:23 logodenn kernel: PM: hibernation: hibernation entry
déc. 14 16:57:56 logodenn kernel: PM: hibernation: Preallocating image memory
déc. 14 16:57:56 logodenn kernel: PM: hibernation: Allocated 566207 pages for snapshot
déc. 14 16:57:56 logodenn kernel: PM: hibernation: Allocated 2264828 kbytes in 5.29 seconds (428.13 MB/s)
déc. 14 16:57:56 logodenn kernel: PM: hibernation: Creating image:
déc. 14 16:57:56 logodenn kernel: PM: hibernation: Need to copy 740821 pages
déc. 14 16:57:56 logodenn kernel: PM: hibernation: hibernation exit

Code: [Select]
dmesg | grep "ACPI: PM: (supports"
[    0.198661] ACPI: PM: (supports S0 S3 S4 S5)

What does it mean ?
 As for systemctl hibernate, I will try it just after posting this message.



Offline lanig

  • User
  • Posts: 52
Re: Hibernation problem
« Reply #6 on: 2023/12/15, 07:54:41 »
 With 6.6.4-1-siduction-amd64 kernel,
Code: [Select]
systemctl hibernateworked as expected.

Offline Mister00X

  • User
  • Posts: 198
Re: Hibernation problem
« Reply #7 on: 2023/12/15, 16:24:20 »
Code: [Select]
dmesg | grep "ACPI: PM: (supports"
[    0.198661] ACPI: PM: (supports S0 S3 S4 S5)

What does it mean ?


This shows which sleep states are supported by your UEFI/BIOS https://en.wikipedia.org/wiki/ACPI#Power_states S4 may indicate that your device has a special sleep state for hibernation, instead of switching it off (i.e. entering S5).
IIrc this can be broken on some devices and lead to trouble, but I'll have to look this up I might confuse something here.

But looking at your output for 6.6.6-1, especially because of these lines
Code: [Select]
déc. 13 07:29:27 logodenn kernel: pm-hibernate: page allocation failure: order:0, mode:0x820(GFP_ATOMIC), nodemask=(null),cpuset=/,mems_allowed=0
déc. 13 07:29:27 logodenn kernel: CPU: 0 PID: 16838 Comm: pm-hibernate Not tainted 6.6.6-1-siduction-amd64 #1  siduction 6.6-6
déc. 13 07:29:27 logodenn kernel:  hibernation_snapshot+0x2f1/0x420
déc. 13 07:29:27 logodenn kernel:  hibernate+0xbb/0x280
déc. 13 07:29:28 logodenn kernel: PM: hibernation: Memory allocation failed
déc. 13 07:29:28 logodenn kernel: PM: hibernation: Error -12 creating image
I am wondering if you have a large enough swap space for hibernation.

Could you also please post the output of
Code: [Select]
inxi -mj
so we can check.

Otherwise I'd suspect in fact a bug in the kernel because this line here
Code: [Select]
déc. 13 07:29:27 logodenn kernel: CPU: 0 PID: 16838 Comm: pm-hibernate Not tainted 6.6.6-1-siduction-amd64 #1  siduction 6.6-6
Looks like the beginning of one of those backtrace like blocks the kernel puts to dmesg if something went wrong.
Is/was there something in your logs (dmesg/journalctl) after your snippet that looked similar to the stacktrace here https://www.kernel.org/doc/html/v5.8/admin-guide/bug-hunting.html ? (It might have been ripped into multiple parts by the other messages)


Arguing that you don't care about the right to privacy because you have nothing to hide is no different than saying you don't care about free speech because you have nothing to say. – Edward Snowden

Online hendrikL

  • Administrator
  • User
  • *****
  • Gravatar
  • Posts: 933
Re: Hibernation problem
« Reply #8 on: 2023/12/15, 17:17:55 »
With 6.6.4-1-siduction-amd64 kernel,
Code: [Select]
systemctl hibernateworked as expected.


And with 6.6.6-1 or 6.6.7-1?

Offline lanig

  • User
  • Posts: 52
Re: Hibernation problem
« Reply #9 on: 2023/12/15, 19:48:39 »
Code: [Select]
inxi -mj
Memory:
  System RAM: total: 8 GiB available: 5.75 GiB used: 3.39 GiB (58.9%)
  Array-1: capacity: 256 GiB note: check slots: 2 modules: 1 EC: None
  Device-1: DIMM 0 type: DDR4 size: 8 GiB speed: spec: 2400 MT/s
    actual: 1200 MT/s
  Device-2: DIMM 0 type: no module installed
Swap:
  ID-1: swap-1 type: partition size: 14.9 GiB used: 1.73 GiB (11.6%)
    dev: /dev/sdb2
There is normally more than enough swap to hibernate, but I'll check how much of it is used before hibernating.
With 6.6.4-1-siduction-amd64 kernel,
Code: [Select]
systemctl hibernateworked as expected.


And with 6.6.6-1 or 6.6.7-1?
I have not tested. I'll try it at the next reboot.

Offline lanig

  • User
  • Posts: 52
Re: Hibernation problem
« Reply #10 on: 2023/12/16, 14:40:24 »

Otherwise I'd suspect in fact a bug in the kernel because this line here
Code: [Select]
déc. 13 07:29:27 logodenn kernel: CPU: 0 PID: 16838 Comm: pm-hibernate Not tainted 6.6.6-1-siduction-amd64 #1  siduction 6.6-6
Looks like the beginning of one of those backtrace like blocks the kernel puts to dmesg if something went wrong.
Is/was there something in your logs (dmesg/journalctl) after your snippet that looked similar to the stacktrace here https://www.kernel.org/doc/html/v5.8/admin-guide/bug-hunting.html ? (It might have been ripped into multiple parts by the other messages)
Sorry, I forgot to checked this important  part.

Code: [Select]
journalctl -S 2023-12-13 |grep -A  30 07:29:27
déc. 13 07:29:27 logodenn kernel: CPU: 0 PID: 16838 Comm: pm-hibernate Not tainted 6.6.6-1-siduction-amd64 #1  siduction 6.6-6
déc. 13 07:29:27 logodenn kernel: Hardware name: Micro-Star International Co., Ltd. MS-7A36/A320M PRO-E (MS-7A36), BIOS H.20 01/22/2019
déc. 13 07:29:27 logodenn kernel: Call Trace:
déc. 13 07:29:27 logodenn kernel:  <TASK>
déc. 13 07:29:27 logodenn kernel:  dump_stack_lvl+0x32/0x50
déc. 13 07:29:27 logodenn kernel:  warn_alloc+0x131/0x1a0
déc. 13 07:29:27 logodenn kernel:  __alloc_pages_slowpath.constprop.0+0xb6c/0xc00
déc. 13 07:29:27 logodenn kernel:  ? vprintk_emit+0x18e/0x210
déc. 13 07:29:27 logodenn kernel:  __alloc_pages+0x2b7/0x2d0
déc. 13 07:29:27 logodenn kernel:  swsusp_save+0xf9/0x430
déc. 13 07:29:27 logodenn kernel:  swsusp_arch_suspend+0x5b/0x60
déc. 13 07:29:27 logodenn kernel:  hibernation_snapshot+0x2f1/0x420
déc. 13 07:29:27 logodenn kernel:  hibernate+0xbb/0x280
déc. 13 07:29:27 logodenn kernel:  state_store+0xba/0xc0
déc. 13 07:29:27 logodenn kernel:  kernfs_fop_write_iter+0x12d/0x1c0
déc. 13 07:29:27 logodenn kernel:  vfs_write+0x205/0x400
déc. 13 07:29:27 logodenn kernel:  ksys_write+0x5e/0xe0
déc. 13 07:29:27 logodenn kernel:  do_syscall_64+0x3b/0x90
déc. 13 07:29:28 logodenn kernel:  entry_SYSCALL_64_after_hwframe+0x63/0xcd
déc. 13 07:29:28 logodenn kernel: RIP: 0033:0x7f03e20dfb00
déc. 13 07:29:28 logodenn kernel: Code: 40 00 48 8b 15 19 b3 0d 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 80 3d e1 3a 0e 00 00 74 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 48 83 ec 28 48 89
déc. 13 07:29:28 logodenn kernel: RSP: 002b:00007ffcc44c4908 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
déc. 13 07:29:28 logodenn kernel: RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007f03e20dfb00
déc. 13 07:29:28 logodenn kernel: RDX: 0000000000000004 RSI: 000055ae4dfc0470 RDI: 0000000000000001
déc. 13 07:29:28 logodenn kernel: RBP: 000055ae4dfc0470 R08: 0000000000000003 R09: 000055ae4dfb52fc
déc. 13 07:29:28 logodenn kernel: R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000001
déc. 13 07:29:28 logodenn kernel: R13: 0000000000000004 R14: 0000000000000000 R15: 000055ae4dfb5268
déc. 13 07:29:28 logodenn kernel:  </TASK>
déc. 13 07:29:28 logodenn kernel: Mem-Info:
déc. 13 07:29:28 logodenn kernel: active_anon:54443 inactive_anon:27726 isolated_anon:0
                                    active_file:42924 inactive_file:291889 isolated_file:0
                                    unevictable:132 dirty:12 writeback:0
                                    slab_reclaimable:21380 slab_unreclaimable:26080
                                    mapped:159265 shmem:2260 pagetables:8764
                                    sec_pagetables:0 bounce:0
                                    kernel_misc_reclaimable:0
                                    free:14350 free_pcp:124 free_cma:0
déc. 13 07:29:28 logodenn kernel: Node 0 active_anon:217772kB inactive_anon:110904kB active_file:171696kB inactive_file:1167556kB unevictable:528kB isolated(anon):0kB isolated(file):0kB mapped:637060kB dirty:48kB writeback:0kB shmem:9040kB shmem_thp:0kB shmem_pmdmapped:0kB anon_thp:96256kB writeback_tmp:0kB kernel_stack:16464kB pagetables:35056kB sec_pagetables:0kB all_unreclaimable? no
déc. 13 07:29:28 logodenn kernel: Node 0 DMA free:14336kB boost:0kB min:172kB low:212kB high:252kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:15984kB managed:15360kB mlocked:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB

How  can I report this bug?

Offline Mister00X

  • User
  • Posts: 198
Re: Hibernation problem
« Reply #11 on: 2023/12/20, 18:06:34 »
Sorry for the late reply.

I guess reporting it would fall into towos domain, because bug reports from (patched) distribution kernels against the upstream kernel are usually ignored.
I'm gonna have a look at the kernels regression tracker later (maybe the problem is already known).

In any case I'd recommend you to check if your problems disappear with newer kernel versions (maybe you are lucky).
Arguing that you don't care about the right to privacy because you have nothing to hide is no different than saying you don't care about free speech because you have nothing to say. – Edward Snowden

Offline lanig

  • User
  • Posts: 52
Re: Hibernation problem
« Reply #12 on: 2023/12/24, 10:58:23 »
Thanks for the answer.
Latest siduction kernel seems to be ok.

Offline lanig

  • User
  • Posts: 52
Re: Hibernation problem
« Reply #13 on: 2023/12/29, 16:08:39 »
Still experiencing problems :
Code: [Select]
# uname -a
Linux logodenn 6.6.4-1-siduction-amd64


Code: [Select]
inxi -mj
Memory:
  System RAM: total: 8 GiB available: 5.75 GiB used: 3.91 GiB (67.9%)
  Array-1: capacity: 256 GiB note: check slots: 2 modules: 1 EC: None
  Device-1: DIMM 0 type: DDR4 size: 8 GiB speed: spec: 2400 MT/s
    actual: 1200 MT/s
  Device-2: DIMM 0 type: no module installed
Swap:
  ID-1: swap-1 type: partition size: 14.9 GiB used: 4.84 GiB (32.5%)
    dev: /dev/sda2


Code: [Select]
#journalctl -S 2023-12-29 |grep hibernation
[...]
déc. 29 16:02:12 logodenn kernel: PM: hibernation: hibernation entry
déc. 29 16:02:25 logodenn kernel: PM: hibernation: Preallocating image memory
déc. 29 16:02:25 logodenn kernel: PM: hibernation: Allocated 569108 pages for snapshot
déc. 29 16:02:25 logodenn kernel: PM: hibernation: Allocated 2276432 kbytes in 8.50 seconds (267.81 MB/s)
déc. 29 16:02:25 logodenn kernel: PM: hibernation: Creating image:
déc. 29 16:02:25 logodenn kernel: PM: hibernation: Need to copy 877463 pages
déc. 29 16:02:25 logodenn kernel: PM: hibernation: Not enough free memory
déc. 29 16:02:25 logodenn kernel: PM: hibernation: Error -12 creating image
déc. 29 16:02:25 logodenn kernel: PM: hibernation: hibernation exit



What's wrong? It seems to me that I should have enough space to create the image.

Online hendrikL

  • Administrator
  • User
  • *****
  • Gravatar
  • Posts: 933
Re: Hibernation problem
« Reply #14 on: 2023/12/29, 18:53:56 »
Mh, Kernel 6.6.4-1 is an old one, it should be 6.6.8-1, please test with that kernel!