3

After I install any project on my Debian (Buster) machine with sudo cmake install or sudo make install command, the binary gets placed inside /usr/local/bin but although the PATH variable is set correctly and even after a reboot, bash or fish cant find the command for the binaries installed that way.

This happened with cmake and nvim so far. For nvim, for example, I followed the build from source instructions:

  1. cloned repo with git
  2. make CMAKE_BUILD_TYPE=Release
  3. sudo make install

Now if I run nvim, the command is not found, but if I run sudo nvim the binary is started correctly.

I compared the file permissions of binaries that are perfectly executable without sudo rights inside /usr/bin and they are exactly the same permissions as the binaries inside /usr/local/bin.

-rwxr-xr-x 1 root root.

What am I doing wrong, and why are the binaries inside /usr/bin executable without sudo and files installed from source inside /usr/local/bin not?

This is my PATH variable: /usr/local/bin:/usr/bin:/bin:/usr/games

Additional info: If I run: /usr/local/bin/nvim this is the output: fish: The file “/usr/local/bin/nvim” is not executable by this user

If I run type -a nvim the output is: type: Could not find 'nvim'

if I run sudo ./pathlld /usr/local/bin/nvim I get the following output:

drwxr-xr-x 19 root root 4096 Dec 22 12:17 /
/dev/nvme0n1p2 on / type ext4 (rw,relatime)
drwxr-xr-x 14 root root 4096 May  5 13:19 /usr
drwxr-xr-x 7 root root 4096 Mar 24 15:51 /usr/local
drwx------ 2 root root 4096 May  5 14:21 /usr/local/bin
-rwxr-xr-x 1 root root 10319072 May  5 14:21 /usr/local/bin/nvim

I'm running a custom OS by the company Siemens that is called "Siemens Industrial OS"; it is basically a Debian Buster with a realtime-patch.

13
  • 2
    Instead of showing only parts of the information, please run the commands ls -l /usr/local/bin/nvim* and type /usr/local/bin/nvim* and copy&paste the commands and their output. What is your OS? Which version of fish do you use? Maybe this is related: superuser.com/q/1270908/992527
    – Bodo
    Commented May 5, 2022 at 13:56
  • @Bodo the OS is Debian, mentioned in the first sentence.
    – terdon
    Commented May 5, 2022 at 14:05
  • 1
    Is it possible that /usr/local is on a separate filesystem, that is mounted with the noexec option? Commented May 5, 2022 at 16:03
  • @steeldriver shouldn't this affect the root user also?
    – thanasisp
    Commented May 5, 2022 at 16:26
  • 1
    Explore your Mount/Read/Write/Execute problems with https://github.com/waltinator/pathlld, a bash script to show the permissions, mount options along the path to an object or objects.
    – waltinator
    Commented May 5, 2022 at 19:58

1 Answer 1

2

The problem is this:

drwx------ 2 root root 4096 May  5 14:21 /usr/local/bin

group and others have no execute and read permission on /usr/local/bin. Run as root:

chmod 755 /usr/local/bin

to restore the standard permissions for this directory.

2
  • Thank you so much this solved it! Do you know why this path was set like this by default? I have two systems that I set up the same way with the same OS from Siemens that I did not change permissions to that path this was by default!?
    – shyney
    Commented May 6, 2022 at 7:54
  • 1
    I don't know the reasons for a specific OS to do it. I don't think that a common Linux distribution would set it like this as default, this directory should be executable for others by default.
    – thanasisp
    Commented May 6, 2022 at 7:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .