domingo, 6 de julio de 2014

Hibernating on power button with Debian

It's been years since I started hibernating my machine by pressing the power button instead of halting it. This started at work, my mate Ramón wanted to get all machines automatically hibernated through the night and was doing some tests on the old Windows XP, I didn't knew how to hibernate at Linux at that time, so I started taking a look at it, saw it was easy and worked flawlessly, and so I've been doing it since then (how the Windows thing ended is another story with another end).

Lately what I had done was install acpi-support package and at /etc/acpi/events/powerbtn-acpi-support file I changed its action to: action=/etc/acpi/sleep_suspend.sh suspend Which basically means when you press the power button hibernate (suspend to disk).

This used to work ok on most of my devices, however an old AMD socket 939 board did two hibernations each time the power button was pressed, and you could see the machine go to hibernate when you were waking it up. It seems I even had blogged about this here.

My latest solution for this problem seems that it was as simple as to do this little change to /etc/acpi/sleep_suspend.sh: 29c29 < pm-hibernate --- > (sleep 1;pm-hibernate) & I don't remember how I ended up with this solution instead of my first locking solution, but it did work for my desktop until it left sysvinit in favour of upstart but that's another story.

The thing is that ever since kernel 3.14 started to hit Debian I found the same sleep two times problem on my old laptop as well, and this still happens on 3.15.3. I have applied my solution to sleep_suspend.sh and it still works, but... I think I'll have to pick the details on this and file a bug, the question is... against Debian kernel? or try to post again to the linux-acpi mailing list like I did on 2011 and see if we get better results this time?

We'll see tomorrow, now it is time to go to bed, night.