MacBook Pro restarts during sleep

aevan

macrumors 68040
Original poster
Feb 5, 2015
3,120
3,991
Serbia
I have two issues with sleep, not sure when they started.

1. MBP wakes up the screen randomly during sleep.

2. MBP restarts during longer periods of sleep (I wake it up or open the lid and find out it restarted).


Any ideas?
 

Sanpete

macrumors 68020
Nov 17, 2016
2,123
839
Utah
You probably already considered that software updates can restart your machine during sleep.
 

Sanpete

macrumors 68020
Nov 17, 2016
2,123
839
Utah
I would guess the events that cause the restarts are in the logs. I've noticed people with unexpected shutdowns here are often finding if they sign in on a different user account it stops, so some kind of software bug. But I have no ideas what it is.
 

Queen6

macrumors 604
I have two issues with sleep, not sure when they started.

1. MBP wakes up the screen randomly during sleep.

2. MBP restarts during longer periods of sleep (I wake it up or open the lid and find out it restarted).


Any ideas?
Numerous reasons, try simplest 1st; do you have "any" Bluetooth peripherals connected? if so check settings and set to not to wake up the system.

Run this code in Terminal;
Code:
cat /var/log/system.log | grep -i "wake reason"
This may glean some understanding of what is waking up the system, equally Apple is not very forthcoming with the cause of the error codes. Notifications are another source of random wake ups, so also worth investigating the settings,

The restarts are more concerning, would you say the restarts occur only after 3 hours of sleep, as this is the period generally when the OS will hibernate the system. Try looking at the crash logs with Console, use the search box to filter crash etc.

There is potential for the Sleep Image to be corrupted, which in some circumstance will result in system crash and hard reset. you can try checking the drive for error with Disk Utility, however you need to run it from the recovery partition, off the file menu.

n.b. I am not running 10.12 to some aspects may be a little different Disk Util etc.

Q-6
 
Last edited:
  • Like
Reactions: No. 44 and aevan

aevan

macrumors 68040
Original poster
Feb 5, 2015
3,120
3,991
Serbia
Numerous reasons, try simplest 1st; do you have "any" Bluetooth peripherals connected? if so check settings and set to not to wake up the system.

Run this code;
Code:
cat /var/log/system.log | grep -i "wake reason"
This may glean some understanding of what is waking up the system, equally Apple is not very forthcoming with the cause of the error codes. Notifications are another source of random wake ups, so also worth investigating the settings,

The restarts are more concerning, would you say the restarts occur only after 3 hours of sleep, as this is the period generally when the OS will hibernate the system. Try looking at the crash logs with Console, use the search box to filter crash etc.

There is potential for the Sleep Image to be corrupted, which in some circumstance will result in system crash and hard reset. you can try checking the drive for error with Disk Utility, however you need to run it from the recovery partition, off the file menu.

n.b. I am not running 10.12 to some aspects may be a little different Disk Util etc.

Q-6

Thanks for the tips. Yes, I'd say that the restarts happen only in deep sleep/hybernation, but not sure. They are somewhat random - sometimes they happen, sometimes not. I will try some of your tips and see what happens.

Thx.
 

JustinRP37

macrumors regular
Jun 14, 2016
189
330
New York, NY
I have two issues with sleep, not sure when they started.

1. MBP wakes up the screen randomly during sleep.

2. MBP restarts during longer periods of sleep (I wake it up or open the lid and find out it restarted).


Any ideas?
Just and FYI, I had the same thing with my first MBP 2016. They had me swap it out and I have not had any issues with the second MBP. Might be worth exchanging if you are within the window. Mine restarted randomly during sleep and or crashed during sleep (blank screen upon reopening the lid or just a gray screen).
 

aevan

macrumors 68040
Original poster
Feb 5, 2015
3,120
3,991
Serbia
Just and FYI, I had the same thing with my first MBP 2016. They had me swap it out and I have not had any issues with the second MBP. Might be worth exchanging if you are within the window. Mine restarted randomly during sleep and or crashed during sleep (blank screen upon reopening the lid or just a gray screen).
I'm long past the exchange window, and it's most likely a software issue, not a hardware one.
 

JustinRP37

macrumors regular
Jun 14, 2016
189
330
New York, NY
I'm long past the exchange window, and it's most likely a software issue, not a hardware one.
Ahh gotcha. Sorry I couldn't be of more help. I was hoping they could have helped me with my first machine as I just got it to a place I wanted it to be. But I am more than happy with the second machine. However, do you have an external monitor hooked up while it is sleeping? I still do have occasional crashed if it sleeps for a long period of time attached to an external monitor. However, the crashes only happen with the lid closed, so I stopped that.
 

Calby

macrumors 6502
Dec 30, 2015
332
40
Sweden, Gävle
Delete the deep sleep / hibration file don't remember what's the name of it.
If that one is corrupted this is the symptoms.

My guess is that you have the famous wake sleep failure and it only happen in deep sleep.

So do this:
Smc and nvram reset
Delete the hibrination file (deep sleep img file)
Or do a clean install of macOS but deleting the img file is a better solution.
 
  • Like
Reactions: No. 44 and aevan

Queen6

macrumors 604
Delete the deep sleep / hibration file don't remember what's the name of it.
If that one is corrupted this is the symptoms.

My guess is that you have the famous wake sleep failure and it only happen in deep sleep.

So do this:
Smc and nvram reset
Delete the hibrination file (deep sleep img file)
Or do a clean install of macOS but deleting the img file is a better solution.
Fair chance the sleepimage file is corrupted, the wake up's can be tricker to isolate and resolve dependant on cause.

This code in Terminal will delete sleepimage (Admin password required;
Code:
sudo rm /private/var/vm/sleepimage
OS will regenerate new sleepimage file on the next cycle

Q-6
 

sflomenb

macrumors 6502a
Jul 22, 2011
908
131
I have two issues with sleep, not sure when they started.

1. MBP wakes up the screen randomly during sleep.

2. MBP restarts during longer periods of sleep (I wake it up or open the lid and find out it restarted).


Any ideas?
The second is also happening to me.
 

aevan

macrumors 68040
Original poster
Feb 5, 2015
3,120
3,991
Serbia
Three days without restarts. Don't want to jinx it, but I think the issue is resolved. Thanks again everyone.
 
  • Like
Reactions: Sanpete

aevan

macrumors 68040
Original poster
Feb 5, 2015
3,120
3,991
Serbia
How about the wakeup's any improvement? There has also been posts regarding restarts during sleep when connected to an external display, if widespread Apple will likely address in the next point release of macOS.

Q-6

No improvement there. They happen mostly when a notification comes (even though I tried turning power nap off) - so I believe the Mac wakes up when some push arrives. iMessage turns on the screen almost every time, unless in deep sleep.

I saw other people with this issue, I guess it's a bug.
 

dmn8

macrumors member
Sep 27, 2007
68
4
I had the same problem waking from sleep but only when the machine was plugged in and charging. The solution was reviewing LaunchAgents - I had a USB Display Driver that was causing the OS to crash. Check user\library\launchagents and library\launchagents for old or removed software. Be sure to follow instructions for removing items, I used the terminal command [launchctl remove *com.name.service*] and then removed the plist.
 

Queen6

macrumors 604
No improvement there. They happen mostly when a notification comes (even though I tried turning power nap off) - so I believe the Mac wakes up when some push arrives. iMessage turns on the screen almost every time, unless in deep sleep.

I saw other people with this issue, I guess it's a bug.
You can post the results of the Terminal code I posted in #5, may be able to shed some light on it. Notification's you will need to have a look in System Preferences, as may be able to fine tune and or silence in the quiet hours.

An option is to reduce the time to Deep Sleep from the default 3 hours, this can be done globally, mains supply or solely for on battery, equally requires some thought and a little work in Terminal with pmset, nothing that can not be undone mind.

Q-6
 

Sanpete

macrumors 68020
Nov 17, 2016
2,123
839
Utah
They happen mostly when a notification comes (even though I tried turning power nap off) - so I believe the Mac wakes up when some push arrives. iMessage turns on the screen almost every time, unless in deep sleep.
I assume you have Wake for Wi-Fi network access deselected too, then. (Sorry to keep playing Captain Obvious here.)
 

newdeal

macrumors 68020
Oct 21, 2009
2,358
1,417
definitely some OS bugs with the new computers. Mine sometimes will shut down during sleep and needs to be booted back up
 

aevan

macrumors 68040
Original poster
Feb 5, 2015
3,120
3,991
Serbia
I assume you have Wake for Wi-Fi network access deselected too, then. (Sorry to keep playing Captain Obvious here.)

Actually, no! And you're not playing Captain Obvious, I am really grateful.

And, no, I didn't deselect Wake for Wi-Fi network access. But I don't remember that causing any waking up earlier. I thought this option was there to allow remote access while Mac is sleeping. Do you think I should turn it off?