# [SOLVED] Hibernate - swap partition not found

## slackline

Trying to finally get hibernate to disk sorted and have hit a problem.

When I hibernate I'm told there is no swap partition...

```
# hibernate -v3

hibernate: Trying method in tuxonice.conf...

hibernate: Including configuration from common.conf

hibernate: [01] Executing CheckLastResume ...

hibernate: [01] Executing CheckRunlevel ...

hibernate: [01] Executing LockFileGet ...

hibernate: [01] Executing NewKernelFileCheck ...

hibernate: [10] Executing EnsureTuxOnIceCapable ...

hibernate: [11] Executing XHacksSuspendHook1 ...

hibernate: [59] Executing RemountXFSBootRO ...

hibernate: [89] Executing SaveKernelModprobe ...

Saved /proc/sys/kernel/modprobe is /sbin/modprobe

hibernate: [91] Executing ModulesUnloadBlacklist ...

Unloading blacklisted modules listed /etc/hibernate/blacklisted-modules

Module version for ipw2100 is

Module version for ipw2200 is

Module version for snd_bt_sco is

Module version for ndiswrapper is

hibernate: [95] Executing XHacksSuspendHook2 ...

xhacks: changing console from 7 to 15

hibernate: [97] Executing ChangeToTuxOnIceVT ...

hibernate: [98] Executing CheckRunlevel ...

hibernate: [98] Executing FullSpeedCPUSuspend ...

Switched to performance, with min freq at 1601000

Switched to performance, with min freq at 1601000

Switched to performance, with min freq at 1601000

Switched to performance, with min freq at 1601000

hibernate: [98] Executing TuxOnIceConfigSet ...

hibernate: [99] Executing DoTuxOnIce ...

hibernate: Activating TuxOnIce ...

hibernate: TuxOnIce reported the following errors:

 - TuxOnIce was aborted (see dmesg).

 - No swapspace was available. Try swapon?

---- Output from dmesg: ----

 [ 4909.855719] TuxOnIce 3.3, with support for checksumming, usm, compression, block i/o, file storage, userui.

 [ 4909.855956] Initiating a hibernation cycle.

 [ 4909.858329] Console is 48x170.

 [ 4909.858728] Starting other threads.Freezing user space processes ... (elapsed 0.01 seconds) done.

 [ 4909.869313] Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.

 [ 4909.880393] No storage available. Didn't try to prepare an image.

 [ 4909.880398] Failed to prepare the image because...

 [ 4909.880398] - You need some storage available to be able to hibernate.

 [ 4909.880432] Restarting tasks ... done.

 [ 4909.883232] video LNXVIDEO:01: Restoring backlight state

 [ 4909.883635] TuxOnIce debugging info:

 - TuxOnIce core  : 3.3

 - Kernel Version : 3.7.1-tuxonice

 - Compiler vers. : 4.6

 - Attempt number : 5

 - Parameters     : 5 667656 0 1 -2 0

 - Overall expected compression percentage: 0.

 - Checksum method is 'md4'.

   0 pages resaved in atomic copy.

 - Compressor is 'lzo'.

 - Block I/O active.

 - Max outstanding reads 1. Max writes 0.

   Memory_needed: 1024 x (4096 + 344 + 104) = 4653056 bytes.

   Free mem throttle point reached 0.

 - File Allocator active.

   Storage available for image: 0 pages.

 - No I/O speed stats available.

 - Extra pages    : 0 used/2000.

 - Result         : Hibernation was aborted.

                  : No storage was available.

---- End of dmesg output ----

hibernate: [98] Executing FullSpeedCPUResume ...

hibernate: [97] Executing ChangeFromTuxOnIceVT ...

hibernate: [90] Executing ModulesLoad ...

hibernate: [89] Executing RestoreKernelModprobe ...

hibernate: [85] Executing XHacksResumeHook2 ...

xhacks: changing console back to 7

hibernate: [70] Executing ClockRestore ...

hibernate: [59] Executing RemountXFSBootRW ...

hibernate: [11] Executing XHacksResumeHook1 ...

hibernate: [01] Executing NoteLastResume ...

hibernate: [01] Executing LockFilePut ...

hibernate: [00] Executing RemoveTuxOnIceProcCruft ...

```

However, there is a swap partition and its on/activated...

```

# fdisk -l

Disk /dev/sda: 128.0 GB, 128035676160 bytes, 250069680 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x50e9e9dd

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *          63    40001849    20000893+  83  Linux

/dev/sda2        40001850   245876735   102937443   83  Linux

/dev/sda3       245876736   250068991     2096128   82  Linux swap / Solaris

# swapon -s

Filename            Type      Size   Used   Priority

/dev/sda3                                 partition   2096124   0   -1

```

...and /etc/fstab entry looks like...

```

/dev/sda3      none      swap      sw      0 0

```

I've configured the kernel sources (sys-kernel/tuxonice-3.7.1) to have /dev/sda3 as the default partition....

```

# grep 'sda3' /usr/src/linux/.config

CONFIG_PM_STD_PARTITION="/dev/sda3"

```

as well as the other recommendations in the Wiki TuxOnIce.

I'm trying to use the sys-power/hibernate-script-2.0-r6 and have the following configuration...

```

# cat /etc/hibernate/tuxonice.conf 

# Example tuxonice.conf file.

# 

# See hibernate.conf(5) for help on the configuration items.

#

# NOTE: TuxOnIce is an improved version of suspend-to-disk which currently

#       requires patching your kernel. For more information, see www.tuxonice.net

# 

#       If you do not wish to patch your kernel but still be able to suspend to

#       disk, see disk.conf instead.

### TuxOnIce

UseTuxOnIce yes

Reboot no

EnableEscape yes

DefaultConsoleLevel 1

Compressor lzo

Encryptor none

# ImageSizeLimit 200

## useful for initrd usage:

SuspendDevice swap:/dev/sda3

## Powerdown method - 3 for suspend-to-RAM, 4 for ACPI S4 sleep, 5 for poweroff

# PowerdownMethod 5

## Any other /proc/software_suspend setting can be set like so:

# ProcSetting expected_compression 50

## Or traditionally like this:

# TuxOnIceAllSettings 0 0 2056 65535 5

## Or even from the results of hibernate --save-settings with this:

# TuxOnIceAllSettingsFile /etc/hibernate/suspend-settings.conf

## For filewriter:

# FilewriterLocation /suspend_file 1000

# VerifyFilewriterResume2 yes

## Specify a userui like this:

ProcSetting userui_program /sbin/tuxoniceui

# Scale CPU to full speed to make sure we suspend as fast as possible.

FullSpeedCPU yes

Include common.conf

```

Any thoughts on why the hibernate script is reporting no usable swap space when there clearly is a swap partition and its on?

Bit of a show stopper really, tips and advice appreciated.

Cheers

slack

----------

## albright

I use a swapfile on my notebook and it works fine

My SuspendDevice line is commented out; I don't mess

with initrd

try commenting that line and see what happens if you've

got the inclination

----------

## slackline

Thanks for the suggestion, I've just tried commenting out the 'SuspendDevice' line in /etc/hibernate/tuxonice.conf but no joy, still complains "No swapspace was available. Try swapon?".

----------

## sebB

```
[ 4909.880398] Failed to prepare the image because...

[ 4909.880398] - You need some storage available to be able to hibernate. 
```

```
Memory_needed: 1024 x (4096 + 344 + 104) = 4653056 bytes. 
```

```
/dev/sda3                                 partition   2096124
```

Seems you don't have enough swap

----------

## slackline

 *sebB wrote:*   

> 
> 
> ```
> [ 4909.880398] Failed to prepare the image because...
> 
> ...

 

I was kind of hoping that because I'm using LZO compression that I could get away with a swap partition thats roughly 50% of the physical RAM, hence a 2Gb partition.

Certainly at present I would hope that the image size compresses to <2Gb and fits into the swap partition as its only ~2.5Gb, yet hibernate fails as above (and if there were insufficient space I'd sort of suspect that the error would report the swap as being too small rather than needing to be turned on, which it is as this also shows, but it doesn't seem to be recognised).

```
# free

             total       used       free     shared    buffers     cached

Mem:       3954084    2580480    1373604          0     241156    1800136

-/+ buffers/cache:     539188    3414896

Swap:      2096124          0    2096124

```

This suggests you can get fairly decent compression.  And I read somewhere (sorry can't find the link now) that the swap partition should be between 50-75% of physical RAM hence my choice at the lower limit.  Are there any other guidelines, what are the numbers in the "Memory_needed" line representing?  That total seems to come out higher than 'free' reports the physical RAM (ie. 3954084). Why would more swap than physically exists be required, especially if compression is being used?

Hibernate also says right after how much memory is needed that the available is zero which suggests perhaps that its not finding any of the swap partition?

```

   Memory_needed: 1024 x (4096 + 344 + 104) = 4653056 bytes.

   Free mem throttle point reached 0.

 - File Allocator active.

   Storage available for image: 0 pages.

```

Slightly confusing and I'm keen to understand this better so pointers to documentation would be great if anyone has any.

Cheers

slack

----------

## x22

The log mentions file allocator but not swap allocator.

Is swap allocator enabled in kernel configuration (under TuxOnIce)?

----------

## slackline

 *x22 wrote:*   

> The log mentions file allocator but not swap allocator.
> 
> Is swap allocator enabled in kernel configuration (under TuxOnIce)?

 

Nail hit squarely hit on head.

Brilliant, thank you very much.

My own fault as I had originally been planning on going with hibernating to a file, but when reading the guide on the wiki it described setting up a file to hold the image (space that I had hoped not to have to dedicate to hibernation) I figured a partition was the sensible way forward.

Hibernates fine and as its on an SSD resumes pretty damn quickly too \o/

Thanks for pointing out my obvious mistake, very much appreciated.

slack

----------

