Error -12 hibernation image. Not enough free memory (sometimes)
- by user99306
I am having a problem with hibernation in Ubuntu 12.10, it had worked fine in 12.04. When I try and hibernate it sometimes appears to hibernate throws up an error and returns me to the desktop. The error I get is this:
PM: Creating hibernation image:
PM: Need to copy 375021 pages
PM: Normal pages needed: 117957 + 1024, available pages: 110205
PM: Not enough free memory
PM: Error -12 creating hibernation image
Now I understand what the error means, but it doesn't make sense. My swap file is 5GB and is seldom ever used as I have 4GB of RAM. I know it is recommended to have 1.5 times more swap than RAM etc, but space doesn't seem to be the problem, despite the error.
For example, I rarely use more than about 25%-30% of my RAM, yet still have the problem above.
Moreover on a fresh boot and login, with no programs open and using only about 12% of RAM, I can get the above error - yet at other times I can hibernate whilst using 25% of my RAM.
Also if I keep trying to hibernate, it eventually does after throwing up the above error four or five times. A successful hibernation looks like this:
PM: Creating hibernation image:
PM: Need to copy 295511 pages
PM: Normal pages needed: 95534 + 1024, available pages: 132627
Is there some setting that I need to tweak or something I need to do before hibernating to avoid this problem?
I guess the question could be better interpreted as: Is there some way of safely flushing the buffers and the cache before hibernation? Other than attempting to hibernate several times until it is successful!
Thanks in advance.