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

13,585

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?

Share:
13,585

Related videos on Youtube

wim
Author by

wim

Hi from Chicago! Python dev with interest in mathematics, music, robotics and computer vision. I hope my Q&A have been helpful for you. If one of my answers has saved your butt today and you would like a way to say thank you, then feel free to buy me a coffee! :-D [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo *Click*

Updated on September 18, 2022

Comments

  • wim
    wim almost 2 years
    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.

    • mpy
      mpy about 11 years
      Try ls -ld, where -d tells to list directory entries instead of contents, and do not dereference symbolic links
  • wim
    wim about 11 years
    It's NFS on a synology NAS, the share is mounted in Ubuntu 13.04. Last line of dmesg was [75632.751021] NFS: directory dots/manouche contains a readdir loop.Please contact your server vendor. The file: ARPEGEDIATONIQUEG7.pdf has duplicate cookie 812789874
  • LSerni
    LSerni about 11 years
    As I feared. The problem is not in the filesystem, it is in the NFS layer of the Synology (see forum.synology.com/enu/viewtopic.php?f=41&t=61474). You'll have to switch to CIFS/Samba if possible, or query Synology for a 'firmware' update. There are a couple of hacks described here: cyberciti.biz/tips/… .
  • wim
    wim about 11 years
    Thanks for your advice, I'm trying a firmware upgrade to DSM-4.2-3211 (was on 4.1-2636)