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
Best Answer
Try find.
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,
Here's my test
--- 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.