LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   sh + bash can't find /usr/local/bin (https://www.linuxquestions.org/questions/linux-software-2/sh-bash-cant-find-usr-local-bin-688796/)

Orange13 12-06-2008 03:21 PM

sh + bash can't find /usr/local/bin
 
Hi. I'm running 64-bit Debian, the latest etch release.
I did a recent update of everything, and now I have the strangest
error: all of my scripts and Makefiles that reference /usr/local/bin/*
fail. And now I see that even command-line commands fail, like this:

/opt/music$ /usr/local/bin/bladeenc -br 320 -crc -progress=2 track01.wav
bash: /usr/local/bin/bladeenc: No such file or directory

/opt/music$ which bladeenc
/usr/local/bin/bladeenc

/opt/music$ ls -l /usr/local/bin/bladeenc
-rwxr-xr-x 1 root staff 279056 2004-12-06 10:53 /usr/local/bin/bladeenc

It's as if bash or sh has picked up an alias for /usr/local/bin executables,
and the new alias points to an empty subdirectory somewhere.

I get the same error message whenever I try to run a Makefile or shell script
that runs an executable in /usr/local/bin:
"No such file or directory" when it most assuredly is there, and the scripts
have been working correctly for years.

Does anybody have any ideas?
TIA.

x_terminat_or_3 12-06-2008 03:34 PM

Hi Orange13

You may need to install strace for this step, if it is not provided by your distro.

I would try to do this:

Code:

strace -vf -s1000 "/usr/local/bin/bladeenc -br 320 -crc -progress=2 track01.wav"
And paste the output here.

haertig 12-06-2008 03:53 PM

Possibly are these simple scripts, and the command interpreter they are invoking moved or became nonexistent after your update? Similar to the contrived example below where I purposely changed the scripts command interpreter to something invalid. The error message I get is not the exact one you are getting, but it's similar.

Code:

$ ls -la testme
-rwxr-xr-x  1 haertig haertig 25 2008-12-06 14:45 testme

$ cat testme
#! /bin/bash
echo hello

$ ./testme
hello

$ vi testme

$ cat testme
#! /bin/bogus_interpreter
echo hello

$ ./testme
-bash: ./testme: /bin/bogus_interpreter: bad interpreter: No such file or directory


Orange13 12-06-2008 08:13 PM

Quote:

Originally Posted by haertig (Post 3366649)
Possibly are these simple scripts, and the command interpreter they are invoking moved or became nonexistent after your update? Similar to the contrived example below where I purposely changed the scripts command interpreter to something invalid. The error message I get is not the exact one you are getting, but it's similar.

Code:

$ ls -la testme
-rwxr-xr-x  1 haertig haertig 25 2008-12-06 14:45 testme

$ cat testme
#! /bin/bash
echo hello

$ ./testme
hello

$ vi testme

$ cat testme
#! /bin/bogus_interpreter
echo hello

$ ./testme
-bash: ./testme: /bin/bogus_interpreter: bad interpreter: No such file or directory




I'm getting the same results as you are, which indicates that the command interpreter (bash) is itself okay.

Orange13 12-06-2008 08:20 PM

Quote:

Originally Posted by x_terminat_or_3 (Post 3366633)
Hi Orange13

You may need to install strace for this step, if it is not provided by your distro.

I would try to do this:

Code:

strace -vf -s1000 "/usr/local/bin/bladeenc -br 320 -crc -progress=2 track01.wav"
And paste the output here.

=======================================

Okay, I do have strace, so here it is:

prompt$: strace -vf -s1000 "/usr/local/bin/bladeenc -br 320 -crc -progress=2 track01.wav"
strace: /usr/local/bin/bladeenc -br 320 -crc -progress=2 track01.wav: command not found
## the quotation marks seem to be a problem here.

========================================
## with no quotes and no args:

prompt$: strace bladeenc
execve("/usr/local/bin/bladeenc", ["bladeenc"], [/* 32 vars */]) = -1 ENOENT (No such file or directory)
dup(2) = 3
fcntl(3, F_GETFL) = 0x8002 (flags O_RDWR|O_LARGEFILE)
fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 54), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b515866a000
lseek(3, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
write(3, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
close(3) = 0
munmap(0x2b515866a000, 4096) = 0
exit_group(1) = ?
Process 30433 detached


========================================
## with all args:
prompt$: strace -vf -s1000 /usr/local/bin/bladeenc -br 320 -crc -progress=2 track01.wav
execve("/usr/local/bin/bladeenc", ["/usr/local/bin/bladeenc", "-br", "320", "-crc", "-progress=2", "track01.wav"], ["KDE_MULTIHEAD=false", "SSH_AGENT_PID=9529", "DM_CONTROL=/var/run/xdmctl", "TERM=xterm", "SHELL=/bin/bash", "XDM_MANAGED=/var/run/xdmctl/xdmctl-:0,maysd,mayfn,sched,rsvd,method=classic", "GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/terry/.gtkrc-2.0:/home/terry/.kde/share/config/gtkrc-2.0", "GTK_RC_FILES=/etc/gtk/gtkrc:/home/terry/.gtkrc:/home/terry/.kde/share/config/gtkrc", "GS_LIB=/home/terry/.fonts", "WINDOWID=31458505", "OLDPWD=/opt/music", "KDE_FULL_SESSION=true", "USER=terry", "LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31 ;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz= 01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.j ar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga= 01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01 ;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.flac=01;35:*.mp3=01;35:* .mpc=01;35:*.ogg=01;35:*.wav=01;35:", "LIBGL_DRIVERS_PATH=/usr/lib32/dri:/usr/lib64/dri", "SSH_AUTH_SOCK=/tmp/ssh-Ueajgf9482/agent.9482", "SESSION_MANAGER=local/rebecca:/tmp/.ICE-unix/9579", "DESKTOP_SESSION=kde", "PATH=/usr/local/bin:/usr/bin:/bin:/usr/games", "PWD=/opt/music/Canned_Heat", "LANG=en_US.UTF-8", "HISTCONTROL=ignoredups", "SHLVL=2", "HOME=/home/terry", "XCURSOR_THEME=default", "LOGNAME=terry", "DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-AbOrEmwoCs,guid=d486405533c46972fba31a004934d091", "LESSOPEN=| /usr/bin/lesspipe %s", "DISPLAY=:0.0", "LESSCLOSE=/usr/bin/lesspipe %s %s", "COLORTERM=gnome-terminal", "_=/usr/bin/strace"]) = -1 ENOENT (No such file or directory)
dup(2) = 3
fcntl(3, F_GETFL) = 0x8002 (flags O_RDWR|O_LARGEFILE)
fstat(3, {st_dev=makedev(0, 11), st_ino=56, st_mode=S_IFCHR|0620, st_nlink=1, st_uid=1313, st_gid=5, st_blksize=1024, st_blocks=0, st_rdev=makedev(136, 54), st_atime=2008/12/06-18:07:09, st_mtime=2008/12/06-18:07:09, st_ctime=2008/12/01-22:07:34}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b349ceeb000
lseek(3, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
write(3, "strace: exec: No such file or directory\n", 40strace: exec: No such file or directory
) = 40
close(3) = 0
munmap(0x2b349ceeb000, 4096) = 0
exit_group(1) = ?
Process 30436 detached

Orange13 12-06-2008 08:46 PM

Hmmm, I'm noticing something here:
Quote:

"LIBGL_DRIVERS_PATH=/usr/lib32/dri:/usr/lib64/dri",
I was doing some housekeeping, and shoved some 32-bit libraries out
of the way recently. That is, for the last couple of years I've been
unsuccessfully fighting to make 32-bit Firefox run on my system, and it always bombed out with some library foobar.so not found. Copying the missing library from the same release of 32-bit Debian just led to another library missing, for many dozens of librarires. So I ended up copying the
whole mess of 32-bit libraries from a current 32-bit installation of
Debian, and putting it into /emul/ia32-linux. That made Firefox start running, and display local files, but it couldn't talk to the internet because the 32-bit libraries didn't seem to connect to the 64-bit kernel right.

Just recently, I decided to get rid of the superfluous stuff and renamed
that bundle of exteraneous stuff and put an empty subdirectory structure
of the same name in place. That is, /emul/ia32-linux, with subdirectories
of usr/lib and usr/share.

But I remember that there were a few things (very few) in there originally, before I tried adding to it.

I am guessing that something might be still using 32-bit libraries.

Well, I just put it all back, and merged a few updates that I see the updates installed there. Still no change though.

Orange13 12-06-2008 10:43 PM

Well, putting back all of those 32-bit libraries, and even rebooting changed nothing.

makyo 12-07-2008 06:52 AM

Hi.

A stab in the dark -- filesystem without "exec"? ... cheers, makyo

x_terminat_or_3 12-07-2008 10:14 AM

Quote:

execve("/usr/local/bin/bladeenc", ["/usr/local/bin/bladeenc", "-br", "320", "-crc", "-progress=2", "track01.wav"], . . . "COLORTERM=gnome-terminal", "_=/usr/bin/strace"]) = -1 ENOENT (No such file or directory)
That says it all, /usr/local/bin/bladeenc cannot be found.

try doing

Code:

stat /usr/local/bin/bladeenc

Orange13 12-07-2008 11:53 AM

Quote:

Originally Posted by x_terminat_or_3 (Post 3367171)
That says it all, /usr/local/bin/bladeenc cannot be found.

try doing

Code:

stat /usr/local/bin/bladeenc


~$ stat /usr/local/bin/bladeenc
File: `/usr/local/bin/bladeenc'
Size: 279056 Blocks: 560 IO Block: 4096 regular file
Device: 801h/2049d Inode: 57065499 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 50/ staff)
Access: 2008-12-06 20:38:30.000000000 -0800
Modify: 2004-12-06 10:53:51.000000000 -0800
Change: 2007-05-22 13:57:11.000000000 -0700


And it isn't just bladeenc. It's ALL of the executables in /usr/local/bin.
Bash doesn't find any of them. And yet the system is otherwise working okay, or I couldn't be posting this.

===============

Oh, by the way, I have 4 other 32-bit Debian Linux systems, and none of them have this
problem. It's peculiar to this one 64-bit system. (AMD dual-core Athlon).
In fact, by cross-mounting disks, I can use the 32-bit systems to run the tasks
that the 64-bit system won't. --Assuming, of course, that the same tasks are
installed in /usr/local/bin on both systems.

But all of this used to work a month ago.

Orange13 12-07-2008 11:56 AM

Quote:

Originally Posted by makyo (Post 3367042)
Hi.

A stab in the dark -- filesystem without "exec"? ... cheers, makyo

Hi. I don't understand that. The filestystem is just one partition, no separate partition for /usr/local. So the entire system is all the same one partition.

The subdirectory /usr/local/bin is:

~$ ls -ld /usr/local/bin
drwxrwsr-x 2 root staff 4096 2008-12-02 15:08 /usr/local/bin


--- now I'm wondering: Why is that subdirectory SetUID?

x_terminat_or_3 12-07-2008 12:01 PM

Ok, going by what makyo suggested, can you do a

Code:

cat /proc/mounts
And paste the output here please.

x_terminat_or_3 12-07-2008 12:05 PM

Can you also do a stat on every directory in the path /usr/local/bin (that is, stat /usr, stat /usr/local, stat /usr/local/bin)

Orange13 12-07-2008 02:08 PM

Quote:

Originally Posted by x_terminat_or_3 (Post 3367268)
Ok, going by what makyo suggested, can you do a

Code:

cat /proc/mounts
And paste the output here please.

rebecca:/home/terry# ROOT: cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / ext3 rw,data=ordered 0 0
tmpfs /lib/init/rw tmpfs rw,nosuid 0 0
proc /proc proc rw,nosuid,nodev,noexec 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec 0 0
usbfs /proc/bus/usb usbfs rw,nosuid,nodev,noexec 0 0
/dev/root /dev/.static/dev ext3 rw,data=ordered 0 0
tmpfs /dev tmpfs rw 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
devpts /dev/pts devpts rw,nosuid,noexec 0 0
/dev/sdb3 /opt2 ext3 rw,data=ordered 0 0
/dev/sdb1 /boot2 ext2 rw 0 0
lauren:/usr/local /local-lauren nfs rw,vers=3,rsize=131072,wsize=131072,hard,intr,proto=tcp,timeo=600,retrans=2,sec=sys,addr=lauren 0 0
lauren:/opt /opt-lauren nfs rw,vers=3,rsize=131072,wsize=131072,hard,intr,proto=tcp,timeo=600,retrans=2,sec=sys,addr=lauren 0 0
lauren:/home /home-lauren nfs rw,vers=3,rsize=131072,wsize=131072,hard,intr,proto=tcp,timeo=600,retrans=2,sec=sys,addr=lauren 0 0
cathey:/usr/local /local-cathey nfs rw,vers=3,rsize=32768,wsize=32768,hard,intr,proto=tcp,timeo=600,retrans=2,sec=sys,addr=cathey 0 0
cathey:/opt /opt-cathey nfs rw,vers=3,rsize=32768,wsize=32768,hard,intr,proto=tcp,timeo=600,retrans=2,sec=sys,addr=cathey 0 0
cathey:/home /home-cathey nfs rw,vers=3,rsize=32768,wsize=32768,hard,intr,proto=tcp,timeo=600,retrans=2,sec=sys,addr=cathey 0 0
nfsd /proc/fs/nfsd nfsd rw 0 0
rpc_pipefs /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
/dev/scd0 /media/GnomeBaker\040data\040disk iso9660 ro,nosuid,nodev,noexec,noatime 0 0
/dev/sdc4 /media/usbdisk ext2 rw,nosuid,nodev,noexec 0 0

Orange13 12-07-2008 02:11 PM

Quote:

Originally Posted by x_terminat_or_3 (Post 3367275)
Can you also do a stat on every directory in the path /usr/local/bin (that is, stat /usr, stat /usr/local, stat /usr/local/bin)

rebecca:/home/terry# ROOT: stat /usr
File: `/usr'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 801h/2049d Inode: 1343489 Links: 11
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2008-12-07 08:00:24.000000000 -0800
Modify: 2008-10-16 13:34:22.000000000 -0700
Change: 2008-10-16 13:34:22.000000000 -0700
rebecca:/home/terry# ROOT: stat /usr/local
File: `/usr/local'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 801h/2049d Inode: 1361676 Links: 11
Access: (2775/drwxrwsr-x) Uid: ( 0/ root) Gid: ( 50/ staff)
Access: 2008-12-07 08:00:25.000000000 -0800
Modify: 2007-05-25 11:24:11.000000000 -0700
Change: 2007-05-25 11:24:11.000000000 -0700
rebecca:/home/terry# ROOT: stat /usr/local/bin
File: `/usr/local/bin'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 801h/2049d Inode: 1361679 Links: 2
Access: (2775/drwxrwsr-x) Uid: ( 0/ root) Gid: ( 50/ staff)
Access: 2008-12-07 08:00:25.000000000 -0800
Modify: 2008-12-02 15:08:47.000000000 -0800
Change: 2008-12-02 15:08:47.000000000 -0800


All times are GMT -5. The time now is 05:11 AM.