21

I have a 2017 MacBook Pro 15″ with High Sierra. I never turn off my laptop, instead I simply put it to sleep, so next day it's easier and faster to turn it on.

But often when I wake it up the next day, it has rebooted by itself. How can I see the shutdown/reboot cause, to try to fix it?

Here is the result of command "pmset -g"

System-wide power settings:
Currently in use:
 standbydelay         10800
 standby              1
 womp                 0
 halfdim              1
 hibernatefile        /var/vm/sleepimage
 powernap             0
 gpuswitch            2
 networkoversleep     0
 disksleep            0
 sleep                15 (sleep prevented by nsurlsessiond, nsurlsessiond, sharingd, coreaudiod)
 autopoweroffdelay    28800
 hibernatemode        3
 autopoweroff         0
 ttyskeepawake        1
 displaysleep         15
 tcpkeepalive         1
 acwake               0
 lidwake              1
  • 2
    This happens to me every night. This is extremely frustrating! – IanEdington Jan 23 '18 at 15:02
  • Does it wake up with a notice saying “you shut down your computer because of a problem”? If so, possible Kernel Panic going from light to deep sleep. I had this, reinstalled and all was good, so far. – OzzieSpin Jan 23 '18 at 17:44
  • @OzzieSpin Yes, it wakes up with this message. I'll try other options before reinstall, too much work lol – delphirules Jan 23 '18 at 18:00
20

You can find the last shutdown cause by examining the logs. Run this command to filter the logs for shutdown causes:

log show --predicate 'eventMessage contains "Previous shutdown cause"' --last 24h

You can then lookup the shutdown cause code in this table: macOS Shutdown Causes.

  • 6
    It showed this : 2018-01-02 22:39:45.644757-0200 0xb1 Default 0x0 0 0 kernel: (AppleSMC) Previous shutdown cause: 5 – delphirules Jan 3 '18 at 22:14
  • The table says it was a 'Correct shutdown', but i did not shutdown, i just put it to sleep. – delphirules Jan 3 '18 at 22:15
  • was it left plugged in? – Mr. Kennedy Jan 4 '18 at 2:35
  • Yes, i always left it plugged. Yesterday i closed applications that could use internet connection and today the Macbook did not restarted. Will observer the next few days, thanks for your help. – delphirules Jan 4 '18 at 19:53
  • 2
    Considered an SMC reset? – OzzieSpin Jan 23 '18 at 20:35
15

Not exactly the same, but I had a similar issue – after some time I always found my Mac trying to close all my applications (to restart or log out, I don't know. Thanks to iTerms, which stopped this evil Mac preventing log out every time).

It was 'Log out after X minutes of inactivity' checkbox, accidentally found in

System Preferences > Security & Privacy > Advanced (in right-bottom corner)

Anyone have the same issue as I had, try checking it off.

  • Thanks! I've been having this issue for months; having time machine backups fail due to the machine logging out. – Gunther Jan 25 at 17:52
7

This is what worked for me

Opening the terminal and running this:

pmset -g

gave me an output of:

Currently in use:
autopoweroffdelay 21600
autopoweroff 1
... a bunch of other stuff

autopoweroff caused my computer to turn off after 6 hours (21600 sec).

running this turn off autopoweroff:

sudo pmset -a autopoweroff 0
  • Thanks, tried this but get this error : "Password: Warning: Idle sleep timings for "Battery Power" may not behave as expected. - Disk sleep should be non-zero whenever system sleep is non-zero." – delphirules Jan 25 '18 at 11:23
  • @delphirules could you post the output of pmset -g in your original questions? – IanEdington Jan 25 '18 at 14:13
  • Just edited the question and did it. – delphirules Jan 25 '18 at 16:12
  • You seem to already have autopoweroff disabled (zero). – Matt Sephton Jan 25 '18 at 16:26
3

Does this work for you? https://discussions.apple.com/message/32878814#message32878814

  1. Shut down
  2. Disconnect all external devices
  3. Reset the System Management Controller (SMC), repeat 2/3 times
  4. Reset the nonvolatile random-access memory (NVRAM), repeat 2/3 times
  5. Then use safeboot (SHIFT at Startup)
  6. Then reboot normally with devices disconnected.
  • Thank you! This started happening to me after the most recent High Sierra update and your instructions fixed it. – ecgak Jan 30 '18 at 3:35
  • Thanks for letting me know @ecgak. Usually, when an answer works for you it's good practice to upvote it so other can know that it's a viable solution. It also gives me the gratification of 10 points :P – IanEdington Jan 30 '18 at 14:29
  • @ecgak: I don’t think this might have fixed your problem, because this is neither a bug nor a problem, but a feature introduced with High Sierra. The problem came from the lack of communication from Apple about this new autopoweroff function. Leave your Mac on battery, put it to sleep, wait 8 h, it will shutdown. – dan May 12 '18 at 10:41
  • 5
    Never seen such a ridiculous religious receipe as "reset the SMC 2.5 times”. Apple discussions groups are haunted by Harry Potter. – dan May 12 '18 at 10:53
2

It looks like a bug to me. My system is restarting (according to what I can make out from the logs) due to a 'watchdog' timeout. Basically, this means that something has failed to release a resource within a defined period of time which has caused the system to 'hang' and a restart is performed to resolve the condition.

1

I have had the same problem for a long time.

Your sleep image is corrupted. Delete the sleep image and it should be fine.

https://christianvarga.com/how-to-delete-sleepimage-on-macos-high-sierra/

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – grg Aug 29 '18 at 18:56
1

Had the same issue on MBP 15" 2013 since upgrading to Mojave: macbook restarts each time if left to sleep on battery power (no issues when connected to the grid), Apple support silent. Caught exact error message upon reboot:

Sleep transition timed out after 180 seconds while creating hibernation file or while calling rootDomain's clients about upcoming rootDomain's state changes

After trying everything I found online, the only method that worked was:

sudo pmset hibernatemode 0

To make sure it's set to 0 check:

pmset -g

Origin of the advice: https://discussions.apple.com/thread/8567772?page=3

Keep in mind that this will mean the mac does not store the contents of RAM to disk so if your battery runs out while asleep there is no sleep image file to recover from.

0

My Macbook Pro High Sierra would wake from sleep after about 10 seconds and just keep cycling. I tried all of the above and more to no avail. Then I then unplugged my new USB mouse. Problem solved.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .