LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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, 11:40 AM   #1
vitronix
Member
 
Registered: Dec 2012
Posts: 45

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, 11:56 AM   #2
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,362

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, 12:08 PM   #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, 12:14 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
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 12:17 PM.
 
Old 01-21-2013, 06:33 PM   #5
vitronix
Member
 
Registered: Dec 2012
Posts: 45

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, 10: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 09:20 AM
How to create symbolic link? your_shadow03 Linux - Newbie 4 12-05-2009 05:15 AM
How to create symbolic link to html file and avoid page link problem? haxpor Linux - General 2 01-29-2008 08:40 AM
How to create a Symbolic Link? sikandar Linux - Software 6 09-09-2003 12:41 PM
how do I create a symbolic link? rdaves@earthlink.net Linux - Newbie 2 05-23-2001 02:28 PM


All times are GMT -5. The time now is 04:56 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration