Recently, I poured water onto the keyboard of my MacBook 2017 (4 thunderbolt), and I forced shutdown it. After letting it dry for two weeks, I opened it and everything seems to work. It also passes the Apple Hardware Test.
However, login (login window, switching user, authenticating for root permission, terminal login) is extremely slow, taking around 20 to 40 seconds. After restarting a couple of times, the behavior does not change. After reinstalling macOS 10.13.6, High Sierra, (keeping application and data), the behavior persists. After starting up in Safe Mode and restarting, the time shortened a little bit.
To verify that this is not a hardware problem, I copied the system partition to another MacBook Pro (same generation) and I can see the same behavior, suggesting that this is a software issue.
Update: On the other MacBook Pro, I run chflags -R noschg,nosappnd,nouchg,nouappnd /
and boot up the machine in Safe Mode (and rebooted). The issue was gone, but only for Safe Mode. Starting again in normal boot recreates the problem, and further Safe Mode cannot correct it.
Things I have tried on my other MacBook Pro that does not work:
- Reinstall macOS High Sierra
- Removing caches and user added filesystems/extensions/launchdaemons/launchagents
- Upgrade to Mojave (login for login window is extremely fast, but terminal login is still slow. Plus it deletes all the files I have in root account (downloads, desktop, documents, etc.)
- Partial copy done by Carbon Copy Cloner from my mac because it disconnected after a certain while in Target Disk Mode. System work and login is fast. But for some reason I forget I erased the system and did a full copy again.
- Repaired home permissions using
diskutil resetUserPermissions / 501
then 502, 503, etc. - Repaired disk permissions using https://www.firewolf.science/2016/07/repairpermissions-v3-now-supports-repairing-permissions-on-macos-mojave/
The output of dtruss login root
is here.
The output of sample login
as instructed here: here The main cause is semaphore_wait_trap, but I don't know how to debug it.
How can I troubleshoot this problem?
Best Answer
I had the same problem everywhere authentication is needed after upgrading to High Sierra. Sampling
login
process gave similar output whereODRecordAuthenticationAllowed
takes longer to complete than usual. The call graph shows that the authentication request dispatched fromtransaction_simple
probably encountered some multithreading issue as caught bysemaphore_wait_trap
that consumed most of the runtime. So, something else must have been busy with authentication ALL the time. In my case the culprit turns out to be the printer. After updating the printer's driver and changing to useAirPrint
fromCUPS
, login, terminal, browsing etc. are now all working to normal, and samplinglogin
process again produces nothing as now the authentication request is too fast to catch.