0

When I open the terminal (iTerm/Terminal), login process consumes %100 cpu and waits for 1-2 minutes before the shell appears.

I have been googling for some time, I tried to remove asl files, reset user permissions, used custom login command with hushlogin flags... But no luck.

I have done dtrace on login process and saw that the process does a lot of file scanning. Some example lines:

  678/0x1bd8:  open("/.vol/16777220/1716443\0", 0x8004, 0x0)         = 5 0
  678/0x1bd8:  getattrlistbulk(0x5, 0x7FFE4B00AE08, 0x7FFE30050000)      = 2 0
  678/0x1bd8:  getattrlistbulk(0x5, 0x7FFE4B00AE08, 0x7FFE30050000)      = 0 0
  678/0x1bd8:  open("/.vol/16777220/1716352\0", 0x8004, 0x0)         = 5 0
  678/0x1bd8:  getattrlistbulk(0x5, 0x7FFE4B00AE08, 0x7FFE30050000)      = 4 0

I have a large (8MB) dtrace logs file that I can share if you need it.

Any idea what would be happening?

(on Big Sur but the issue was there on Catalina as well.)

4
  • 2
    What is in your shell profiles?
    – nohillside
    Nov 25 '20 at 14:45
  • have some aliases and exports. i tried with empty profile files for both bash and zsh but it didn't change anything. Nov 25 '20 at 14:46
  • The issue was there on Catalina, but changing the login shell to zsh (through iTerm preferences) had solved the issue. After upgrading to Big Sur, the issue repeated but this time zsh doesn't solve the problem. Nov 25 '20 at 14:52
  • Does it happens with a freshly created user account?
    – lhf
    Nov 27 '20 at 14:18
0

After more digging, it turned out that the slowness of login was caused by lsof. login calls lsof at some point which takes very long time to finish.

After some trials and errors, I had to reset max file descriptors limit to default to solve the issue.

I don't know the exact relationship between lsof and max file descriptors limit but it turned out that large max file limits slow down lsof dramatically.

You must log in to answer this question.

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