Today I have a new suspend/resume problem. On Dell Precision 5510 w/Ubuntu 17.04, all was well. But now, resume is not working. I always get restart.
Yesterday, I had a runaway script and it paralyzed the UI. I made a programming error, it caused this script to consume all system resources. I went to another computer and ssh connected with this "frozen" computer. I tried to shut down the system the old fashioned way:
/sbin/shutdown -h now
However, after 20 minutes of waiting, I gave up and held down the power button. The thing will start, it will suspend also. If I open the lid, it wakes up automatically. That is how I know the machine is actually suspended, it starts itself.
However, the machine restarts, instead of resuming, after a suspend.
My working theory is that the unclean crash damaged a settings file that must be rewritten during suspend. This file is a signal that resume from RAM is OK, rather than a restart.
I don't know for sure there is such a file for suspend/resume, but I've found comments here about hybernate/resume which say that it uses a state file to tell if it can try to restore a session.
I expect this problem will disappear at random after some package updates, but it has made me really curious about how a system checks to see if it should restart.
The problem disappeared after shutting down, restarting, and then shutting down again, and then restarting. After that, I've survived 3 suspend/resumes without the unexpected restart.
Still, I'm curious to understand how this works, how the kernel knows to resume rather than suspend.