NFS: too many levels of symbolic links. How to find and fix

filesystemsnfssymbolic-link

wim@wim-desktop:/media/data/dots/manouche$ ls > /dev/null
ls: reading directory .: Too many levels of symbolic links
wim@wim-desktop:/media/data/dots/manouche$ find . -type l -exec ls -l {} \;
wim@wim-desktop:/media/data/dots/manouche$ ls -lR . | grep ^l
ls: reading directory .: Too many levels of symbolic links

I have this problem on my filesystem, and googling suggests there is a circular symbolic link somewhere. But I can't find it, the commands I'm trying to recursively look for links aren't returning any results.

Best Answer

This is not the usual "circular link" error (that's why find doesn't help you). It says,

ls: **reading directory .**: Too many levels of symbolic links

So the error "Too many levels of symbolic links" is occurring while reading the current directory. It looks like a serious bug in either the driver or the physical filesystem; I'd try unmounting and fscking.

The error is caught in print_dir() inside the source of ls coreutil:

  else if (errno != 0)
  {
      file_failure (command_line_arg, _("reading directory %s"), name);
      if (errno != EOVERFLOW)
        break;
  }

and is caused by readdir returning ELOOP. It seems to be a bug concerning NFS which should leave traces in your dmesg (dmesg | tail). File system and OS version seem relevant; what are yours?

Related Question