2

For several day/months I was trying to find solution for hibernation during high RAM usage on my laptop - Toshiba Satellite L50-B-1K6. I am facing similar issues on my desktop PC.

My hardware configuration is:

$ inxi -Fx
Machine:   System: TOSHIBA (portable) product: SATELLITE L50-B v: PSKTCE-02G009Y4
           Mobo: Type2 - Board Vendor Name1 model: Type2 - Board Product Name1 v: Type2 - Board Version
           Bios: INSYDE v: 1.70 date: 08/14/2014
Battery    BAT1: charge: 7.2 Wh 29.5% condition: 24.2/30.0 Wh (81%) model: LGC PA5186U-1B status: Discharging
CPU:       Dual core Intel Core i5-4210U (-HT-MCP-) cache: 3072 KB
           flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 9580
           clock speeds: max: 2700 MHz 1: 1697 MHz 2: 1615 MHz 3: 1279 MHz 4: 1700 MHz
Graphics:  Card-1: Intel Haswell-ULT Integrated Graphics Controller bus-ID: 00:02.0
           Card-2: Advanced Micro Devices [AMD/ATI] Jet PRO [Radeon R5 M230] bus-ID: 09:00.0
           Display Server: X.Org 1.17.4 driver: intel Resolution: 1366x768@60.01hz
           GLX Renderer: Mesa DRI Intel Haswell Mobile GLX Version: 3.0 Mesa 12.0.1 Direct Rendering: Yes
Audio:     Card-1 Intel 8 Series HD Audio Controller driver: snd_hda_intel bus-ID: 00:1b.0
           Card-2 Intel Haswell-ULT HD Audio Controller driver: snd_hda_intel bus-ID: 00:03.0
           Sound: Advanced Linux Sound Architecture v: k4.7.2-1-MANJARO
Network:   Card-1: Intel Wireless 3160 driver: iwlwifi bus-ID: 07:00.0
           IF: wlp7s0 state: up mac: 30:3a:64:ef:d2:29
           Card-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller port: 4000 bus-ID: 08:00.0
           IF: N/A state: N/A speed: N/A duplex: N/A mac: N/A
Drives:    HDD Total Size: 1000.2GB (3.8% used) ID-1: /dev/sda model: HGST_HTS541010A9 size: 1000.2GB
Partition: ID-1: / size: 19G used: 13G (69%) fs: ext4 dev: /dev/sda11
           ID-2: /home size: 29G used: 15G (54%) fs: ext4 dev: /dev/sda12
           ID-3: swap-1 size: 9.01GB used: 0.00GB (0%) fs: swap dev: /dev/sda1
Sensors:   System Temperatures: cpu: 46.0C mobo: N/A gpu: N/A
           Fan Speeds (in rpm): cpu: N/A

Available RAM memory is 4 GB. SWAP partition is 9 GB.

Hibernation mostly depends on your HW config (my mistake was buying Toshiba of course) and kernel version.

My current kernel version is:

4.7.2.1

I had similar problems with older kernel versions (4.1, 4.4, 4.6, ...) also.

Tried various hibernation methods with no luck:

$ systemctl hibernate
$ sudo sh -c "echo disk > /sys/power/state"
$ pm-hibernate
$ s2disk
- TuxOnIce kernel

Problem is always similar - hibernate is sucessfull when my RAM usage is low, for example 500MB (12.5 %).

But when I start firefox (or some other high RAM usage program - 50% of RAM) and want to hibernate I am facing following issue.

During resume(thaw), swap space accumulates and hibernation eventually fails - after 3-7 hibernations.

System will hibernate sucessfully, but when I try to turn on laptop it restarts instead of resume(thaw).

Summary: Swap usage is increasing with every hibernation, your machine becomes slow and hibernation eventually fails - restart instead of resume.

This issue can be also found at:
https://ubuntuforums.org/showthread.php?t=1796851
https://www.kubuntuforums.net/showthread.php?59209-swap-gradually-filling-after-hibernate-resume

I'll post my workaround for this issue, and hope that you will post your tweaks - how you managed to fix this.

  • Apparently if you run top and press the f key, you can follow the instructions to enable a SWAP column (and sort by it). It would be very interesting to see whether top is able to account for the >>4GB of swap being used or not. – sourcejedi Sep 18 '16 at 10:19
0

When swap accumulates your PC/laptop becomes slow and hibernation eventually fails because there is not enough SWAP space for hibernation.

So solution is to manually empty swap partiton after return from hibernation (https://ubuntuforums.org/showthread.php?t=1796851&p=11011907#post11011907).

I've added function in my ~/.bashrc to handle this:

function nk-hibernate() {
    sudo sh -c "echo disk > /sys/power/state"
    # setsid i3lock -c 117864 # lock screen with tool of your choice
    sudo swapoff -a
    sudo swapon -a
}

Warning - swapoff can be really slow! How can swapoff be that slow?

When I want to hibernate I just open terminal and run:

$ nk-hibernate

After resume from hibernation, swap is cleaned (swapoff) and then again activated (swapon) in order to hibernate again.

If anyone knows better solution please share.

EDIT: As @sourcejedi mentioned, this doesn't solve problem completely. I had situation where laptop restarts after some period (10+ hibernations). This just speeds up machine after resume from hibernate

  • 1
    In that thread, it's not considered a solution. "Even with my swap displaying 0% [i.e. after swapoff], if I'm trying a 2nd or 3rd hibernation attempt since my last restart, it fails with that not enough swapfile prompt." – sourcejedi Sep 18 '16 at 10:05
  • Interesting that you can manage to fill >>4GB of swap with repeated hibernations. – sourcejedi Sep 18 '16 at 10:08
  • Hopefully someone here will post solution for your case also – nexayq Sep 18 '16 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.