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 / 501then 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.
How can I troubleshoot this problem?