1

I installed Ubuntu 11.10 on my machine and I notice several problems with the Hibernate functionality. When I use s2disk/pm-hibernate, I see an embarrassingly slow wakeup from the hibernate state. I am talking on the order of 5-6 minutes when Windows 7 on the same system resumes within 1 minute even when I hibernate with a slightly loaded system. But this slow resume from hibernate is unacceptable and I would be glad if someone can help me repair it. I have a Core i5 processor with 8GB RAM. I have set about 6GB of hard disk space for swap. It would be helpful if someone can help me identify and rectify the bottleneck in the resume process.

Also with Windows 7 I was able to setup my system to wake up from hibernate state automatically at a specified time. But I am not able to get the same functionality running on linux. I am following this Automatic System Wakeup Guide.

Thanks for your help!

Update:

Interesting observation from /var/log/kern.log

During s2disk stage: I see the following log message:

Jan 16 01:38:00 pc kernel: [10682.575070] PM: Preallocating image memory... done (allocated 1902274 pages)
Jan 16 01:38:00 pc kernel: [10706.894027] PM: Allocated 7609096 kbytes in 24.33 seconds (312.74 MB/s)

This seems to be the bottleneck of s2disk stage.

During resume the only time consuming steps as per kern.log are:

Jan 16 01:38:01 pc kernel: [10709.361876] video LNXVIDEO:00: Restoring backlight state
Jan 16 01:38:13 pc kernel: [10726.919537] wlan0: authenticate with c0:c1:c0:f0:68:6b (try 1)

This takes 12 seconds.

Jan 16 01:38:15 pc kernel: [10728.620666] [drm:drm_mode_getfb] *ERROR* invalid framebuffer id
Jan 16 01:38:17 pc kernel: [10730.903990] wlan0: deauthenticated from *:*:*:*:*:6b (Reason: 15)

This takes 2 seconds.

Jan 16 01:38:17 pc kernel: [10730.967287] cfg80211: Calling CRDA to update world regulatory domain
Jan 16 01:38:19 pc kernel: [10732.265611] wlan0: authenticate with *:*:*:*:*:6b (try 1)

This takes 2 seconds.

Jan 16 01:38:19 banga-pc kernel: [10732.271086] wlan0: associated
Jan 16 01:38:35 banga-pc kernel: [10748.866054] cfg80211: Ignoring regulatory request Set by core since the driver uses its own custom regulatory domain
Jan 16 01:38:35 banga-pc kernel: [10748.866063] cfg80211: World regulatory domain updated:

This takes 16 seconds.

Rest all the log messages are closely spaced in time. This does not explain the 5-6 minute resume time. Also after about 2 minutes of power on I do see the windows and everything but the system takes about 3-4 minutes to become usable. Until then I do not see the mouse pointer and the keyboard does not work. The screen remains frozen until then as if waiting on sudo s2disk I had issued before hibernating the system.

Strange but I do need help to fix this soon. I am used to < 30 seconds resume time and restarting my computer < once per week. I would be delighted if I could get the same with Ubuntu. I also need help to fix the ACPI Wakeup thing I mentioned above.

In case it matters I have an integrated Intel graphics card on my laptop.

  • You might want to try tuxonice , it's much better than original implemention , like compression and a UI available – daisy Jan 16 '12 at 07:15

3 Answers3

3

The bottle neck is that you have to write 8 GB of RAM to disk, worse yet you have to sort through 6 GB of swap to determine which data goes with what. Maybe try shrinking the swap partition (or removing it entirely, you have enough RAM) and see if that helps at all. Otherwise, we'll need to see some log files. man dmesg and man syslog

It could also be stubborn hardware. Hard to say at this point.

Huckle
  • 7,188
  • I tried swapoff -a and that stops hibernate altogether. Whats with this? If I have sufficient RAM, then the swap may not be in use under routine usage of the system. (swapon -s shows 0 in use). Why would the hibernate process worry about swap space then? – Rohit Banga Jan 16 '12 at 04:44
  • s2disk: Could not use the resume device (try swapon -a). Reason: No such device – Rohit Banga Jan 16 '12 at 04:57
  • It was my understanding that the linux kernel does not need swap at all to operate (although it speeds things up considerably) this understanding may no longer be true. – Huckle Jan 16 '12 at 05:08
  • http://www.freesoftwaremagazine.com/articles/hibernate_linux this site seems to indicate that (for swsusp) turning the swap off and then on again will speed up resumes. – Huckle Jan 16 '12 at 05:09
  • http://manpages.ubuntu.com/manpages/hardy/man8/uswsusp.conf.8.html here is some info about the conf file used for s2disk (from your comment) there is a setting in there to make the saved image as small as possible. There is also another setting to increase verbosity in the logfiles. – Huckle Jan 16 '12 at 05:14
1

Just resize swap to 8GB because during hibernation the RAM data write into swap. How many data is able to write to swap now? 6 GB. How many data maybe writing to RAM? 8 GB. 8 minus 6 is 2 missed GB.

  • Well I have two contradicting answers (this and @Huckle's) ... can you please offer some citation? Also I do not have additional space on my harddisk. – Rohit Banga Jan 16 '12 at 04:47
  • Going through this ubuntu page on swap space (https://help.ubuntu.com/community/SwapFaq). What you said does seem to be true? I do not have additional space on my hard disk, can I use a swap file instead. – Rohit Banga Jan 16 '12 at 05:14
  • I don't think it is likely he has 8 GB of active RAM usage. In addition recent suspend programs generally don't save every single detail, they'll send signals out to programs to dump unused memory first. Also, on that ubuntu help page it has an example for 'high ram, low disk' where the swap is smaller than the RAM. – Huckle Jan 16 '12 at 05:15
  • You can always boot to a live CD and use gparted to shrink filesystems to make room for a few GB more swap. – Huckle Jan 16 '12 at 05:18
  • I will try gparted ... just to add I have a dual boot system with an extended partion in windows. Part of this extended partition contains a logical drive formatted in ntfs. It stores my data. The rest of the extended partition contains ext4 and swap partitions. I have to use a swap partitions as three of my partitions are reserved by Dell Utility, Windows Recovery and Windows 7 OS. I cannot have a separate primary partition as then I will not be able to keep my data in a separate partition (limit of 4 primary partitions) hence this weird setup. – Rohit Banga Jan 16 '12 at 05:42
  • No need to create a new swap partition (may not be that easy see this answer). You can always create swap on a file. – Takkat Jan 16 '12 at 07:44
  • Are you use ext4 on the your largest partition? – Andrei Zaikin Jan 16 '12 at 08:01
  • Yes. It is true. See chapter 3. – Andrei Zaikin Jan 16 '12 at 08:07
  • No ext4 is not on the largest partition. However the extended partition housing ext4 is almost as large as the largest partition on which windows is installed. Do the logs in my updated question offer any clue? – Rohit Banga Jan 16 '12 at 20:53
  • The logs make me think this has nothing to do with the RAM at all and everything to do with hardware. Does your wireless card come out / are you comfortable disassembling a few panels of your laptop? – Huckle Jan 17 '12 at 02:39
  • This is a new laptop and under warranty so I guess I should not disassemble it. – Rohit Banga Jan 17 '12 at 12:17
  • So is there no option but to disassemble it. How about disabling wireless? – Rohit Banga Jan 18 '12 at 04:49
  • disabling the wireless before going to hibernate did help. Brought down the resume time to under 2 minutes. But what would be a permanent solution. I have Intel Corporation Centrino Wireless-N 1030 card. – Rohit Banga Jan 18 '12 at 05:08
0

You should check your swappiness value. Usually it is left at 60. It should be 10 or 15:

cat /proc/sys/vm/swappiness

You can change it on the fly with

sudo bash -c "echo -e 10 > /proc/sys/vm/swappiness"

and make it stick with

sudo bash -c "echo 'vm.swappiness = 15' >> /etc/sysctl.conf"

rtega
  • 111