News for hackers. Stuff that matters.

Ask HN: Any tips on debugging Linux hibernate issues?

I tried posting on r/linuxquestions but the only response I got was generally unhelpful. I thought I would try here since this seems like a more professional crowd.

I have two laptops: Thinkpad T540p, Dell Insprion.

I've had the thinkpad for ~2 years. Hibernate has never worked consistently on it. I can usually get it to resume once or twice, but after I try to do anything useful, it will freeze when waking up.

About a month ago I bought the Inspiron for my wife. It seems to have the same issue. I had always assumed that the Thinkpad had issues because it had a dedicated Nvidia graphics card. But the inspiron only has onboard Intel, so that seems to not be the issue.

I found [this article](https://01.org/blogs/rzhang/2015/best-practice-debug-linux-suspend/hibernate-issues) and set the `no_console_suspend` boot parameter on both laptops.

Both go through the resume process and everything seems to go fine until they get stuck at a call to `lapic_suspend`. It looks like to me that is the call that starts hibernate, and it is trying to come back out of it and resume execution. Except for whatever reason, both laptops get hung instead.

Has anyone experienced this issue? Any tips? Hibernate has always worked great for me up until these two laptops.

Both are running Debian Unstable. This is the current `uname -a`: `Linux Babel 4.7.0-1-amd64 #1 SMP Debian 4.7.8-1 (2016-10-19) x86_64 GNU/Linux`

I am a software developer by trade and wouldn't mind digging through source code if it came to that, but I'm just not even sure where to start.

( 14 comments | 17 points | on HN )
Re:Ask HN: Any tips on debugging Linux hibernate issues? by amboar on Sunday November 06, 2016 @04:52PM (#12887273)
This is a shot in the dark but some nasty hibernation bugs are fixed in 4.8[1]. It's probably worth booting a kernel from that series to see if it helps.

[1] https://lwn.net/Articles/701639/

Re:Ask HN: Any tips on debugging Linux hibernate issues? by war1025 on Monday November 07, 2016 @06:12PM (#12896128)
So far it looks like this may have been the issue. I've done some stress testing of things that always made it fail to resume in the past, and it has successfully woken up each time.

Thanks for the tip!

Re:Ask HN: Any tips on debugging Linux hibernate issues? by amboar on Tuesday November 08, 2016 @05:34AM (#12899107)
Great! Thanks for taking the time to reply. Unresolved questions always bug me.
Re:Ask HN: Any tips on debugging Linux hibernate issues? by war1025 on Sunday November 06, 2016 @05:19PM (#12887420)
Thanks for the tip. Install 4.8 now to try it out.
Re:Ask HN: Any tips on debugging Linux hibernate issues? by officialchicken on Sunday November 06, 2016 @02:31PM (#12886635)
Start with a pendrive / USB boot and try different distro. Try both older and newer debian-based distros like mint or ubuntu which usually have better laptop support than vanilla debian to see if you can narrow down the problem.
Re:Ask HN: Any tips on debugging Linux hibernate issues? by war1025 on Sunday November 06, 2016 @03:30PM (#12886895)
I found [this thread](http://www.gossamer-threads.com/lists/linux/kernel/2306799) and it seems to describe basically what I am running in to. Unfortunately it drops off and I haven't found if it picks up again in a different thread.

Both laptops are only using the onboard Intel card.

Re:Ask HN: Any tips on debugging Linux hibernate issues? by war1025 on Saturday November 12, 2016 @02:17AM (#12936994)
An update a week later: The 4.8 kernel appears to have fixed the issue. I have not had a single issue all week.
Re:Ask HN: Any tips on debugging Linux hibernate issues? by tortasaur on Sunday November 06, 2016 @03:18PM (#12886838)
Perhaps use smartctl to run a long test on the drive you're hibernating to.
Re:Ask HN: Any tips on debugging Linux hibernate issues? by Raed667 on Sunday November 06, 2016 @03:11PM (#12886815)
Might be a GPU driver issue. Are using the Nvidia binary?
Re:Ask HN: Any tips on debugging Linux hibernate issues? by war1025 on Sunday November 06, 2016 @05:23PM (#12887439)
Only one of the laptops has an Nvidia card, and I've used `bbswitch` to disable it.
Re:Ask HN: Any tips on debugging Linux hibernate issues? by eqyiel on Sunday November 06, 2016 @03:49PM (#12886948)
I have the same problem with a Thinkpad x240. Never managed to figure it out, instead I just use suspend which works reliably.
Re:Ask HN: Any tips on debugging Linux hibernate issues? by war1025 on Monday November 07, 2016 @06:14PM (#12896145)
I normally just use suspend too.

I would definitely suggest trying the 4.8 kernel as mentioned in another comment. So far I haven't been able to make it fail.

Re:Ask HN: Any tips on debugging Linux hibernate issues? by sigjuice on Tuesday November 08, 2016 @12:37PM (#12902226)
By any chance, do you know which kernel commit(s) fixed your issue? Maybe git bisect can pinpoint the commit? It would be interesting to know what the exact bug was.
Re:Ask HN: Any tips on debugging Linux hibernate issues? by war1025 on Tuesday November 08, 2016 @03:41PM (#12903731)