Hibernation not working - swap partition smaller than RAM

Hibernation is not working on my machine - it simply causes the machine to hang. How do I diagnose the problem?

I have 4 GB of RAM on my machine and a 500GB SSD. When I installed OpenSUSE Leap 42.2 I accepted the defaults which was for a 2GB swap partition. I assume that because my swap is smaller than my RAM that this is the problem?

If you need a swap partition to be at least equal to your RAM for hibernate to work then why does KDE still even offer me the option of hibernation? And why did the OpenSUSE installer set the swap partition to such a small size by default when it knows the amount of RAM I have? I see that Ubuntu are moving to swap files in forthcoming releases – should OpenSUSE be following their lead here?

Also, my root partition is on btrfs and my home is on XFS. I read that btrfs does not support swap files yet, so I assume the only way to fix this is to increase the size of my swap partition? Should I set it to 4GB or should it be even greater?

Common wisdom is to have a swap partition at least as large as RAM for hibernate to work; the actual amount of files written depends on usage at the time of hibernation and is anyway somewhat smaller because of compression features, but 4GB swap for 4GB RAM is a sure bet.
I’m not going to speculate on why the installer behaved that way, maybe you didn’t accept ALL defaults and so 2GB was all that was left for swap?

And starting to use files for swap (possible from Btrfs or not) will indeed increase swap space for the system to be used as swap. However it will NOT increase any swap partition you might have.

OK, I read elsewhere that I needed to have a swap partition greater than RAM to be sure hibernation would work so after a bit of hassle I now have my swap partition at 8GiB for 4 GiB RAM.

However, hibernate is still not working. I get a flashing cursor with some disk activity and then just a black screen. The system does not power off. How can I figure out what is wrong? System is a Toshiba Satellite A660.

It is not clear how you did that. When you want that people help you, they should inform them as good as possible about what your situation is and what you do.

I for myself are a bit suspicious about what you did. Is the original swap partition now grown from 4 Gib to 8 GiB because there was 4 GiB unused space adjacent to it?

Showing what you have now might also help.

su -l -c 'fdisk -l'

with explanation which of those shown is the swap partition.

cat /proc/cmdline

to see what the resume device is.

I don’t think the problem is with my partitioning any more - it is something else. Here you go:

> su -l -c 'fdisk -l'
**Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors**
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xd5bc7777

**Device****Boot****          Start****       End****   Sectors****   Size ****Id ****Type**
/dev/sda1  *         2048   1026047   1024000   500M  7 HPFS/NTFS/exFAT
/dev/sda2         1026048 791209983 790183936 376.8G  7 HPFS/NTFS/exFAT
/dev/sda3       975740928 976766975   1026048   501M 27 Hidden NTFS WinRE
/dev/sda4       791209984 975740927 184530944    88G  f W95 Ext'd (LBA)
/dev/sda5       791212032 807989247  16777216     8G 82 Linux swap / Solaris
/dev/sda6       807991296 891881471  83890176    40G 83 Linux
/dev/sda7       891883520 975740927  83857408    40G 83 Linux

Partition table entries are not in disk order.


I am dual-booting with Windows 10 (sda 1-3) so had extra space. All I did was used Gparted to shrink my main Windows partition (sda2) by 6 GiB, increased the extended partition (sda4) by 6 GiB and shifted it left, and then increased the swap partition (sda5) by 6GiB and shifted it left. sda6 is my / (btrfs) and sda7 is my /home (XFS).

>cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-4.4.36-8-default root=UUID=3b4d0fdf-1288-4714-a529-d6c30e74b1cf resume=/dev/sda
5 splash=silent quiet showopts


Oops, that was a large operation :wink:

One remark first. I have the strong idea that you do not copy/paste from the terminal right between the CODE tags in a post. E.g. those bold characters are not in an fdisk listing AFAIK. Also the su should ask for the root password and those lines are missing. Also strange white space before each line. Please understand that the copied/pasted terminal text between CODE tags is there to give other people trust in that information as being the unaltered text as you saw it on the terminal. When people get the idea that you are changing things (not even saying you did, e.g. I altered the … in the third line for security reasons), they will possibly not trust the rest of what you post.

But your info tells us that /dev/sda5 is 8G and marked for swap. It is most probably indeed your Swap partition (we can not detect that from what we see here, but I think that is secondary).
The kernel parameters for the boot tell us resume=/dev/sda5 which means that /dev/sda5 is supposed to have the hibernation info on resume. I was worried that it would have a UUID=… contents and that your action to increase swap would have changed the UUID.

I just pasted the relevant block and didn’t change anything in the important bit. The bold characters are in the fdisk listing. I forgot to copy the command typed, but added it after to give context. The “strange whitespace” was me just indenting for elegant display on the forum before I discovered the code tags to ensure a fixed width font. I’ll just paste directly into a code block in the future. Forgive by n00bishness for how this forum works.

Another I thing I get with the black screen is a flashing LED on my Caps Lock key.

No apologizes needed. I forgot to check your number of posts :(. The CODE tags are rather hidden and we have to explain them to all newcomers. Not your fault. And yes, please include not only the command, but also the prompts before and after. Apart from they showing that it is complete, we then also see e.g. your working directory and if you were root or not. All things that might be important in many cases.

Fixed it, and you were almost right! rotfl! The UUID of sda5 had changed, and just needed to be updated in my /etc/fstab . Now hibernate works very well.

I think though that this whole process is too complex for normal users. Ultimately swapfiles would seem to be preferable and more efficient but we will have to wait for the btrfs guys on support for that. Perhaps, until then, you could give a “hibernate support” checkbox in the OpenSUSE installer which would adjust the size of the default swap partition depending upon whether you want to use disk space for hibernate support or not?

I don’t know what you really did in the first place, but I count a number of installs with a right sized swap partition with no problems at all with hibernate…

I doubt that file swap space will ever be working for hibernate. After all spcialy the resume has to take place in a rudimentary environment. A partition for the resume- is OK then. Easy to find. But a file somewhere inside a file ystem of some dsort, where probsbly the software module that understands that file system is not aviulable is something different.

I repeat myself more or less from an earlier post here: file swap can be used by the swap mechanism, the hibernate mechanism is a different beast. I am not 100% sure, but I assume that you can use any unused partition for the resume= parameter, being it also used for swap or not.

For the sake of truth, I checked and apparently the 42.2 installer defaults to a 2.01 GB swap partition no-matter-what, if it fits the available disk space of course.
So no wrong action on the side of the OP; simply the installer doesn’t care about hibernation and you have to use the “Expert Partitioner” if you have more than 2 GB of RAM and plan on using suspend-to-disk.

That is an interesting find… I would have assumed it configured according to the memory footprint.

I am also a bit amazed. I would think that it would do this different when it thinks it is a desktop, from e.g. a laptop (making an intelligent guess). Can’t test this, no laptop available. :frowning:

Out of your amazement I double-checked and found a rather hidden option to adjust for hibernation:
when at the “Suggested Partitioning” screen you may hit the “Edit Proposal Settings” button where you find a tick-box labeled “Enlarge Swap for Suspend”.
Ticking it and “OK” adjusts the 2.01GiB default to, e.g., 8.01GiB for a system with 8192MB RAM.
As far as I can see there is no check on whether it be a desktop or laptop though.

I bet that 99% of newcomers (and several seasoned users like us…) are going to miss that option.

I bet you are correct here.

But I always go for expert, thus no wonder I missed it.

Hi,

There are several posts in the forum about problems concerning waking up from hibernate. Experienced them myself also. One cause was SWAP size being too small. The strange thing is, it didn’t seem to bother leap 42.1. After upgrade, hibernation stopped working.

After enlarging swap (luckily my swap space was on a lvm volume) - it still didnt work.

Appeared that that the bootloader configuration had the resume=/dev/… entry twice on the commandline.
By changing this in Yast2 (bootloader/kernelparameters) hibernation started to work again. The kerneparamers was set to resume=/dev/system/lv_swap splash=silent quiet showopts (/dev/system/lv_swap being the device path as shown by the partioner)

I don’t know where the second resume entry came from. I certainly didn’t add it manually. Maybe the swap size was not a problem after all.
Could the leap 42.1 -> 42.2 upgrade have caused multiple resume entries??