I've seen a few different questions about ls hanging. It's usually because they use the -l switch, which causes a stat on the file, which in turn is a bad symlink or pointing to an NFS mount or some such.

I have a local file (in an old copy of the Git source that somebody else unpacked, of all things) that causes stat to hang, but responds to CTRL-C. It also causes ls -l to hang, hard, such that it does not respond to kill (but does terminate on a kill -9).

It's not a symlink. The other files in the directory appear to stat without issue. I've recently rebooted the machine with forced fsck, which came out clean, and dmesg shows no disk-related messages. How can this be?


It may be a problem in getting the user name or group name, if you use and LDAP or NIS or other sources for that. What are you passwd and group lines in /etc/nsswitch.conf? This may be the case if an ls -nl return immediately.

  • Unless it is looking for extra sources for that data when something isn't found, it would hang all the time (i.e., get the name, return it; don't get it, return anyway). Isn't too plausible. Perhaps the file is somehow messed up (and a fsck(8) might be in order)? – vonbrand Jan 30 '13 at 13:04
  • Right, but he might have long timeouts. So this is still a possibility. – eppesuig Jan 30 '13 at 13:16
  • I said not plausible, not that it was out of question. – vonbrand Jan 30 '13 at 13:35
  • Some other ridiculous ideas: A symlink to somewhere strange? stat (no switches) say anything? – vonbrand Jan 30 '13 at 13:37
  • The crazy part is that stat hangs after printing that this is a normal file, nothing to see here, move along. Closes with a ctrl-C though. – Coderer Jan 30 '13 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.