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