Fixing a Mac OSX Leopard Login Loop Caused by Launch Services

Posted on 2 minute read

× This article was imported from this blog's previous content management system (WordPress), and may have errors in formatting and functionality. If you find these errors are a significant barrier to understanding the article, please let me know.

After the release of the latest update to the Macintosh operating system (10.5.3), some users were reporting a "login loop" to MacFixIt.com. I followed the always helpful advice on MacFixIt for updating the operating system, and after the first reboot everything came back fine on my PowerBook G4 I thought I was in the clear. With the second reboot, though, I started seeing the login loop: the machine boots fine, but when you put the username and password in, the system hangs for about 20 seconds before displaying the login window again. Clearly something is hosed, and fortunately I was able to fix it.

I tried the suggested solutions -- booting in safe mode and logging in (still had the same problem); running a file system check in single user mode (no errors reported); deleting the login window plists; and changing the password -- but they had no effect. I could log into the temporary admin account I give to Apple when the machine is sent in for service, so I knew it was something specific to my day-to-day account. I was able to get into single user mode (hold down Command-S right after the startup twang) and examine the /var/log/system.log file. This is part of the underlying UNIX nature of MacOSX, and was the only place I found that gave clues to what was going on. Here is a portion of the log file that occurs right after hitting return at the login screen:

loginwindow[23]: USER_PROCESS: 23 console
com.apple.launchd[1] (com.apple.UserEventAgent-LoginWindow[86]): Exited: Terminated
ReportCrash[106]: Formulating crash report for process lsregister[104]
ReportCrash[106]: Saved crashreport to /Library/Logs/CrashReporter/lsregister_timestamp.crash using uid: 0 gid: 0, euid: 0 egid: 0
kernel[0]: SetCryptoKey R: len 32, idx 1
ReportCrash[111]: Formulating crash report for process ReportCrash[105]
ReportCrash[111]: Saved crashreport to /Users/userid/Library/Logs/CrashReporter/ReportCrash_timestamp.crash using uid: uid gid: gid, euid: uid egid: gid
com.apple.launchd[92] (com.apple.ReportCrash[105]): Exited abnormally: Bus error
ReportCrash[112]: Too many crashes in rapid succession! No crash report being written for pid 113
com.apple.launchd[1] (com.apple.UserNotificationCenter[113]): Exited abnormally: Segmentation fault
com.apple.launchd[1] (com.apple.UserNotificationCenter): Throttling respawn: Will start in 10 seconds
ReportCrash[112]: Too many crashes in rapid succession! No crash report being written for pid 114

The key clue is bolded -- the lsregister process is crashing. I found a clue to the fix in a 2003 blog posting by a guy named Rick when he said After a couple hours of snooping, and some luck (I was able to ssh in from another machine and watch the system log report the crashes), I discovered that Launch Services’ cache was corrupted, and was causing lsregister to seg fault. His posting was related to MacOSX 10.2.6, and since then the name of the Launch Services cache file has morphed. I found it in the same place (the /Library/Caches directory), but now there is more than one and they take the form of "com.apple.LaunchServices-023uid.csstore" where uid varies depending on the appropriate userid number. I removed all of the Launch Services files from /Library/Caches, restarted, and was able to log in fine. The only side effect was that the applications-to-launch-at-login list was gone (the "Login Items" tab of the Account Preference Pane) and had to be reconstructed.

So I'm productive again, and I didn't have to reinstall the operating system or transfer all my old files and settings to a newly-generated account. I hope this message helps someone else, too.