An Investigation into My New Laptop’s Stubborn Refusal to Sleep
Why “Modern Standby” mode has been keeping me (and many others) awake at night
Note to the reader: while this article is primarily focused on Windows, its lessons may apply to Linux as well. Macs don’t seem to have this problem, however, as Apple appears to have implemented Modern Standby fairly well on both a hardware and software level.
After many years of abuse, my pre-2014 Windows laptop and 2013 Macbook have been struggling to keep up with my workload* so I finally bit the bullet and invested in a new Windows laptop. A co-worker who’s particularly passionate about hardware was happy to jump in and make some recommendations, I was convinced, and the new machine has been simply fantastic. It’s a real workhorse, it beautifully does All The Things.
And there was much rejoicing.
For reasons that will become apparent I won’t immediately name the manufacturer, but in the months since purchasing it I’ve failed to find a solution to some very weird behaviour that I assumed was caused by me and my development configurations — my laptop never sleeps.
I close the lid and the fans continue to blow. I regularly hear notifications in the middle of the night or worse, somebody calls me with a messenger app and the computer actually rings! I return to my desk after a coffee break to find my screen has turned on again, all by itself.
It’s otherwise so slick and sleek and strong that I can look past the fact that its keyboard layout sucks (my bad for selecting the screen size based on my Macbook), but not being able to close the lid and walk away? Needing to close everything I’ve been working on in order to shut it down completely when I travel from home to office and back again, or when I’m done for the day? Constantly using regular-operation levels of electricity when I’m not even around? This is a deal-breaker!
After regularly trawling forums for my device and finding hacky solutions that just don’t make any difference, I recently came across a series of posts on the topic and learned, to my dismay, that the manufacturer has intentionally disabled sleep mode (“S3” to those who care) in favour of what’s called “Modern Standby”. Not only have they disabled it, but with each update they’ve been actively thwarting any attempts to override this and return to S3.
“That’s not on**!” I fumed, and immediately began posting reviews about it (I even went so far as to contact some local sellers to request that they add a warning to their product pages). “It’s 2021, and these criminally insane engineers are dragging us back to a 90s-like pre-sleep era! Do they miss five-minute reboots and optimizing their autoexec.bat files as well?!”
The responses to my post that garnered the most attention — which I will only provide a link to at the end of this article so that I have the opportunity to provide the proper context for its headline first—were surprisingly enlightening. As it turns out, not only is my laptop’s manufacturer not unique in this regard, but they themselves are being forced to do this by rapidly changing industry standards driven by Microsoft and chip manufacturers.
The adoption of this nonsensical standard with broken implementations is being thrust upon all of us, and there is literally nothing anyone can do to stop it.
Here’s an excerpt from Microsoft’s design documentation:
When Modern Standby-capable systems enter sleep, the system is still in S0 (a fully running state, ready and able to do work). Desktop apps are stopped by the Desktop Activity Moderator (DAM); however, background tasks from Microsoft Store apps are permitted to do work. In connected standby, the network is still active, and users can receive events such as VoIP calls in a Windows store app. While VoIP calls coming in over Wi-Fi wouldn’t be available in disconnected standby, real-time events such as reminders or a Bluetooth device syncing can still happen.
Tell me that’s not ridiculous.
Amongst a variety of commiserating comments from people who have had laptops burning up in their bags — or have been treated to their creepy screens turning on long after they’ve gone to bed — were discussions about whether this problem is particular to my laptop’s make or model, debates about the pros and cons of hibernating our machines rather than sleeping them, and one suggestion that at least circumvents the worst of the offensive behaviours with a not-unreasonable amount of effort (well, it would certainly be more reasonable for Microsoft to make it a standard power option, but it’s definitely better than nothing).
Solution Part 1: Hibernation
The first part of a solution definitely falls under the category of “workarounds”, but it’s considerably better than “Modern Standby”: configure your machine to hibernate rather than sleep. The advantage of this is that your machine will be powered down completely, and while it’s a more time expensive operation than sleeping, these days the speed of hibernating and restoring is at least tolerable for most people. The disadvantage, however, is that hibernating a machine with lots of memory means writing all of the RAM’s contents to disk, and frequently writing up to 16/32/64GB to disk increases wear-and-tear and introduces a higher risk of failure. Only slightly, depending on how much RAM you have and the size of your disk, so according to some it’s totally fine to hibernate a handful of times a day.
I found myself surprised that it hadn’t even occurred to me to try hibernating before, likely because Windows 10 has hidden that option by default (I tend to hit Start -> Power to change states) so it was a case of “out of sight, out of mind”. After reading some of those responder’s suggestions, I reconfigured my power button to hibernate (its also restores from hibernation), and my immediate pain was so dramatically relieved that I felt compelled to do a little dance that made my wife’s eyes roll.
Solution Part 2: Network Disconnected mode
Modern Standby has two modes, connected standby (“Network Connected”) and disconnected standby (“Network Disconnected”). Connected standby mode is the one in which — as stated above in Microsoft’s documentation — VoIP calls are allowed even when “sleeping”. While Bluetooth device syncing, reminders and so on will still occur, disconnected standby mode is still a far sight better, but I must admit it’s a total mystery to me as to why Microsoft wouldn’t make these modes explicitly available through their standard options.
To determine your machine’s current Standby mode, open the command prompt and enter the following:
C:\> powercfg /a
This will show you what’s available, as well as what’s not available. To switch between Network Connected and Network Disconnected, follow these steps:
- Open your Group Policy editor (it should be available from your Control Panel)
- Select Computer Configuration -> Administrative Templates -> System ->Power Management ->Sleep Settings (obvious, right?)
- Right-click and edit “Allow network connectivity during connected-standby” for both “plugged in” and “on battery”, setting them both to “Disabled”.
- Run powercfg /a again to verify that the mode has been updated correctly.
Putting it all together
It’s clearly a good idea to configure one’s power settings with a combination of sleeping and hibernating. But just how should one configure these settings?
I guess the answer depends on your specific use case, for me it comes down to figuring out the average length of a “short break” for sleeping — how long I’d take if I left my desk for a bathroom break, or to grab a cup of coffee — and how much inactivity is a good indicator that it’s worth the cost of hibernating. Personally, I’ve configured my laptop’s Power Options to hibernate when I press the power button, sleep when I close the lid and then (using the advanced power options) sleep or hibernate after lengths of time that seem to fit my general usage patterns.
While that may be a decent rule of thumb for a plugged in machine, I’m not confident that that will be sufficient for travelling. In fact, one forum poster suggested that one should NEVER put a machine that’s in sleep mode in an enclosed space such as a laptop bag (it’s potentially dangerous and possibly voids the warranty), which makes my little power-button hibernation trick perfect when packing up even for a quick drive.
Analyzing your Windows machine’s sleep state
It’s all very well to make all these recommendations, but how do we verify that changing these settings has had any meaningful impact? Well, aside from the obvious benefits of not being surprised by noises and bright screens at obscure hours, or firing up your machine at a coffee shop with no available power points to find its battery unexpectedly drained, Microsoft has provided a tool for generating System Power Reports.
Data is King.
Remember that powercfg utility we used earlier? Let’s run it again with the following switch:
C:\> powercfg sleepstudy
This will generate an HTML report and print out its location, which you can copy and paste into your browser address bar. This report is full of interesting information, a review of which I’ll leave as an exercise for the reader. Of particular interest to me is the ability to review what’s triggering state changes, battery drain during different states, and “top offenders”.
Connected Standby, the “sleep” mode which has already become the industry standard, does not behave the way many of us expect. Disconnected standby is an improvement, but still not viable for long-term downtime or safe for travelling. Solving the issues many of us have faced requires employing a combination of disconnected standby and hibernation.
This has been a long, strange journey full of disturbing surprises, but I’m glad to have found some relief at the end of it and I hope the above has been helpful to more than just me. For everyone who’d like to read the original post and its comments, here you go: you’ve earned it ;)
* For the record, I’m a software engineer doing power-hungry things like simultaneously developing and testing a range of apps for a variety of platforms using virtual machines and multiple IDEs, and the company I’m contracting for has made the switch from Slack to Teams which needs to be open all day and is somehow even more resource-hungry even though its performance is shockingly poor…
** Pun not intended, but I’ll leave it in.