Symbolic Link: No such file or directory
I created a symbolic Link from a File at "/opt/bladir/bla" to "bla". So "bla" is now in "/usr/bin/bla". But if I want to call "bla" at terminal, there comes the no such file or directory error. I looked up at "/usr/bin/bla" and the file is linking correctly at "/opt/bladir/bla".
What can be the error?
P.S. here is my terminal "entry": sudo ln -s /opt/bladir/bla bla
Thanks!
€: Problem solved. According to the Feature List, 12.04 should have Multiarch support... 'should'. I got the ia32-libs from synaptic and now the program wents just fine. As it looks, my symbolic links where correct.
Thank you for all the answers!
24 Answers
EDIT: the solution below does not work. It is apparent that the symbolic link is broken, because file -L cannot open the symbolic link /usr/bin/bla. In this case, do the following:
sudo ln -sf /opt/bladir/bla /usr/bin/blausing full paths (-f is to force overwriting the previous symbolic link, if there is one).
Hm. I think that the program "bla" may be looking for things that are installed in /opt/bladir and cannot find them. For example, it can be a shell script wrapper around a Java executable, with path relative to current directory: but your current directory is /usr/bin/, and not /opt/bladir/.
If the following works
file -L /usr/bin/bla...then it is definitely not a problem with your symbolic link.
Check whether "bla" is a shell script that you can modify, take a look inside -- maybe you will find the problem. Possibly, adding /opt/bladir to your PATH would be a better solution.
7Seems that you had a different problem than me since you said,
"I looked up at "/usr/bin/bla" and the file is linking correctly at "/opt/bladir/bla"."
However, for others coming here, I wanted to put ~/julia-1.5.3/bin/julia on PATH via symlink, so I basically did cd /home/username/ and then sudo ln -s julia-1.5.3/bin/julia /usr/local/bin/julia. When I typed julia, it said bash: /usr/local/bin/julia: No such file or directory. When I did ls -all /usr/local/bin, I found the issue; it was linking to the dangling relative directory: julia -> julia-1.5.3/bin/julia.
Anyway, I just had to redo it with the absolute path, and it worked:sudo ln -sf /home/username/julia-1.5.3/bin/julia /usr/local/bin/julia
Often this type of error message is shown, if you don't have execution bit enabled. Check whether the main file as well as the link is given execution permission.
I'm suspecting your /opt may be mounted from a separate partition and it isn't mounted with exec mount option
This isn't the case for this question, but another situation where this error could happen is if one of the directories has a space in it and isn't surrounded in quotation marks. for example:
ln -s my home/username/myfolder/a file.txt file.txtwill cause an error. but
ln -s my "home/username/myfolder/a file.txt" file.txtwill not.