Now, this is not Azure related, but I thought I’d share this information anyway.
Spoiler / TL;DR: If your laptop is going to sleep when inactive for a few minutes and you know it is set correctly to NOT go to sleep, check your external monitor’s power saving configuration! In my case, the external monitor was saving power and when it did so, my computer would join it in sleep as well!
Every now and then, my Windows 10 laptop would go to sleep after some (semi-random) inactivity period. In normal operation, that is not a problem and more of a minor annoyance like locking the computer, go fetch a cup of coffee or something else and return to a sleeping computer. But these days, I’ve been doing some online courses, and I find myself at times just quietly reading through documentation and not moving the mouse nor using the keyboard for a couple minutes. And that’s when this behaviour gets annoying.
Of course, the very first thing I do when I format my laptop is to disable all forms of sleep and hibernation – *I*, not the computer, know better when it’s time for it to take a nap. I had also on occasion gone through some Google searches and applied some “fixes” which “seemed” to work at the time – turns out, they didn’t, I just didn’t notice it! :)
So, today, I decided to go further and dig deeper. Event viewer was the first place I looked, only to be greeted with what I already knew: that the computer had gone to sleep and resumed from said sleep… Not much luck here. Even the “More information” link was useless as it would send me to Microsoft’s home page, instead of where it used to send me (maybe something’s broken in this Windows 10 build, not used this option in a while). Manually googling for “Kernel-Power Event ID 42” did not yield much useful information for my situation, so, back to some old-fashioned troubleshooting.
First, I created a simple batch file to simply run powercfg –requests every second, in a loop, and save that to a file, along with a timestamp. It would also echo just the timestamp to the screen so I could keep track. Every 2 to 3 minutes, and the laptop would go to sleep. Also, the only relevant thing in the log around the time it went to sleep were these two lines:
[DRIVER]: Legacy Kernel Caller
Googling for that didn’t help much, so I decided to try a couple things, namely, using the “old” way of removing stuff that is not needed and trying to repeat the behaviour. Having seen some people complaining about USB power saving, my first try was to remove the only USB device I had attached (a mouse) and repeat the tests. Sure enough, after a couple minutes, the laptop was sleeping again, so that could not be the culprit. Next on the list, unplug my external monitor, that was plugged in through the VGA port. 2 minutes, 3 minutes, 4 minutes, 5 minutes… And it would go on and not power down! Re-plug the monitor, repeat the test, and, sure enough, 2 to 3 minutes later, my computer was sleeping again. So, check my external monitor settings and, sure enough, it had a setting for Power Saving and that setting was ON. I would never expected that to also put my computer to sleep, but apparently, it does! So, disable the setting, run the test again, and now both the monitor and computer keep going on as they should.
So, here you go, I hope this can be of use to someone else experiencing the same problem and if you know someone who suffers from this, have them check their monitor’s Power Saving setting. And now back to some more reading. :)