How to remove a directory with “Too many levels of symlinks”

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












7















I have a bit of an odd problem on a RHEL system.



On our systems we have our home directory automounted under /export/home. There are a few exceptions, as I'm experimenting with using gluster for our home dirs. These are automounted under /gluster/home



This works on all our (30+) servers. Today this stopped working on one of them. I get the error:



Too many levels of symlinks


when trying to cd into /gluster/home/$HOME...



I ended up temporary moving /gluster to /gluster_broken, and made a new /gluster/home, restarted autofs and things work again.



Now I want to remove /gluster_broken.



The problem is that aparently there is some symlink loop in /gluster_broken/home. I don't know where it came from. My attempts to get rid of it have been fruitless so far.



[root@dc1-03 /]# rm -rf gluster_broken/
rm: cannot remove `gluster_broken/home': Too many levels of symbolic links
[root@dc1-03 /]# rm -rf /gluster_broken/
rm: cannot remove `/gluster_broken/home': Too many levels of symbolic links
[root@dc1-03 /]# rm -rf /gluster_broken/home/
rm: cannot remove `/gluster_broken/home/': Is a directory
[root@dc1-03 /]# rm -rf /gluster_broken/home
rm: cannot remove `/gluster_broken/home': Too many levels of symbolic links
[root@dc1-03 /]# rmdir /gluster_broken/home/
rmdir: failed to remove `/gluster_broken/home/': Device or resource busy
[root@dc1-03 /]# fuser -m /gluster_broken/home/
Cannot stat /gluster_broken/home/: Too many levels of symbolic links
Cannot stat /gluster_broken/home/: Too many levels of symbolic links
Cannot stat /gluster_broken/home/: Too many levels of symbolic links
[root@dc1-03 /]# ls -ld /gluster_broken/home/
ls: cannot access /gluster_broken/home/: Too many levels of symbolic links
[root@dc1-03 /]# ls -ld /gluster_broken/home
drwxr-xr-x. 2 root root 0 Jan 22 10:20 /gluster_broken/home
[root@dc1-03 /]# fuser -m /gluster_broken/home


As you can see most commands all yield the same error message. I would really like to get rid of this problem. But I'm a bit at a loss here. Any suggestions?



Output of suggested commands:



[root@dc1-03 /]# ls /gluster_broken/
home
[root@dc1-03 /]# ls /gluster_broken/home/
ls: cannot access /gluster_broken/home/: Too many levels of symbolic links
[root@dc1-03 /]# ls -hblF /gluster_broken /gluster_broken/home
/gluster_broken:
total 0
drwxr-xr-x. 2 root root 0 Feb 4 12:00 home/
ls: cannot open directory /gluster_broken/home: Too many levels of symbolic links









share|improve this question
























  • A bit of a guess/hack, but what if you mount something to gluster_broken/home then try to rm -rf gluster_broken ?

    – virtualxtc
    Feb 4 '14 at 8:43











  • An obvious question, but what does gluster_broken contain? Can you give a listing?

    – Faheem Mitha
    Feb 4 '14 at 8:45






  • 2





    How is /gluster_broken/home mounted (as seen in /proc/mounts)?

    – Stéphane Chazelas
    Feb 4 '14 at 10:46












  • Can you show the output of ls -hblF /gluster_broken /gluster_broken/home

    – RSFalcon7
    Feb 4 '14 at 11:03











  • What does namei /gluster_broken/home say?

    – Gilles
    Feb 4 '14 at 23:29















7















I have a bit of an odd problem on a RHEL system.



On our systems we have our home directory automounted under /export/home. There are a few exceptions, as I'm experimenting with using gluster for our home dirs. These are automounted under /gluster/home



This works on all our (30+) servers. Today this stopped working on one of them. I get the error:



Too many levels of symlinks


when trying to cd into /gluster/home/$HOME...



I ended up temporary moving /gluster to /gluster_broken, and made a new /gluster/home, restarted autofs and things work again.



Now I want to remove /gluster_broken.



The problem is that aparently there is some symlink loop in /gluster_broken/home. I don't know where it came from. My attempts to get rid of it have been fruitless so far.



[root@dc1-03 /]# rm -rf gluster_broken/
rm: cannot remove `gluster_broken/home': Too many levels of symbolic links
[root@dc1-03 /]# rm -rf /gluster_broken/
rm: cannot remove `/gluster_broken/home': Too many levels of symbolic links
[root@dc1-03 /]# rm -rf /gluster_broken/home/
rm: cannot remove `/gluster_broken/home/': Is a directory
[root@dc1-03 /]# rm -rf /gluster_broken/home
rm: cannot remove `/gluster_broken/home': Too many levels of symbolic links
[root@dc1-03 /]# rmdir /gluster_broken/home/
rmdir: failed to remove `/gluster_broken/home/': Device or resource busy
[root@dc1-03 /]# fuser -m /gluster_broken/home/
Cannot stat /gluster_broken/home/: Too many levels of symbolic links
Cannot stat /gluster_broken/home/: Too many levels of symbolic links
Cannot stat /gluster_broken/home/: Too many levels of symbolic links
[root@dc1-03 /]# ls -ld /gluster_broken/home/
ls: cannot access /gluster_broken/home/: Too many levels of symbolic links
[root@dc1-03 /]# ls -ld /gluster_broken/home
drwxr-xr-x. 2 root root 0 Jan 22 10:20 /gluster_broken/home
[root@dc1-03 /]# fuser -m /gluster_broken/home


As you can see most commands all yield the same error message. I would really like to get rid of this problem. But I'm a bit at a loss here. Any suggestions?



Output of suggested commands:



[root@dc1-03 /]# ls /gluster_broken/
home
[root@dc1-03 /]# ls /gluster_broken/home/
ls: cannot access /gluster_broken/home/: Too many levels of symbolic links
[root@dc1-03 /]# ls -hblF /gluster_broken /gluster_broken/home
/gluster_broken:
total 0
drwxr-xr-x. 2 root root 0 Feb 4 12:00 home/
ls: cannot open directory /gluster_broken/home: Too many levels of symbolic links









share|improve this question
























  • A bit of a guess/hack, but what if you mount something to gluster_broken/home then try to rm -rf gluster_broken ?

    – virtualxtc
    Feb 4 '14 at 8:43











  • An obvious question, but what does gluster_broken contain? Can you give a listing?

    – Faheem Mitha
    Feb 4 '14 at 8:45






  • 2





    How is /gluster_broken/home mounted (as seen in /proc/mounts)?

    – Stéphane Chazelas
    Feb 4 '14 at 10:46












  • Can you show the output of ls -hblF /gluster_broken /gluster_broken/home

    – RSFalcon7
    Feb 4 '14 at 11:03











  • What does namei /gluster_broken/home say?

    – Gilles
    Feb 4 '14 at 23:29













7












7








7








I have a bit of an odd problem on a RHEL system.



On our systems we have our home directory automounted under /export/home. There are a few exceptions, as I'm experimenting with using gluster for our home dirs. These are automounted under /gluster/home



This works on all our (30+) servers. Today this stopped working on one of them. I get the error:



Too many levels of symlinks


when trying to cd into /gluster/home/$HOME...



I ended up temporary moving /gluster to /gluster_broken, and made a new /gluster/home, restarted autofs and things work again.



Now I want to remove /gluster_broken.



The problem is that aparently there is some symlink loop in /gluster_broken/home. I don't know where it came from. My attempts to get rid of it have been fruitless so far.



[root@dc1-03 /]# rm -rf gluster_broken/
rm: cannot remove `gluster_broken/home': Too many levels of symbolic links
[root@dc1-03 /]# rm -rf /gluster_broken/
rm: cannot remove `/gluster_broken/home': Too many levels of symbolic links
[root@dc1-03 /]# rm -rf /gluster_broken/home/
rm: cannot remove `/gluster_broken/home/': Is a directory
[root@dc1-03 /]# rm -rf /gluster_broken/home
rm: cannot remove `/gluster_broken/home': Too many levels of symbolic links
[root@dc1-03 /]# rmdir /gluster_broken/home/
rmdir: failed to remove `/gluster_broken/home/': Device or resource busy
[root@dc1-03 /]# fuser -m /gluster_broken/home/
Cannot stat /gluster_broken/home/: Too many levels of symbolic links
Cannot stat /gluster_broken/home/: Too many levels of symbolic links
Cannot stat /gluster_broken/home/: Too many levels of symbolic links
[root@dc1-03 /]# ls -ld /gluster_broken/home/
ls: cannot access /gluster_broken/home/: Too many levels of symbolic links
[root@dc1-03 /]# ls -ld /gluster_broken/home
drwxr-xr-x. 2 root root 0 Jan 22 10:20 /gluster_broken/home
[root@dc1-03 /]# fuser -m /gluster_broken/home


As you can see most commands all yield the same error message. I would really like to get rid of this problem. But I'm a bit at a loss here. Any suggestions?



Output of suggested commands:



[root@dc1-03 /]# ls /gluster_broken/
home
[root@dc1-03 /]# ls /gluster_broken/home/
ls: cannot access /gluster_broken/home/: Too many levels of symbolic links
[root@dc1-03 /]# ls -hblF /gluster_broken /gluster_broken/home
/gluster_broken:
total 0
drwxr-xr-x. 2 root root 0 Feb 4 12:00 home/
ls: cannot open directory /gluster_broken/home: Too many levels of symbolic links









share|improve this question
















I have a bit of an odd problem on a RHEL system.



On our systems we have our home directory automounted under /export/home. There are a few exceptions, as I'm experimenting with using gluster for our home dirs. These are automounted under /gluster/home



This works on all our (30+) servers. Today this stopped working on one of them. I get the error:



Too many levels of symlinks


when trying to cd into /gluster/home/$HOME...



I ended up temporary moving /gluster to /gluster_broken, and made a new /gluster/home, restarted autofs and things work again.



Now I want to remove /gluster_broken.



The problem is that aparently there is some symlink loop in /gluster_broken/home. I don't know where it came from. My attempts to get rid of it have been fruitless so far.



[root@dc1-03 /]# rm -rf gluster_broken/
rm: cannot remove `gluster_broken/home': Too many levels of symbolic links
[root@dc1-03 /]# rm -rf /gluster_broken/
rm: cannot remove `/gluster_broken/home': Too many levels of symbolic links
[root@dc1-03 /]# rm -rf /gluster_broken/home/
rm: cannot remove `/gluster_broken/home/': Is a directory
[root@dc1-03 /]# rm -rf /gluster_broken/home
rm: cannot remove `/gluster_broken/home': Too many levels of symbolic links
[root@dc1-03 /]# rmdir /gluster_broken/home/
rmdir: failed to remove `/gluster_broken/home/': Device or resource busy
[root@dc1-03 /]# fuser -m /gluster_broken/home/
Cannot stat /gluster_broken/home/: Too many levels of symbolic links
Cannot stat /gluster_broken/home/: Too many levels of symbolic links
Cannot stat /gluster_broken/home/: Too many levels of symbolic links
[root@dc1-03 /]# ls -ld /gluster_broken/home/
ls: cannot access /gluster_broken/home/: Too many levels of symbolic links
[root@dc1-03 /]# ls -ld /gluster_broken/home
drwxr-xr-x. 2 root root 0 Jan 22 10:20 /gluster_broken/home
[root@dc1-03 /]# fuser -m /gluster_broken/home


As you can see most commands all yield the same error message. I would really like to get rid of this problem. But I'm a bit at a loss here. Any suggestions?



Output of suggested commands:



[root@dc1-03 /]# ls /gluster_broken/
home
[root@dc1-03 /]# ls /gluster_broken/home/
ls: cannot access /gluster_broken/home/: Too many levels of symbolic links
[root@dc1-03 /]# ls -hblF /gluster_broken /gluster_broken/home
/gluster_broken:
total 0
drwxr-xr-x. 2 root root 0 Feb 4 12:00 home/
ls: cannot open directory /gluster_broken/home: Too many levels of symbolic links






symlink






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 5 '14 at 14:04







Krist van Besien

















asked Feb 4 '14 at 8:36









Krist van BesienKrist van Besien

136115




136115












  • A bit of a guess/hack, but what if you mount something to gluster_broken/home then try to rm -rf gluster_broken ?

    – virtualxtc
    Feb 4 '14 at 8:43











  • An obvious question, but what does gluster_broken contain? Can you give a listing?

    – Faheem Mitha
    Feb 4 '14 at 8:45






  • 2





    How is /gluster_broken/home mounted (as seen in /proc/mounts)?

    – Stéphane Chazelas
    Feb 4 '14 at 10:46












  • Can you show the output of ls -hblF /gluster_broken /gluster_broken/home

    – RSFalcon7
    Feb 4 '14 at 11:03











  • What does namei /gluster_broken/home say?

    – Gilles
    Feb 4 '14 at 23:29

















  • A bit of a guess/hack, but what if you mount something to gluster_broken/home then try to rm -rf gluster_broken ?

    – virtualxtc
    Feb 4 '14 at 8:43











  • An obvious question, but what does gluster_broken contain? Can you give a listing?

    – Faheem Mitha
    Feb 4 '14 at 8:45






  • 2





    How is /gluster_broken/home mounted (as seen in /proc/mounts)?

    – Stéphane Chazelas
    Feb 4 '14 at 10:46












  • Can you show the output of ls -hblF /gluster_broken /gluster_broken/home

    – RSFalcon7
    Feb 4 '14 at 11:03











  • What does namei /gluster_broken/home say?

    – Gilles
    Feb 4 '14 at 23:29
















A bit of a guess/hack, but what if you mount something to gluster_broken/home then try to rm -rf gluster_broken ?

– virtualxtc
Feb 4 '14 at 8:43





A bit of a guess/hack, but what if you mount something to gluster_broken/home then try to rm -rf gluster_broken ?

– virtualxtc
Feb 4 '14 at 8:43













An obvious question, but what does gluster_broken contain? Can you give a listing?

– Faheem Mitha
Feb 4 '14 at 8:45





An obvious question, but what does gluster_broken contain? Can you give a listing?

– Faheem Mitha
Feb 4 '14 at 8:45




2




2





How is /gluster_broken/home mounted (as seen in /proc/mounts)?

– Stéphane Chazelas
Feb 4 '14 at 10:46






How is /gluster_broken/home mounted (as seen in /proc/mounts)?

– Stéphane Chazelas
Feb 4 '14 at 10:46














Can you show the output of ls -hblF /gluster_broken /gluster_broken/home

– RSFalcon7
Feb 4 '14 at 11:03





Can you show the output of ls -hblF /gluster_broken /gluster_broken/home

– RSFalcon7
Feb 4 '14 at 11:03













What does namei /gluster_broken/home say?

– Gilles
Feb 4 '14 at 23:29





What does namei /gluster_broken/home say?

– Gilles
Feb 4 '14 at 23:29










4 Answers
4






active

oldest

votes


















4














Try find.



find -L /gluster_broken -mindepth 10


to find the link loops



then a non recursive rm on the erroneous file(s)



find will follow links and find the same "too many levels" error. I use -mindepth to filter out anything less than 10 deep to avoid the ok files/directories. Yes, this does assume that you don't have more that 10 deep in your normal tree. All this command is trying to do is find the file in error.



-- edit



I think following command is better,



find -L /gluster_broken >/dev/null


Here's my test



$ find .
.
./dira
./dira/a
./dira/dirb
./dira/dirb/dirc
./dira/error
./dira/b
./dira/test
./dira/test/ab&<cd.file
./dira/test/magic?newlines
./dira/test/cleanup
$ find -L . >/dev/null
find: ‘./dira/a’: Too many levels of symbolic links
find: ‘./dira/error’: Too many levels of symbolic links
find: ‘./dira/b’: Too many levels of symbolic links
$


--- edit 2



I think my suggestion (comment) to check file-system might be best, I have just seen this answer and wonder if you have a similar issue.






share|improve this answer

























  • Why does this work?

    – Anko
    Feb 4 '14 at 16:59











  • Oops there's a typo -maxdepth 10 shouldn't be there. I'll edit.

    – X Tian
    Feb 4 '14 at 18:05











  • My problem is that about anything that somehow tries to do something with /gluster_broken/home throws this "to many levels of symbolic links" error. The "find" command suggested above does throw this error too, so I am not getting any usefull info out of it.

    – Krist van Besien
    Feb 5 '14 at 14:02











  • I think that /gluster_broken/home is looping on to itself. I would like to know however how this happened, and what I can do to fix it.

    – Krist van Besien
    Feb 5 '14 at 14:07











  • Would be so interesting to see output of ls -l /gluster_broken .

    – X Tian
    Feb 5 '14 at 15:14


















4














Maybe I'm wrong, but it seems no one else answered the question.



The issue is that you have the / at the end of your command.



Instead of



rm gluster/


just run



rm gluster


By putting the / at the end you are attempting to go into the directory, which is a circular link, so it never finds the bottom. Without the /, you are simply removing the symbolic link.






share|improve this answer






























    1














    I recently ran into this same problem when creating a symlink without giving it an absolute directory.



    This gave the same error when trying to read the file ("Too many levels of symlinks"):



    ln -s ./config ~/.config/terminator


    Seemingly because the symlink tries to go back on itself:



    ls -l ~/.config/terminator
    lrwxrwxrwx 1 zane zane 8 Dec 22 16:14 config -> ./config


    But this worked:



    ln -s /home/zane/config ~/.config/terminator/config


    Hopefully, this will help someone in the same situation.






    share|improve this answer

























    • Yes, but here we see the symlink object.

      – Kaz
      Oct 13 '16 at 5:35


















    0














    You cant remove /gluster_broken/home becouse /gluster_broken is a broken link itself.



    ls -l /gluster_broken


    you will see it is a link. So remove it:



    rm /gluster_broken





    share|improve this answer






















      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f113433%2fhow-to-remove-a-directory-with-too-many-levels-of-symlinks%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      4














      Try find.



      find -L /gluster_broken -mindepth 10


      to find the link loops



      then a non recursive rm on the erroneous file(s)



      find will follow links and find the same "too many levels" error. I use -mindepth to filter out anything less than 10 deep to avoid the ok files/directories. Yes, this does assume that you don't have more that 10 deep in your normal tree. All this command is trying to do is find the file in error.



      -- edit



      I think following command is better,



      find -L /gluster_broken >/dev/null


      Here's my test



      $ find .
      .
      ./dira
      ./dira/a
      ./dira/dirb
      ./dira/dirb/dirc
      ./dira/error
      ./dira/b
      ./dira/test
      ./dira/test/ab&<cd.file
      ./dira/test/magic?newlines
      ./dira/test/cleanup
      $ find -L . >/dev/null
      find: ‘./dira/a’: Too many levels of symbolic links
      find: ‘./dira/error’: Too many levels of symbolic links
      find: ‘./dira/b’: Too many levels of symbolic links
      $


      --- edit 2



      I think my suggestion (comment) to check file-system might be best, I have just seen this answer and wonder if you have a similar issue.






      share|improve this answer

























      • Why does this work?

        – Anko
        Feb 4 '14 at 16:59











      • Oops there's a typo -maxdepth 10 shouldn't be there. I'll edit.

        – X Tian
        Feb 4 '14 at 18:05











      • My problem is that about anything that somehow tries to do something with /gluster_broken/home throws this "to many levels of symbolic links" error. The "find" command suggested above does throw this error too, so I am not getting any usefull info out of it.

        – Krist van Besien
        Feb 5 '14 at 14:02











      • I think that /gluster_broken/home is looping on to itself. I would like to know however how this happened, and what I can do to fix it.

        – Krist van Besien
        Feb 5 '14 at 14:07











      • Would be so interesting to see output of ls -l /gluster_broken .

        – X Tian
        Feb 5 '14 at 15:14















      4














      Try find.



      find -L /gluster_broken -mindepth 10


      to find the link loops



      then a non recursive rm on the erroneous file(s)



      find will follow links and find the same "too many levels" error. I use -mindepth to filter out anything less than 10 deep to avoid the ok files/directories. Yes, this does assume that you don't have more that 10 deep in your normal tree. All this command is trying to do is find the file in error.



      -- edit



      I think following command is better,



      find -L /gluster_broken >/dev/null


      Here's my test



      $ find .
      .
      ./dira
      ./dira/a
      ./dira/dirb
      ./dira/dirb/dirc
      ./dira/error
      ./dira/b
      ./dira/test
      ./dira/test/ab&<cd.file
      ./dira/test/magic?newlines
      ./dira/test/cleanup
      $ find -L . >/dev/null
      find: ‘./dira/a’: Too many levels of symbolic links
      find: ‘./dira/error’: Too many levels of symbolic links
      find: ‘./dira/b’: Too many levels of symbolic links
      $


      --- edit 2



      I think my suggestion (comment) to check file-system might be best, I have just seen this answer and wonder if you have a similar issue.






      share|improve this answer

























      • Why does this work?

        – Anko
        Feb 4 '14 at 16:59











      • Oops there's a typo -maxdepth 10 shouldn't be there. I'll edit.

        – X Tian
        Feb 4 '14 at 18:05











      • My problem is that about anything that somehow tries to do something with /gluster_broken/home throws this "to many levels of symbolic links" error. The "find" command suggested above does throw this error too, so I am not getting any usefull info out of it.

        – Krist van Besien
        Feb 5 '14 at 14:02











      • I think that /gluster_broken/home is looping on to itself. I would like to know however how this happened, and what I can do to fix it.

        – Krist van Besien
        Feb 5 '14 at 14:07











      • Would be so interesting to see output of ls -l /gluster_broken .

        – X Tian
        Feb 5 '14 at 15:14













      4












      4








      4







      Try find.



      find -L /gluster_broken -mindepth 10


      to find the link loops



      then a non recursive rm on the erroneous file(s)



      find will follow links and find the same "too many levels" error. I use -mindepth to filter out anything less than 10 deep to avoid the ok files/directories. Yes, this does assume that you don't have more that 10 deep in your normal tree. All this command is trying to do is find the file in error.



      -- edit



      I think following command is better,



      find -L /gluster_broken >/dev/null


      Here's my test



      $ find .
      .
      ./dira
      ./dira/a
      ./dira/dirb
      ./dira/dirb/dirc
      ./dira/error
      ./dira/b
      ./dira/test
      ./dira/test/ab&<cd.file
      ./dira/test/magic?newlines
      ./dira/test/cleanup
      $ find -L . >/dev/null
      find: ‘./dira/a’: Too many levels of symbolic links
      find: ‘./dira/error’: Too many levels of symbolic links
      find: ‘./dira/b’: Too many levels of symbolic links
      $


      --- edit 2



      I think my suggestion (comment) to check file-system might be best, I have just seen this answer and wonder if you have a similar issue.






      share|improve this answer















      Try find.



      find -L /gluster_broken -mindepth 10


      to find the link loops



      then a non recursive rm on the erroneous file(s)



      find will follow links and find the same "too many levels" error. I use -mindepth to filter out anything less than 10 deep to avoid the ok files/directories. Yes, this does assume that you don't have more that 10 deep in your normal tree. All this command is trying to do is find the file in error.



      -- edit



      I think following command is better,



      find -L /gluster_broken >/dev/null


      Here's my test



      $ find .
      .
      ./dira
      ./dira/a
      ./dira/dirb
      ./dira/dirb/dirc
      ./dira/error
      ./dira/b
      ./dira/test
      ./dira/test/ab&<cd.file
      ./dira/test/magic?newlines
      ./dira/test/cleanup
      $ find -L . >/dev/null
      find: ‘./dira/a’: Too many levels of symbolic links
      find: ‘./dira/error’: Too many levels of symbolic links
      find: ‘./dira/b’: Too many levels of symbolic links
      $


      --- edit 2



      I think my suggestion (comment) to check file-system might be best, I have just seen this answer and wonder if you have a similar issue.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Mar 20 '17 at 10:18









      Community

      1




      1










      answered Feb 4 '14 at 12:27









      X TianX Tian

      7,74512237




      7,74512237












      • Why does this work?

        – Anko
        Feb 4 '14 at 16:59











      • Oops there's a typo -maxdepth 10 shouldn't be there. I'll edit.

        – X Tian
        Feb 4 '14 at 18:05











      • My problem is that about anything that somehow tries to do something with /gluster_broken/home throws this "to many levels of symbolic links" error. The "find" command suggested above does throw this error too, so I am not getting any usefull info out of it.

        – Krist van Besien
        Feb 5 '14 at 14:02











      • I think that /gluster_broken/home is looping on to itself. I would like to know however how this happened, and what I can do to fix it.

        – Krist van Besien
        Feb 5 '14 at 14:07











      • Would be so interesting to see output of ls -l /gluster_broken .

        – X Tian
        Feb 5 '14 at 15:14

















      • Why does this work?

        – Anko
        Feb 4 '14 at 16:59











      • Oops there's a typo -maxdepth 10 shouldn't be there. I'll edit.

        – X Tian
        Feb 4 '14 at 18:05











      • My problem is that about anything that somehow tries to do something with /gluster_broken/home throws this "to many levels of symbolic links" error. The "find" command suggested above does throw this error too, so I am not getting any usefull info out of it.

        – Krist van Besien
        Feb 5 '14 at 14:02











      • I think that /gluster_broken/home is looping on to itself. I would like to know however how this happened, and what I can do to fix it.

        – Krist van Besien
        Feb 5 '14 at 14:07











      • Would be so interesting to see output of ls -l /gluster_broken .

        – X Tian
        Feb 5 '14 at 15:14
















      Why does this work?

      – Anko
      Feb 4 '14 at 16:59





      Why does this work?

      – Anko
      Feb 4 '14 at 16:59













      Oops there's a typo -maxdepth 10 shouldn't be there. I'll edit.

      – X Tian
      Feb 4 '14 at 18:05





      Oops there's a typo -maxdepth 10 shouldn't be there. I'll edit.

      – X Tian
      Feb 4 '14 at 18:05













      My problem is that about anything that somehow tries to do something with /gluster_broken/home throws this "to many levels of symbolic links" error. The "find" command suggested above does throw this error too, so I am not getting any usefull info out of it.

      – Krist van Besien
      Feb 5 '14 at 14:02





      My problem is that about anything that somehow tries to do something with /gluster_broken/home throws this "to many levels of symbolic links" error. The "find" command suggested above does throw this error too, so I am not getting any usefull info out of it.

      – Krist van Besien
      Feb 5 '14 at 14:02













      I think that /gluster_broken/home is looping on to itself. I would like to know however how this happened, and what I can do to fix it.

      – Krist van Besien
      Feb 5 '14 at 14:07





      I think that /gluster_broken/home is looping on to itself. I would like to know however how this happened, and what I can do to fix it.

      – Krist van Besien
      Feb 5 '14 at 14:07













      Would be so interesting to see output of ls -l /gluster_broken .

      – X Tian
      Feb 5 '14 at 15:14





      Would be so interesting to see output of ls -l /gluster_broken .

      – X Tian
      Feb 5 '14 at 15:14













      4














      Maybe I'm wrong, but it seems no one else answered the question.



      The issue is that you have the / at the end of your command.



      Instead of



      rm gluster/


      just run



      rm gluster


      By putting the / at the end you are attempting to go into the directory, which is a circular link, so it never finds the bottom. Without the /, you are simply removing the symbolic link.






      share|improve this answer



























        4














        Maybe I'm wrong, but it seems no one else answered the question.



        The issue is that you have the / at the end of your command.



        Instead of



        rm gluster/


        just run



        rm gluster


        By putting the / at the end you are attempting to go into the directory, which is a circular link, so it never finds the bottom. Without the /, you are simply removing the symbolic link.






        share|improve this answer

























          4












          4








          4







          Maybe I'm wrong, but it seems no one else answered the question.



          The issue is that you have the / at the end of your command.



          Instead of



          rm gluster/


          just run



          rm gluster


          By putting the / at the end you are attempting to go into the directory, which is a circular link, so it never finds the bottom. Without the /, you are simply removing the symbolic link.






          share|improve this answer













          Maybe I'm wrong, but it seems no one else answered the question.



          The issue is that you have the / at the end of your command.



          Instead of



          rm gluster/


          just run



          rm gluster


          By putting the / at the end you are attempting to go into the directory, which is a circular link, so it never finds the bottom. Without the /, you are simply removing the symbolic link.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 13 '16 at 4:13









          nivekmainivekmai

          411




          411





















              1














              I recently ran into this same problem when creating a symlink without giving it an absolute directory.



              This gave the same error when trying to read the file ("Too many levels of symlinks"):



              ln -s ./config ~/.config/terminator


              Seemingly because the symlink tries to go back on itself:



              ls -l ~/.config/terminator
              lrwxrwxrwx 1 zane zane 8 Dec 22 16:14 config -> ./config


              But this worked:



              ln -s /home/zane/config ~/.config/terminator/config


              Hopefully, this will help someone in the same situation.






              share|improve this answer

























              • Yes, but here we see the symlink object.

                – Kaz
                Oct 13 '16 at 5:35















              1














              I recently ran into this same problem when creating a symlink without giving it an absolute directory.



              This gave the same error when trying to read the file ("Too many levels of symlinks"):



              ln -s ./config ~/.config/terminator


              Seemingly because the symlink tries to go back on itself:



              ls -l ~/.config/terminator
              lrwxrwxrwx 1 zane zane 8 Dec 22 16:14 config -> ./config


              But this worked:



              ln -s /home/zane/config ~/.config/terminator/config


              Hopefully, this will help someone in the same situation.






              share|improve this answer

























              • Yes, but here we see the symlink object.

                – Kaz
                Oct 13 '16 at 5:35













              1












              1








              1







              I recently ran into this same problem when creating a symlink without giving it an absolute directory.



              This gave the same error when trying to read the file ("Too many levels of symlinks"):



              ln -s ./config ~/.config/terminator


              Seemingly because the symlink tries to go back on itself:



              ls -l ~/.config/terminator
              lrwxrwxrwx 1 zane zane 8 Dec 22 16:14 config -> ./config


              But this worked:



              ln -s /home/zane/config ~/.config/terminator/config


              Hopefully, this will help someone in the same situation.






              share|improve this answer















              I recently ran into this same problem when creating a symlink without giving it an absolute directory.



              This gave the same error when trying to read the file ("Too many levels of symlinks"):



              ln -s ./config ~/.config/terminator


              Seemingly because the symlink tries to go back on itself:



              ls -l ~/.config/terminator
              lrwxrwxrwx 1 zane zane 8 Dec 22 16:14 config -> ./config


              But this worked:



              ln -s /home/zane/config ~/.config/terminator/config


              Hopefully, this will help someone in the same situation.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Oct 13 '16 at 18:00

























              answered Dec 22 '14 at 21:16









              Zane HooperZane Hooper

              1214




              1214












              • Yes, but here we see the symlink object.

                – Kaz
                Oct 13 '16 at 5:35

















              • Yes, but here we see the symlink object.

                – Kaz
                Oct 13 '16 at 5:35
















              Yes, but here we see the symlink object.

              – Kaz
              Oct 13 '16 at 5:35





              Yes, but here we see the symlink object.

              – Kaz
              Oct 13 '16 at 5:35











              0














              You cant remove /gluster_broken/home becouse /gluster_broken is a broken link itself.



              ls -l /gluster_broken


              you will see it is a link. So remove it:



              rm /gluster_broken





              share|improve this answer



























                0














                You cant remove /gluster_broken/home becouse /gluster_broken is a broken link itself.



                ls -l /gluster_broken


                you will see it is a link. So remove it:



                rm /gluster_broken





                share|improve this answer

























                  0












                  0








                  0







                  You cant remove /gluster_broken/home becouse /gluster_broken is a broken link itself.



                  ls -l /gluster_broken


                  you will see it is a link. So remove it:



                  rm /gluster_broken





                  share|improve this answer













                  You cant remove /gluster_broken/home becouse /gluster_broken is a broken link itself.



                  ls -l /gluster_broken


                  you will see it is a link. So remove it:



                  rm /gluster_broken






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 25 at 8:07









                  xoidxoid

                  1213




                  1213



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f113433%2fhow-to-remove-a-directory-with-too-many-levels-of-symlinks%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown






                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Bahrain

                      Postfix configuration issue with fips on centos 7; mailgun relay