smbd blocking sleep in El Capitan

I recently resurrected an old MacBookPro (3,1 from 2007) to use as a music player. I installed 10.11.6 (the last supported OS for this model) and all seemed fine, until I discovered that any connection to FileSharing through SMB caused it subsequently to fail to go into deep sleep (hibernation). I'm defining 'hibernation' as the state in which the hard disc spins down and the led on the front next to the lid catch starts to pulse. If there's been any connection through SMB then the machine simply blanks the screen when asked to sleep, the front led is on but dimmed, the hard disc is still spinning and clicking the trackpad button causes it to spring to life instantly.


I isolated the problem to smbd. Here's the output from pmset -g assertions when I've connected to it through the SMB share (in this state it will refuse to hibernate):

2020-08-27 11:14:47 +0100 
Assertion status system-wide:
   BackgroundTask                 0
   ApplePushServiceTask           0
   UserIsActive                   0
   PreventUserIdleDisplaySleep    0
   PreventSystemSleep             0
   ExternalMedia                  0
   PreventUserIdleSystemSleep     0
   NetworkClientActive            1
Listed by owning process:
   pid 576(smbd): [0x000003c00011033a] 00:01:29 NetworkClientActive named: "com.apple.smbd" 
Kernel Assertions: 0x4=USB
   id=500  level=255 0x4=USB mod=01/01/1970, 01:00 description=com.apple.usb.externaldevice.fd100000 owner=SONATA Audio
Idle sleep preventers: IODisplayWrangler


And here's the output if I restart and don't connect (and the system will hibernate properly).

2020-08-27 11:18:44 +0100 
Assertion status system-wide:
   BackgroundTask                 0
   ApplePushServiceTask           0
   UserIsActive                   0
   PreventUserIdleDisplaySleep    0
   PreventSystemSleep             0
   ExternalMedia                  0
   PreventUserIdleSystemSleep     0
   NetworkClientActive            0
Kernel Assertions: 0x4=USB
   id=500  level=255 0x4=USB mod=01/01/1970, 01:00 description=com.apple.usb.externaldevice.fd100000 owner=SONATA Audio
Idle sleep preventers: IODisplayWrangler


The only difference is NetworkClientActive 1 in the first set of results.


I then set up a script to turn FileSharing and smbd off and then back on, throwing out any connections in the process:

#!/bin/sh
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.smbd.plist

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.smbd.plist

pmset sleepnow

Running this script always causes the machine to go into hibernation sleep, which confirms that smbd is causing the problem.


Now, I've set this up as a workaround, inserting the script's name into sudoers and setting up an invocation so that I can reset smbd and make the machine hibernate by clicking an icon on the dock. But I'd really rather fix the root of the problem.


Is there any way to stop smbd from blocking hibernation?

'Wake for ethernet access' is turned off in Energy Saving, so it's not that.


MacBook Pro, OS X 10.11

Posted on Sep 1, 2020 3:38 AM

Reply

Similar questions

3 replies

Sep 1, 2020 10:16 AM in response to a brody

In between usage sessions I want the machine to turn off the hard disk and go into the lowest energy state it can short of a full shutdown. This is what is meant by hibernation. Simply dimming the screen and turning down port current isn’t desirable.


As I said, I can get this to happen by resetting smbd. But I want to know if it’s possible to fix the smb daemon so this isn’t necessary.


I should note that this only applies to SMB connections that are initiated from external machines. The MBP opens up an SMB connection to my NAS on login, but this doesn’t interfere with sleep. The problem happens when I open an SMB connection to the laptop from my Windows box, even if I then drop the connection by sending the Windows box to sleep before trying to sleep the MBP.

Sep 8, 2020 1:09 PM in response to charlesky

It looks like this is down to an underlying design flaw in OSX. It turns out that others have reported similar problems with the print demon (cupsd) blocking sleep if a document is stuck in the print queue.


It would be nice to find some way to rip out or disable the offending code, but clearly that's beyond the competency of this forum, so I'll have to rely on the workaround I put together.



This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

smbd blocking sleep in El Capitan

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.