LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cannot execute symbolic link on Debian (https://www.linuxquestions.org/questions/linux-newbie-8/cannot-execute-symbolic-link-on-debian-651616/)

cold 06-25-2008 12:49 PM

Cannot execute symbolic link on Debian
 
hi there,
I have strange problem (strange for me) with sym-links:

1. I have executable, I can execute it by (chmod is 777 for sure):
../usr/bin/ccache

2. I create the sym-link
ln -sf ../usr/bin/ccache mylink

3. chmod 777 mylink (for sure)

4. ./mylink
error message comes up: "no such file or directory".

Please tell me what am I doing wrong?

Thnx in advance.

-jn.

bsdunix 06-25-2008 01:07 PM

I get the same error, but looking at ccache man page shows where/how to put the symbolic link. I followed those instructions and didn't see the error. I'm not sure if that's what you need to do.

cold 06-25-2008 01:18 PM

Thanks for hint. I've tried but no effect. Still the same problem :-(.

masinick 06-25-2008 01:36 PM

I noticed what appeared to be some extra .. in your spec
 
Quote:

Originally Posted by cold (Post 3194948)
Thanks for hint. I've tried but no effect. Still the same problem :-(.

In general, the symbolic link has the syntax:

Code:

ln -sf /FullPath-to-Real-Image Fake-link
Assuming the place you mention is correct, then the correct command would be something like:

Code:

(cd ~; ln -sf /usr/bin/ccache mylink)
This command:

1. Makes sure you are in your home directory, where you most certainly ought to be able to create a link and

2. Makes sure to use an absolute path name to the procedure.

A couple of other points:

1. Instead of using a compound command, you can also separate it into two distinct commands if you do not mind ending up in your home directory:

Code:

cd ~; ln -sf /usr/bin/ccache mylink
2. To ensure that /usr/bin/ccache is really a file and is accessible, try this:
Code:

file /usr/bin/ccache
That will tell you what kind of a file (executable, shell script, link, etc. this file appears on your system. If you believe that it could be a link, then
Code:

ls -l /usr/bin/ccache
will show you the location if there are links, then you can follow the potential cascade of links to either find a file pointed to by the links or a breakage of the links.

On my system, I in fact do not have such a file at all. Check yours to be sure what you are looking for is actually there and it is what you expect it to be.

Hope this helps you out.

cold 06-26-2008 05:12 AM

hi there,
thanks for hints. The only problem is that I cannot execute the link. The target is executable, I can execute "../usr/bin/ccache" (rights are 777 for sure). I've tried to create a link with absolute and with relative path as well, the behavior is the same.
What is strange for me, I can edit the file that the link points to, e.g.

1. ln -sf ../usr/bin/ccache mylink
2. file mylink
-> ... symbolic link to ...
3. vim ./mylink (rights are also set to 777)
(not nice, I know :-)). But I can see the content of the binary file!
4. ./mylink
mylink: no such file or directory.

Is it possible that there's some problem with SELinux? Or some strange access right settings that dinosaur like me is not aware of? :-).
Thanks in advance.

-jn.


All times are GMT -5. The time now is 09:14 AM.