Score:2

Symlink on /usr/local/bin/ not working

gf flag

Can someone explain why this is not working??? I don't get it.

$ echo $PATH
/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

As you can see, I have /usr/local/bin in there.

Then the error:

$ cmake
-bash: cmake: command not found

But I do have a symlink:

$ ls -la /usr/local/bin/
total 8
drwxr-xr-x  2 root root 4096 Mar 27 09:07 .
drwxr-xr-x 10 root root 4096 Jan 23 23:23 ..
lrwxrwxrwx  1 root root   20 Mar 27 09:07 cmake -> /opt/cmake/bin/cmake

And in fact, running it from inside the directory it works:

cd /usr/local/bin/
./cmake 

Any ideas?

Of course, if I edit my .bashrc and I add a line like:

export PATH="/opt/cmake/bin:$PATH"

Then it works. But that's not what I want to do.

Thanks!

MiloDC avatar
rs flag
Having the same issue. My PATH starts `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`, and `readlink -f /usr/local/bin/openssl` outputs `/usr/local/openssl/bin/openssl`. However, when I enter `openssl`, what gets executed is `/usr/bin/openssl`. Makes absolutely no sense.
Score:0
iq flag

There could be multiple reasons, here what you can do to check them:

  1. Check that the symlink target is executable with this command ls -la /opt/cmake/bin/cmake if not, give the proper rights sudo chmod +x /opt/cmake/bin/cmake.
  2. there can be another executable named cmake in the directories listed in your PATH variable, to check do this which -a cmake.
  3. Check that there is not a single errors PATH variables, things like extra spaces.
  4. Verify the symlink pointing readlink -f /opt/cmake/bin/cmake
  5. Check if /opt/cmake/bin is in your PATH variable
  6. Check that /opt/cmake/bin is not corrupted
  7. Check in a different shell
Mariano Martinez Peck avatar
gf flag
Hi @Saxtheowl. Thanks for all the ideas. I checked all of them and they all seem to be correct. That is, 1) already has x permission ; 2) there isn't another one on PATH (`which` answers nothing) ; 3) I double checked and I don't see anything...
Saxtheowl avatar
iq flag
I have added more tests to do, if this still dont work im kinda lost here
Mariano Martinez Peck avatar
gf flag
Hi @Saxtheowl. Regarding 5), it is not. However, if I add it, it obviously work. But that's not what I wanted to do and that's why I made the symlink to somewhere I already had in the PATH. Do you know why adding /opt/cmake/bin to PATH seems to be necessary?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.