hibernation with 12.04 wubi - any way?

Asked by Hartwig Kolbe on 2012-06-22

I am using a Ubuntu installation with wubi since a week, it works nicely. I can do everything I need, did not have to start-up Windows for several days, now.
However, traveling means depending on battery, and they tend to run out of power. When the system shuts down, all open things are lost, a major pain. Hibernation is the way to overcome that (restart using another battery, or power source).

I know, hibernation is not supported with wubi out of the box.
(see my tries so far in http://www.ubuntugeek.com/fix-for-suspend-and-hibernation-problem-for-laptops.html)
Is there any way to make it work?
Some ways to try may include e,g.:
- use a real swap partition of the right size
- use TuxOnIce
- ???

Did anyone try to get hibernation to work in wubi?
Or - is the only way moving Ubuntu to its own partition? If so, how to do that without loosing data (and access to them) in both, Windows and Ubuntu?

Question information

Language:
English Edit question
Status:
Solved
For:
Wubi Edit question
Assignee:
No assignee Edit question
Solved by:
bcbc
Solved:
2012-06-30
Last query:
2012-06-30
Last reply:
2012-06-29
bcbc (bcbc) said : #1

You can hibernate with a swap partition (basic steps outlined here: http://ubuntu-with-wubi.blogspot.ca/2011/01/swap-and-hibernation.html ). But if you decide to create a swap partition then I'd recommend just moving to a normal dual boot. Wubi works great for trying out Ubuntu, but I wouldn't rely on it as a production OS (if you do make sure you keep current backups outside of the virtual disk (on /host or an external drive, or in the cloud).

Hartwig Kolbe (kolbeb) said : #2

Thank you for the links and advices, I followed your recommendation to move to a dual boot:
I used your script to move the wubi install to a new partition, also created a swap partition, and got the grub..
It took some time, but everything seemed to go well. Ubuntu booted from the new partition.

Unfortunately, the Windows data were not accessible anymore. I solved that by editing fstab.
More difficult is that I can no longer boot Windows, it directly starts up Ubuntu.
I guess, grub starts from the small recovery partition at the very beginning of the drive, and does not see Windows on the second partition.

So far, I could not test the hibernation. I tried s2disk, but got an error message about the swap being not accessible.

Any ideas or links which can help me here?

Hartwig Kolbe (kolbeb) said : #3

P.S.: the message from s2disk was: "Could not use the resume device (try swapon -a). Reason: No such device"

bcbc (bcbc) said : #4

I recommend running the bootinfoscript and posting the RESULTS.txt on pastebin, then copying the pastebin link here. You can get the bootinfoscript at http://bootinfoscript.sourceforge.net/
(Note: the instructions are a bit out of date in that link - it's "sudo bash bootinfoscript" (you need to drop the .sh))

That will help me see what is going on.

You can also try running the following to update your grub menu:
sudo update-grub
(but the migration script should have picked up Windows).

After that we can look at why the hibernation issue isn't working by posting the results of the following commands:
cat /etc/fstab

sudo blkid

cat /etc/initramfs-tools/conf.d/resume

(The first two commands will already be in the bootinfoscript so if you've posted that, just give me the last one)
Thanks

Hartwig Kolbe (kolbeb) said : #5

Thanks for replying so fast.
in short:
- pastebin link of the bootinfoscript results: http://pastebin.com/gUMjdCGu

- sudo update-grub did not change the behavior

- initramfs-tools/conf.d/resume: RESUME=UUID=bb326607-3cb0-49d8-8c2b-c5bbbd753f41

bcbc (bcbc) said : #6

Because you set the Wubi install to be the default, it affects how Grub sees Windows. Grub is actually extracting it from the "Default" entry in the boot.ini, and since the default is "Ubuntu", that's what it displays.

So when you see: "Ubuntu (on /dev/sda2)" that's actually Windows, and selecting that will lead to your Windows boot manager screen with Ubuntu/Windows, so just select Windows from there and it should boot. Then go to your Startup & Recovery settings on Windows and change the default OS back to Windows, and then reboot into Ubuntu (migrated) and run "sudo update-grub" and it will change the menuentry to something like "Windows XP (on /dev/sda2)"

I'll post some more info on the hibernate thing soon. Please post the output of the following commands as well:

swapon -s

free

Thanks

bcbc (bcbc) said : #7

I figure you have 3.45GB of Swap, so that should exceed the size of your RAM in order to hibernate.
You can look at syslog to see any error messages:
cat /var/log/syslog | grep PM:

Make sure you test hibernation using this:
sudo pm-hibernate

Don't use s2disk.

To enable the Hibernate option on the system menu refer to this:
http://askubuntu.com/questions/94754/how-to-enable-hibernation-in-12-04

Hartwig Kolbe (kolbeb) said : #8

Thank you! That's a nice feature of grub, very disturbing. I'll try that tomorrow morning (booting Windows takes long time).

swapon -s
Filename Type Size Used Priority
/dev/sda5 partition 3375364 78156 -1

free
                  total used free shared buffers cached
Mem: 1267952 1146356 121596 0 46748 620180
-/+ buffers/cache: 479428 788524
Swap: 3375364 78152 3297212

syslog has some PM: entries at system start-up:

Jun 26 20:06:07 ubuntu kernel: [ 0.000000] PM: Registered nosave memory: 000000000009f000 - 00000000000a0000
Jun 26 20:06:07 ubuntu kernel: [ 0.000000] PM: Registered nosave memory: 00000000000a0000 - 00000000000e0000
Jun 26 20:06:07 ubuntu kernel: [ 0.000000] PM: Registered nosave memory: 00000000000e0000 - 0000000000100000
Jun 26 20:06:07 ubuntu kernel: [ 0.096005] PM: Registering ACPI NVS region at 4efcf000 (200704 bytes)
Jun 26 20:06:07 ubuntu kernel: [ 0.714609] PM: Hibernation image not present or could not be loaded.
Jun 26 20:06:07 ubuntu kernel: [ 2.713167] PM: Marking nosave pages: 000000000009f000 - 0000000000100000
Jun 26 20:06:07 ubuntu kernel: [ 2.713173] PM: Basic memory bitmaps created
Jun 26 20:06:07 ubuntu kernel: [ 2.738672] PM: Basic memory bitmaps freed

-----------
suspend-log has:

<...>
Running hook /usr/lib/pm-utils/sleep.d/55NetworkManager hibernate hibernate:
Having NetworkManager put all interaces to sleep...Failed.

/usr/lib/pm-utils/sleep.d/55NetworkManager hibernate hibernate: success.
<...>
Running hook /usr/lib/pm-utils/sleep.d/95anacron hibernate hibernate:
stop: Unknown instance:

/usr/lib/pm-utils/sleep.d/95anacron hibernate hibernate: success.
<...>
Running hook /etc/pm/sleep.d
/novatel_3g_suspend hibernate hibernate:

/etc/pm/sleep.d/novatel_3g_suspend hibernate hibernate: success.
Tue Jun 26 15:04:27 CST 2012: performing hibernate
s2disk: Could not use the resume device (try swapon -a). Reason: No such device
Tue Jun 26 15:04:28 CST 2012: Awake.
Tue Jun 26 15:04:28 CST 2012: Running hooks for thaw
Running hook /etc/pm/sleep.d/novatel_3g_suspend thaw hibernate:

I'll try that again tomorrow.

Hartwig Kolbe (kolbeb) said : #9

For the boot issue, you were right. I started up the "Ubuntu (on /dev/sda2)" - and the Windows boot loader came up. Then changed the sequence in Windows, in Ubuntu updated grub.
The boot issue is solved. Thank you!

For the hibernation issue, it seems, the system does not recognize - or cannot access - the swap partition at the time almost everything else was shut down successfully.
The error messages in syslog (at start-up) and pm-suspend.log (at pm-hibernate) point to problems with the swap.
In Windows, a special hibernation file needs to be prepared in advance. How is that done in Ubuntu?

bcbc (bcbc) said : #10

It is possible to hibernate with a swap file but it's not the supported way. I can point you at a howto, but can't help you with it beyond that since I've never tried it.

I know that you cannot hibernate with an encrypted swap partition (that doesn't seem to be the case here, and you'd know if it was). But other than that I can't understand why it wouldn't work... you have the resume file setup correctly, the swap is active, much bigger than your RAM, configured correctly in /etc/fstab - so this is puzzling.

After running "sudo pm-hibernate" please post the results of "cat /var/log/syslog | grep PM:" again.

If you've made any edits to /etc/default/grub please post that as well.

PS here is a link to that howto I mentioned - it appears to have been updated last in September 2011 - disclaimer: please don't take the posting of a link as a recommendation or any guarantee that it will work: http://ubuntuforums.org/showthread.php?t=1042946

Hartwig Kolbe (kolbeb) said : #11

Again, thank you for your time and efforts.
"you have the resume file setup correctly":
How to check that? I am not aware that I created/setup that resume file.

hartwig@ubuntu:~$ sudo pm-hibernate
[sudo] password for hartwig:
hartwig@ubuntu:~$ cat /var/log/syslog | grep PM:
Jun 28 13:26:51 ubuntu kernel: [18394.009859] PM: Marking nosave pages: 000000000009f000 - 0000000000100000
Jun 28 13:26:51 ubuntu kernel: [18394.009866] PM: Basic memory bitmaps created
Jun 28 13:26:51 ubuntu kernel: [18394.018413] PM: Basic memory bitmaps freed
hartwig@ubuntu:~$

what I am concerned about is the entry in /var/log/pm-suspend.log: "No such device":
Thu Jun 28 13:26:51 CST 2012: performing hibernate
s2disk: Could not use the resume device (try swapon -a). Reason: No such device
Thu Jun 28 13:26:51 CST 2012: Awake.

I tried some grub settings using Grub Customizer:
/etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'

GRUB_DEFAULT="0"
GRUB_HIDDEN_TIMEOUT="0"
GRUB_HIDDEN_TIMEOUT_QUIET="true"
GRUB_TIMEOUT="10"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL="console"

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE="640x480"

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID="true"

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

export GRUB_MENU_PICTURE="/media/Win_SYS/Documents and Settings/Kolbe/My Documents/My Pictures/ling-11.JPG"
export GRUB_COLOR_NORMAL="dark-gray/black"
export GRUB_COLOR_HIGHLIGHT="red/black"
GRUB_FONT="/boot/grub/unicode.pf2"

I will also have a look at the link you gave me.

bcbc (bcbc) said : #12

You posted the contents of the resume file:
 initramfs-tools/conf.d/resume: RESUME=UUID=bb326607-3cb0-49d8-8c2b-c5bbbd753f41

I'll have a look at this later today.

Best bcbc (bcbc) said : #13

I noticed that in post 1 you mentioned following instructions from http://www.ubuntugeek.com/fix-for-suspend-and-hibernation-problem-for-laptops.html which was created in 2008. It's never a good idea to follow instructions from far back unless you are sure they still apply.

So I think you should reverse any of the changes you made. Hopefully you backed up all files you changed.

Just FYI this is the output of my pm-suspend log for one hibernate/thaw:
Initial commandline parameters:
Thu Jun 28 00:24:29 PDT 2012: Running hooks for hibernate.
Running hook /usr/lib/pm-utils/sleep.d/000kernel-change hibernate hibernate:

/usr/lib/pm-utils/sleep.d/000kernel-change hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/00logging hibernate hibernate:
Linux neptune 3.2.0-25-generic #40-Ubuntu SMP Wed May 23 20:30:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Module Size Used by
ipt_MASQUERADE 12759 1
iptable_nat 13229 1
nf_nat 25891 2 ipt_MASQUERADE,iptable_nat
nf_conntrack_ipv4 19716 3 iptable_nat,nf_nat
nf_conntrack 81926 4 ipt_MASQUERADE,iptable_nat,nf_nat,nf_conntrack_ipv4
dm_crypt 23125 0
nf_defrag_ipv4 12729 1 nf_conntrack_ipv4
ip_tables 27473 1 iptable_nat
x_tables 29846 3 ipt_MASQUERADE,iptable_nat,ip_tables
bnep 18281 2
bridge 90989 0
stp 12931 1 bridge
rfcomm 47604 0
bluetooth 180104 10 bnep,rfcomm
bbswitch 13396 0
parport_pc 32866 0
ppdev 17113 0
snd_hda_codec_hdmi 32474 1
joydev 17693 0
snd_hda_codec_realtek 223867 1
binfmt_misc 17540 1
snd_hda_intel 33773 3
arc4 12529 2
uvcvideo 72627 0
snd_hda_codec 127706 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel
videodev 98259 1 uvcvideo
psmouse 87692 0
iwlwifi 332672 0
v4l2_compat_ioctl32 17128 1 videodev
snd_hwdep 13668 1 snd_hda_codec
snd_pcm 97188 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec
snd_seq_midi 13324 0
snd_rawmidi 30748 1 snd_seq_midi
snd_seq_midi_event 14899 1 snd_seq_midi
snd_seq 61896 2 snd_seq_midi,snd_seq_midi_event
snd_timer 29990 2 snd_pcm,snd_seq
dell_laptop 18119 0
dcdbas 14490 1 dell_laptop
dell_wmi 12681 0
snd_seq_device 14540 3 snd_seq_midi,snd_rawmidi,snd_seq
sparse_keymap 13890 1 dell_wmi
snd 78855 16 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
soundcore 15091 1 snd
serio_raw 13211 0
mac80211 506816 1 iwlwifi
cfg80211 205544 2 iwlwifi,mac80211
mei 41616 0
snd_page_alloc 18529 2 snd_hda_intel,snd_pcm
wmi 19256 1 dell_wmi
mac_hid 13253 0
lp 17799 0
parport 46562 3 parport_pc,ppdev,lp
i915 468745 4
r8169 62099 0
drm_kms_helper 46978 1 i915
drm 242038 5 i915,drm_kms_helper
i2c_algo_bit 13423 1 i915
video 19596 1 i915
             total used free shared buffers cached
Mem: 6005648 2318304 3687344 0 102576 859496
-/+ buffers/cache: 1356232 4649416
Swap: 6180860 60548 6120312

/usr/lib/pm-utils/sleep.d/00logging hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/00powersave hibernate hibernate:

/usr/lib/pm-utils/sleep.d/00powersave hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/01PulseAudio hibernate hibernate:
Sessions still open, not unmounting
Sessions still open, not unmounting
Sessions still open, not unmounting
Welcome to PulseAudio! Use "help" for usage information.
>>> >>> Sessions still open, not unmounting
Sessions still open, not unmounting
Welcome to PulseAudio! Use "help" for usage information.
>>> >>> Sessions still open, not unmounting
Welcome to PulseAudio! Use "help" for usage information.
>>> >>> Sessions still open, not unmounting

/usr/lib/pm-utils/sleep.d/01PulseAudio hibernate hibernate: success.
Running hook /etc/pm/sleep.d/10_grub-common hibernate hibernate:

/etc/pm/sleep.d/10_grub-common hibernate hibernate: success.
Running hook /etc/pm/sleep.d/10_unattended-upgrades-hibernate hibernate hibernate:

/etc/pm/sleep.d/10_unattended-upgrades-hibernate hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/55NetworkManager hibernate hibernate:
Having NetworkManager put all interaces to sleep...Failed.

/usr/lib/pm-utils/sleep.d/55NetworkManager hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/60_wpa_supplicant hibernate hibernate:
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory

/usr/lib/pm-utils/sleep.d/60_wpa_supplicant hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/75modules hibernate hibernate:

/usr/lib/pm-utils/sleep.d/75modules hibernate hibernate: not applicable.
Running hook /usr/lib/pm-utils/sleep.d/90clock hibernate hibernate:

/usr/lib/pm-utils/sleep.d/90clock hibernate hibernate: not applicable.
Running hook /usr/lib/pm-utils/sleep.d/94cpufreq hibernate hibernate:

/usr/lib/pm-utils/sleep.d/94cpufreq hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/95anacron hibernate hibernate:

/usr/lib/pm-utils/sleep.d/95anacron hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/95hdparm-apm hibernate hibernate:

/usr/lib/pm-utils/sleep.d/95hdparm-apm hibernate hibernate: not applicable.
Running hook /usr/lib/pm-utils/sleep.d/95led hibernate hibernate:

/usr/lib/pm-utils/sleep.d/95led hibernate hibernate: not applicable.
Running hook /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler hibernate hibernate:
Kernel modesetting video driver detected, not using quirks.

/usr/lib/pm-utils/sleep.d/98video-quirk-db-handler hibernate hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/99video hibernate hibernate:

/usr/lib/pm-utils/sleep.d/99video hibernate hibernate: success.
Running hook /etc/pm/sleep.d/novatel_3g_suspend hibernate hibernate:

/etc/pm/sleep.d/novatel_3g_suspend hibernate hibernate: success.
Thu Jun 28 00:24:31 PDT 2012: performing hibernate
Fri Jun 29 07:20:07 PDT 2012: Awake.
Fri Jun 29 07:20:07 PDT 2012: Running hooks for thaw
Running hook /etc/pm/sleep.d/novatel_3g_suspend thaw hibernate:

/etc/pm/sleep.d/novatel_3g_suspend thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/99video thaw hibernate:

/usr/lib/pm-utils/sleep.d/99video thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler thaw hibernate:

/usr/lib/pm-utils/sleep.d/98video-quirk-db-handler thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/95led thaw hibernate:

/usr/lib/pm-utils/sleep.d/95led thaw hibernate: not applicable.
Running hook /usr/lib/pm-utils/sleep.d/95hdparm-apm thaw hibernate:

/dev/sda:
 setting Advanced Power Management level to 0x80 (128)
 APM_level = 128

/dev/sda:
 setting standby to 36 (3 minutes)

/usr/lib/pm-utils/sleep.d/95hdparm-apm thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/95anacron thaw hibernate:

/usr/lib/pm-utils/sleep.d/95anacron thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/94cpufreq thaw hibernate:

/usr/lib/pm-utils/sleep.d/94cpufreq thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/90clock thaw hibernate:

/usr/lib/pm-utils/sleep.d/90clock thaw hibernate: not applicable.
Running hook /usr/lib/pm-utils/sleep.d/75modules thaw hibernate:
Reloaded unloaded modules.

/usr/lib/pm-utils/sleep.d/75modules thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/60_wpa_supplicant thaw hibernate:
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory

/usr/lib/pm-utils/sleep.d/60_wpa_supplicant thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/55NetworkManager thaw hibernate:
Having NetworkManager wake interfaces back up...Failed.

/usr/lib/pm-utils/sleep.d/55NetworkManager thaw hibernate: success.
Running hook /etc/pm/sleep.d/10_unattended-upgrades-hibernate thaw hibernate:

/etc/pm/sleep.d/10_unattended-upgrades-hibernate thaw hibernate: success.
Running hook /etc/pm/sleep.d/10_grub-common thaw hibernate:

/etc/pm/sleep.d/10_grub-common thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/01PulseAudio thaw hibernate:
Sessions still open, not unmounting
Welcome to PulseAudio! Use "help" for usage information.
>>> >>> Sessions still open, not unmounting
Sessions still open, not unmounting
Welcome to PulseAudio! Use "help" for usage information.
>>> >>> Sessions still open, not unmounting
Welcome to PulseAudio! Use "help" for usage information.
>>> >>> Sessions still open, not unmounting

/usr/lib/pm-utils/sleep.d/01PulseAudio thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/00powersave thaw hibernate:

/usr/lib/pm-utils/sleep.d/00powersave thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/00logging thaw hibernate:

/usr/lib/pm-utils/sleep.d/00logging thaw hibernate: success.
Running hook /usr/lib/pm-utils/sleep.d/000kernel-change thaw hibernate:

/usr/lib/pm-utils/sleep.d/000kernel-change thaw hibernate: success.
Fri Jun 29 07:20:09 PDT 2012: Finished.

Hartwig Kolbe (kolbeb) said : #14

wow, it was uswsusp.
I installed it because it seemed to promise to be working with a swap file, like in a wubi installation. It did not work that way, and I do not have a wubi installation anymore.
I had it hibernate (save to swap and turn off) successfully, but the resume did not work, always resulted in a cold boot.

I purged uswsusp, and hibernation works now, including resume.
Thank you very much for your help!

Hartwig Kolbe (kolbeb) said : #15

Thanks bcbc, that solved my question.

bcbc (bcbc) said : #16

Great... good work