Why does Windows get insomia?

Meaning it forgets how to go to sleep automatically. I mean, every single Windows system I’ve owned for like 20 years has been like this. You set it to Sleep automatically after so many hours, and that’ll work for a few days. A week or two. Then it just forgets how and stays on forever until you tell it to sleep directly, or you reboot and it suddenly remembers how to do it by itself again. I’m not talking about the monitor turning off, I’m talking about the system sleeping.

Every desktop, every laptop*, personal and work machines do this in my experience. I have a work machine with virtually nothing on it: developer tools and Office and that’s it. It does it too. Why?

*Though to be fair a laptop will sleep if you close the lid, just like a desktop will sleep if you choose power->sleep. They just forget how to do it themselves.

Since this is IMHO, I should have added: anybody else have this happen?

Yeah this happens me. I always assume it’s some background process that is keeping it awake. Usually it rights itself after a day.

Yes, I’m confident it’s this, in combination with random factors like something recently installed sparking off against the offending process. Sometimes updating software, like your virus checker, might have changed its functions in some annoying way, it gets complaints, then updates get rushed again to correct it, so from your perspective it seemed just a weird inexplicable temporary glitch.

Recently, for some reason a HDD app “Samsung Magician” got itself reawakened, stationed itself in my systray, and kept my monitor from sleeping. I assume it updated itself automatically at some point that day and reset all its obnoxious settings that I had previously turned off.

If it’s a laptop, you might want to try the hibernate state. IME a system might try to sleep but be immediately woken by some process. Hibernate is not so easily disturbed.

I know in theory hibernate is much slower to wake from, because the whole system state is dumped to the hard drive. But if you’ve got an SSD, this is still just a few seconds. I can’t speak for how long it takes from magnetic disk.

I’ve had the same problem with hibernate. The system just forgets how to hibernate automatically after a week or so.

No Sleep For The Wicked?

To know what are the applications hinder sleep mode run cmd as admin… type in…
powercfg -requests… and it will reveal what, if any, application is preventing sleep.

If there’s a video player open, that may be the cause. They usually switch off screen savers (if any) and stop Windows sleeping.

I have had success by making sure the mouse it not the culprit by un-checking the options to allow the mouse to wake the computer – just have to press a key instead of jiggling the mouse to wake up. Easy test was to unplug the mouse and see if the machine would sleep.

Device Manager > Mice and other pointing devices > Power Management > Allow this device to wake the computer

It took a few weeks (Windows forced-rebooted me once for an update, making me start over) but I finally have my Win desktop in an ‘insomniac’ state: it won’t auto sleep now unless I reboot.

C:\WINDOWS\system32>powercfg -requests
DISPLAY:
None.

SYSTEM:
None.

AWAYMODE:
None.

EXECUTION:
None.

PERFBOOST:
None.

ACTIVELOCKSCREEN:
None.

Any other tests I should try?

If you ran the test after a reboot, the test makes sense since you say a reboot fixes the issue. I’m guessing here, but it sounds like when you first turn the PC on, it will not sleep unless you reboot and then sleep mode works. If you ran the test after your system would no longer enter sleep mode, it’s a mystery.

OK, after yet another reboot, I got Windows into this state again.

C:\WINDOWS\system32>powercfg -requests
DISPLAY:
None.

SYSTEM:
[PROCESS] \Device\HarddiskVolume6\Windows\explorer.exe
A file delete operation is in progress.
[PROCESS] \Device\HarddiskVolume6\Windows\explorer.exe
A file delete operation is in progress.
[PROCESS] \Device\HarddiskVolume6\Windows\explorer.exe
A file delete operation is in progress.
[PROCESS] \Device\HarddiskVolume6\Windows\explorer.exe
A file delete operation is in progress.

AWAYMODE:
None.

EXECUTION:
[PROCESS] \Device\HarddiskVolume6\Windows\explorer.exe
A file delete operation is in progress.
[PROCESS] \Device\HarddiskVolume6\Windows\explorer.exe
A file delete operation is in progress.
[PROCESS] \Device\HarddiskVolume6\Windows\explorer.exe
A file delete operation is in progress.
[PROCESS] \Device\HarddiskVolume6\Windows\explorer.exe
A file delete operation is in progress.

PERFBOOST:
None.

ACTIVELOCKSCREEN:
None.

I did get in a weird state a couple of days ago where I was deleting a folder and it was taking forever to move say 10 files to the trash, so I deleted them one at a time and all was well. This is apparently the result. Darn you, Windows.

Is there a power user command to blow all these silly things away?

If it’s deletes that didn’t quite delete, perhaps running chkdsk would clean this up for you. You can instigated a check by right clicking on the offending drive in Explorer, clicking the Tools tab, and clicking the Check button under Error Checking. Go ahead and let it Scan the drive even if it tries to tell you nothing is wrong. Hopefully it will find some errors and then prompt you from there. Just follow along, rebooting if necessary.

The only other thing I can think of is to check if the following registry key exists using RegEdit. You can safely delete the key if you find it.

HKEY_LOCAL_MACHINE/SOFTWARE/Session Manager/PendingFileRenameOperations

Nope, no keys or entry at HKEY_LOCAL_MACHINE/SOFTWARE/Session Manager. Is that the correct path?

Try also

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager

Or just click Find and try to search for the key PendingFileRenameOperations. If yo udon’t find it, then there aren’t any.

Also try it right when the problem starts, as well as after a reboot and after sleep is working.

I do note this one is a bit of a longshot. It’s just where Explorer stores files to be deleted later. In theory, it should only be trying to delete them before Windows loads. But it’s just the only place I know of where Explorer lists files to be deleted.

I put the chkdsk first because I though that would be more likely to work.

Aha, I get it: this is where Windows installers sequester files to nuke when they say “you need to reboot to complete the install”. Interesting, thanks.

Hey, big props! I ran chkdsk on all three of my disks and that cleared the

[PROCESS] \Device\HarddiskVolume6\Windows\explorer.exe
A file delete operation is in progress.

Nice!

I guess we’ll see if my system suspends tonight

System suspended last night. I’m going to keep on checking this though next time it happens