5

I have the following situation with my macOS 10.14.6:

  • A while ago I started experiencing my MacBook Pro hanged just after the login screen with user/password. Only the desktop and its icons show, the spinning wheel shows forever, I cannot do anything (no Cmd+Option+Esc, no way to go back to the login screen and switch user) and the only way to (gently) unlock it is to ssh to the machine from my smartphone and issue kill -9 -1 (ie, kill all the processes belonging to the user I'm trying to log in.
  • This happens only upon the first login after shutdown or reboot. Once I've unlocked the user with the killing, subsequent logins go well until the next reboot.
  • This happens only if, after reboot, I do the first login with a given account (the one I usually work with and which has many customisations), it doesn't happen if I first login with another (cleaner) account and then I login with the troubled one.
  • I've already tried the most trivial things: remove login items, stop a few launchd services, SMC reset, check the logs, use the ssh session and top to keep an eye on started processes. But no luck, I can't find what it is.
  • Somewhere I was suggested to login by clicking on the right arrow next to the password field and keeping the Option key pressed. Magically, this worked, but I suppose that key combination is to disable startup things I might need later.
  • Restarting in recovery mode doesn't make sense here: very likely it would work, but I wouldn't gain any particular info on the guilty process and it will keep hanging until I discover it.

So, my question is: as an advanced user how could I troubleshoot all the things that happen after login? Quite clearly, the graphical interface is waiting for some other program to finish (or some other signal), but how is it possible to know? Is there some tool (in addition to inspecting the logs, using top, ps, pstree)? Is there some technical documentation on how the whole thing works?

EDIT: since I'm receiving comments like "try this and that", note that I'm asking the highlighted question, not one of the many things I could try, many of which can already be found with Google, I already know (and tried) a number of them.

  • I sounds like it hangs at login unless I missed something. If so it is quite possible it is something in the user account and not that the system runs for everyone. Create a new user, does that work? If so you have narrowed it down to your user profile. You could then migrate your user login items slowly to narrow it down further. – Steve Chambers Nov 24 at 14:23
  • @SteveChambers, yes, it is very clearly something about a specific user, I've added clarifications about that. Moreover, I'm interested to the general question of understanding what happens at login, most of particular tricks that one could answer here are already known. – zakmck Nov 24 at 18:12
2
+25

Magically, this worked, but I suppose that key combination is to disable startup things I might need later.

Well, if it works w/o apps startup when login, you can use bisection to find out what app causes trouble: disable all the startups then enable just a half of them, check if issue'd arise again or not, disable them again and enable those that weren't tried. If you found which half is causing troubles, repeat same procedure with its "suspects" — also splitting it in halves. That could allow you to narrow it down to a single app that being run on startup botches the login.

  • That's a very clever general method. However, in this case finding what you have to disable in the first place isn't so simple: there are login items (the easy part), but also a tons of stuff in launchd, and probably even system services that do something upon login. That's why I'd like some docs on how the login sequence works in detail. – zakmck Nov 21 at 11:57
  • 1
    I see. Well, MacOS seems to have audit. Try using this tool for tracing may be? Unsure if it still works (or worked ever) but man pages are floating in the system still. :) – poige Nov 25 at 17:49
0

Upon your first login the system connects to various Apple servers (push, icloud, etc). If your network connection is slow or your DNS is slow or there is a failing/non-reachable DNS server, it will cause slow logins. Troubleshoot it by disabling network connections and rebooting. If it starts fast, you know where the issue is. Next you can try to use one of public DNS servers (like 1.1.1.1 or 8.8.8.8) to see if they are any faster then yours.

  • It's not the first login and I've already done this, in fact, it's not what I'm asking. – zakmck Nov 21 at 23:12
  • @zakmck How is it not first login if your post says: "This happens only upon the first login after shutdown or reboot."? You contradict yourself... :( – Unnamed_1 Nov 23 at 4:34
  • "your first login the system connects to various Apple servers" implies that it's the very first time after I've created the account (as normally macos behaves). However, I've specified "after shutdown or reboot" exactly to make it clear that's not the case (indeed, it has been my personal account for years). And I'm not asking this or that thing to try, but where I can know about the login process details, because that's the only way to know all the this or that things to be tried (since I'm a pretty advanced user, I've already tried the most obvious). – zakmck Nov 23 at 11:59
  • @zakmck Absolutely not. Firsts, I used your own words. You wrote "first login" and I only used the same words giving you a possible solution to the problem. The solution, which I found myself investigating the same issue. So you can blame yourself about using "first Login". Secondly, "the first time" is very different from "the very first time". Regardless of how advanced you are, you asked for help. You could say thanks to those who offered. Instead you start inventing something. I'll just remember never try helping you again. Good buy. – Unnamed_1 Nov 24 at 12:43
  • "So, my question is: as an advanced user how could I troubleshoot all the things that happen after login?" @Dmitri, It's not my fault if you can't understand simple English, and thanks for not helping again with answers to questions I didn't ask. – zakmck Nov 24 at 18:00
0

I've been having a similar issue with an account off and on for a while; I would at least get to the desktop in my case, but every app would immediately hang, and this would only happen sometimes (not consistently), and only for one particular user.

To be honest trying to debug it never got me anywhere, and the time I spent doing it would have been better spent just fixing it, which I eventually did.

With that in mind my recommendation is to just create a new user account and move everything over to that. Focus on moving data files, rather than settings, i.e- you probably don't want to transfer much from ~/Library/ except for a few key items, in my case I just restored ~/Library/Mail/ and ~/Library/Safari/, everything else I just recreated and configured back the way I like. It was a huge pain in the ass, but the time it took was about what I had already wasted trying to fix the old account, so I could have halved the time I was stuck for by just creating a new, fresh user account in the first place.

Also, my experience has always tended to be that you should do a clean install of your system periodically (maybe every three or four years), usually when you're ready to upgrade to a new OS version. Focusing on restoring data and only minimal content from your ~/Library/ folder(s) from backups, this way you leave behind any cruft that may have accumulated which may have lead to problems.

These aren't pretty or simple fixes, but sometimes you just need to get things back to normal.

  • I do something similar every couple of years, but in this case I've done it just a few weeks ago. Apart from that, what I'd like to find is some documentation on the details of what happens during the login procedure. That would be the minimum to check the most obvious things and then decide if it's worth to debug it further,. – zakmck Nov 24 at 19:44
  • 1
    Hmm, I'm afraid I don't know a lot of specific detail, what I do know is that loginwindow is the process that starts it, as killing that process for a user will effectively log them out (though this doesn't appear to fully be the case in Catalina, which may be a bug, as some processes are left running that shouldn't be). launchd must begin early in the process as I've verified that RunAtLoad launch agents can be executed/executing before I see my desktop (osascript calls or Finder/Dock will fail), startup items seem to trigger after RunAtLoad launch agents. – Haravikk Nov 25 at 22:58
  • thanks @Haravikk, that's useful. Yes, launchd is a single process that launches all sort of things, either for the system, or for specific users, when they login. A tool like soma-zone.com/LaunchControl makes that quite clear. – zakmck Nov 26 at 17:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .