LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-21-2013, 10:40 AM   #1
vitronix
Member
 
Registered: Dec 2012
Posts: 56

Rep: Reputation: Disabled
Failed to create symbolic link


Hello,

Maybe it's a bit odd, being a newbie, but I started with Linux From Scratch.
I've read my Linux books and I don't understand why I caoonot create a symbolic link.
Here's the output:

root@sparrow:/mnt/lfs# ln -sv /tools /
ln: failed to create symbolic link `/tools': File exists

I looked in the root directory but there is no link there.

Can anyone explain?

Thanks in advance.
 
Old 01-21-2013, 10:56 AM   #2
divyashree
Senior Member
 
Registered: Apr 2007
Location: Bangalore, India
Distribution: RHEL,SuSE,CentOS,Fedora,Ubuntu
Posts: 1,386

Rep: Reputation: 135Reputation: 135
You should give a file name to the symboliclink for /tools. Otherwise it will be an infiniteloop symbolic link.

e.g

Quote:
ln -sv /tools /tools1
 
Old 01-21-2013, 11:08 AM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
As per manual of ln, syntax is:

Code:
ln [OPTION]... [-T] TARGET LINK_NAME   (1st form)
ln [OPTION]... TARGET		      (2nd form)
ln [OPTION]... TARGET... DIRECTORY     (3rd form)
ln [OPTION]... -t DIRECTORY TARGET...  (4th form)
..... .....
Or in simple form,
Code:
ln [option] source_dir linkname
So in order to create a link of /tools, do it as:-
Code:
~$ ln -s /tools <linkname>
~$ ls -l linkname
...... linkname -> /tools
 
Old 01-21-2013, 11:14 AM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
The problem is you're telling it to create a link to /tools in /. Since you didn't give it a name, it will use the name of the target, which is tools. So essentially the command you're issuing is:
ln -sv /tools /tools

The error is because it can't create a link called /tools because a file of that name already exists (it also happens to be the one you're trying to link to, which if the command went through would be replaced by a link pointing to itself).

Last edited by suicidaleggroll; 01-21-2013 at 11:17 AM.
 
Old 01-21-2013, 05:33 PM   #5
vitronix
Member
 
Registered: Dec 2012
Posts: 56

Original Poster
Rep: Reputation: Disabled
Talking Solved

Quote:
Originally Posted by vitronix View Post
Hello,

Maybe it's a bit odd, being a newbie, but I started with Linux From Scratch.
I've read my Linux books and I don't understand why I caoonot create a symbolic link.
Here's the output:

root@sparrow:/mnt/lfs# ln -sv /tools /
ln: failed to create symbolic link `/tools': File exists

I looked in the root directory but there is no link there.

Can anyone explain?

Thanks in advance.
I'm sorry to have waisted your time, but somehow I created a directory tools.
After removing this directory the command works
 
Old 01-21-2013, 09:18 PM   #6
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
:)

Good, then mark the thread as solved (on top menu, select Thread Tools option and Mark this thread as solved).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Failed To Create Symbolic Link In Chapter 3 of LFS 6.8 gdawg Linux From Scratch 5 06-14-2011 08:20 AM
How to create symbolic link? your_shadow03 Linux - Newbie 4 12-05-2009 04:15 AM
How to create symbolic link to html file and avoid page link problem? haxpor Linux - General 2 01-29-2008 07:40 AM
How to create a Symbolic Link? sikandar Linux - Software 6 09-09-2003 11:41 AM
how do I create a symbolic link? rdaves@earthlink.net Linux - Newbie 2 05-23-2001 01:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration