# Problems with tuxonice and pm-utils [SOLVED]

## nichocouk

Hi,

I am trying to suspend to disk but I have a problem with not enough space available it seems. However I would hope that my swap partition is big enough to receive the image.

I'm not quite able to find the relevant help on the web it seems... So after long searches, I am looking for help on this forum!

```
kernel version: 3.0.35-tuxonice$
```

The dmesg output following a failed hibernation attempt is:

```

[10405.575423] TuxOnIce 3.2, with support for usm, compression, block i/o, swap storage, file storage, userui.

[10405.576397] Initiating a hibernation cycle.

[10405.582510] Starting other threads.

[10405.582585] Stopping fuse filesystems.

[10405.582592] Freezing user space processes ... (elapsed 0.01 seconds) done.

[10405.594869] Stopping normal filesystems.

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

[10405.995992] Restarting normal filesystems.

[10408.433500] Asked shrink_all_memory for 44219 low pages & 0 pages from anywhere, got -7374.

[10408.433510] Stopping fuse filesystems.

[10408.433516] Freezing user space processes ... (elapsed 0.00 seconds) done.

[10408.434573] Stopping normal filesystems.

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

[10409.857016] Restarting normal filesystems.

[10409.887200] Stopping fuse filesystems.

[10409.887206] Freezing user space processes ... (elapsed 0.00 seconds) done.

[10409.887986] Stopping normal filesystems.

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

[10410.282732] Restarting normal filesystems.

[10410.526947] Asked shrink_all_memory for 45791 low pages & 0 pages from anywhere, got 21817.

[10410.526963] Stopping fuse filesystems.

[10410.526969] Freezing user space processes ... (elapsed 0.00 seconds) done.

[10410.527820] Stopping normal filesystems.

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

[10410.721597] Restarting normal filesystems.

[10410.724100] Stopping fuse filesystems.

[10410.724105] Freezing user space processes ... (elapsed 0.00 seconds) done.

[10410.724895] Stopping normal filesystems.

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

[10410.917080] Free:1079142(1079142). Sets:70143(70143),149105(149105). Nosave:12314-0=12314. Storage:195166/195166(221248=>219248). Needed:0,0,24082(100,1297,2000,-2) (PS2:no)

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

[10410.917086] - The maximum number of iterations was reached without successfully preparing the image.

[10410.917089]  - We need at least 219248 pages of storage (ignoring the header), but only have 195166.

[10410.917130] Restarting all filesystems ...

[10410.917871] Restarting tasks ... done.

[10410.936457] video LNXVIDEO:00: Restoring backlight state

[10410.941734] TuxOnIce debugging info:

[10410.941736] - TuxOnIce core  : 3.2

[10410.941737] - Kernel Version : 3.0.35-tuxonice

[10410.941738] - Compiler vers. : 4.6

[10410.941739] - Attempt number : 4

[10410.941740] - Parameters     : 4105 667648 0 0 -2 5

[10410.941741] - Overall expected compression percentage: 0.

[10410.941742] - Compressor is 'lzo'.

[10410.941743] - Block I/O active.

[10410.941744]   Used 0 pages from swap on /dev/sda6.

[10410.941745] - Max outstanding reads 1. Max writes 0.

[10410.941746]   Memory_needed: 1024 x (4096 + 336 + 104) = 4644864 bytes.

[10410.941748]   Free mem throttle point reached 0.

[10410.941749] - Swap Allocator enabled.

[10410.941750]   Swap available for image: 195800 pages.

[10410.941751] - File Allocator active.

[10410.941752]   Storage available for image: 0 pages.

[10410.941753] - No I/O speed stats available.

[10410.941754] - Extra pages    : 0 used/2000.

[10410.941755] - Result         : Hibernation was aborted.

[10410.941756]                  : Insufficient storage was available.

[10410.941758]                  : We were unable to successfully prepare an image.

```

I am not sure what other information would be needed at this stage...

I should point out that if I close most applications, hibernation works. But that is kind of annoying   :Sad: 

----------

## Hu

Kernel 3.0 is somewhat old.  Does this work with a newer kernel?  What is the output of free -m?  Do you need TuxOnIce or can you use one of the other suspend methods?

Since it works when you close out applications, that suggests to me that your swap partition is not big enough.

----------

## nichocouk

Hello Hu,

thanks for looking at this.

```
$ free -m

             total       used       free     shared    buffers     cached

Mem:          4925        873       4052          0         12        240

-/+ buffers/cache:        620       4305

Swap:         1035        262        772

```

It looks like my swap partition is only 1035 Megabytes. I should probably have a bigger value there?

I am on amd64, and tuxonice-sources-3.0.35 is the latest stable ebuild.

In principle I am not against other methods, but I was under the impression that tuxonice + pm-utils was the right combination for relatively recent laptops?

Cheers,

----------

## Hu

I have used uswsusp exclusively for recent laptops.  Yes, that swap partition looks much too small.  You should at least double it, but making it equal in size to your RAM would be better.

----------

## nichocouk

Well, I'm unsure of what are the required steps to increase the size of my swap partition (I must have messed up my partitioning when I installed gentoo a while ago). I'll try to think about it.

But wouldn't it be quicker to work with a swap file rather than playing with my partitions?

I have tried the method outlined in the gentoo wiki, but I get stuck when activating the swap partition:

```

# dd if=/dev/zero of=/swapfile bs=1M count=0 seek=4925

0+0 records in

0+0 records out

0 bytes (0 B) copied, 0.000210157 s, 0.0 kB/s

# mkswap /swapfile

Setting up swapspace version 1, size = 5043196 KiB

no label, UUID=a199b42d-ca9b-41f7-b826-24600879e5fc

# swapon /swapfile

swapon: /swapfile: skipping - it appears to have holes.

```

So the file has holes.   :Confused: 

----------

## nichocouk

I've managed to produce the swap file by using 

```
dd if=/dev/zero of=/swapfile bs=1024 count=5043200
```

Now I just have to reboot and see if my hibernation works better.

----------

## nichocouk

OK, so it seems that I can report adding the swap file has solved my issues. The funny thing is that, according to dmesg, the swap file is never used for hibernation by tuxonice. It seems to be doing fine with the swap partition only (which hasn't changed).

So I suppose that somehow, the rest of my system is using the swap file? Which would then make the swap partition more available for hibernation?

```
$ free -k

             total       used       free     shared    buffers     cached

Mem:       5044040    1995600    3048440          0      13224     393436

-/+ buffers/cache:    1588940    3455100

Swap:      6103448          0    6103448

```

By the way, I think that in the Gentoo wiki on Tuxonice, it should be made clear that when you create a swap file, you have to add a corresponding entry in your fstab file to make the swap activation on that file permanent.

E.g. I now have in /etc/fstab:

```
/dev/sda6      none      swap      sw      0 0

/swapfile      none      swap      sw      0 0

```

Anyway, I'm happy now as it seems I can hibernate with still most of my applications open and running without trouble.

Cheers

----------

## razer

 *nichocouk wrote:*   

> OK, so it seems that I can report adding the swap file has solved my issues. The funny thing is that, according to dmesg, the swap file is never used for hibernation by tuxonice. 

 

you have to specify special kernel args for swap file : take look here https://wiki.archlinux.org/index.php/TuxOnIce#Suspend_to_swap_file

 *Hu wrote:*   

> I have used uswsusp exclusively for recent laptops.  Yes, that swap partition looks much too small.  You should at least double it, but making it equal in size to your RAM would be better.

 

Once you try tuxonice, you realize that default hibernate from kernel + user space is a joke imho. It is so slooow and unfeatured vs tuxonice.

I never understood why Cunningham code is not the default

----------

## Hu

I never found uswsusp to be slow, nor have I missed any of the TuxOnIce features.  When I used TuxOnIce, I regularly missed being able to update when I wanted, because out-of-tree patches tended to lag.  Also, I seem to recall experiencing an unacceptably high number of crash-on-hibernate events while using TuxOnIce.  Nigel Cunningham's code is not the default because it is out-of-tree and past attempts to merge it have been unsuccessful.

----------

## razer

 *Hu wrote:*   

> I never found uswsusp to be slow, 
> 
> 

 

weird... For my usage you can't even compare both hibernate/resume times

swsusp take so long you miss any advantage to do hibernation, since it's about the same time before having desktop usable.

It seems also that something go wrong with swap usage, because it grows every hibernate cycle, and so became more and more slower.

Sure that on my own PC with an recent SSD, tuxonice give not clear benefit, but on my small laptop with slow hdd, swsusp is not usable

----------

