Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So, I have a bit of a situation where I created many symlinks in an attempt to get them to work, trying all sorts of combinations .. now I have this error:

ls: cannot access /etc/sv/me: Too many levels of symbolic links

There is no symlinks in /service/ or /etc/sv/
Im a bit of a noob at linux, the only way I can find to solve this error is to remove all of the symlinks relating to /service/ or /etc/sv/ but i don't even see the symlinks?

share|improve this question

migrated from stackoverflow.com Apr 5 '12 at 5:56

This question came from our site for professional and enthusiast programmers.

up vote 5 down vote accepted

You can identify cyclic symlinks with a bit of find trickery, try this:

find /path/to/search -type l -a ! \( -xtype b -o -xtype c -o -xtype d -o -xtype p -o -xtype f -o -xtype s -o -xtype l \) 2>/dev/null

This works by filtering for symlinks, then excluding anything where the type of the symlink's target is any of the possible inode types. The only things are left are those where find can't determine the type of the target, which only happens for cyclic symlinks (broken ones match -xtype l)

share|improve this answer
Ah, awesome, ty :) – King Apr 5 '12 at 0:18
I have to admit, I was quite pleased when I discovered that one :-) – je4d Apr 5 '12 at 0:20
+1 for wizardry – Ascherer Apr 5 '12 at 0:22

Symlinks do not exhibit "action at a distance" -- being the target of a symlink never affects the target directly.

The error you're seeing indicates that either /etc, or /etc/sv, or /etc/sv/me is a symlink. Figure out which one it is and fix it.

share|improve this answer

Try using lower case -l (dash ell) instead of upper case -L when doing ls.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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