EmbeddedRelated.com
Forums
The 2026 Embedded Online Conference

OT, Linux: bash can't see a file that's there, really!

Started by Tim Wescott June 4, 2015
Sorry for the OT post, but I figure I'll get a quicker, more useful 
response here.

Brand new computer, Xubuntu 14.04 instead of Lubuntu 12.04

I just copied over my Codesourcery directory to /usr/share/arm-none-eabi 
(where it was on the old machine, and where everything worked fine).

Bash insists it's not there, even though I can see it in a directory:

Here's ls:

$ ls -l /usr/share/arm-none-eabi/bin/*gcc
-rwxr-xr-x 1 root root 270608 Aug  6  2014 /usr/share/arm-none-eabi/bin/
arm-none-eabi-gcc

Here's when I try to run it:

$ /usr/share/arm-none-eabi/bin/arm-none-eabi-gcc
bash: /usr/share/arm-none-eabi/bin/arm-none-eabi-gcc: No such file or 
directory

Clues for the clueless?

Thanks.

-- 

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
On 6/4/2015 11:41 AM, Tim Wescott wrote:
> Sorry for the OT post, but I figure I'll get a quicker, more useful > response here. > > Brand new computer, Xubuntu 14.04 instead of Lubuntu 12.04 > > I just copied over my Codesourcery directory to /usr/share/arm-none-eabi > (where it was on the old machine, and where everything worked fine). > > Bash insists it's not there, even though I can see it in a directory: > > Here's ls: > > $ ls -l /usr/share/arm-none-eabi/bin/*gcc > -rwxr-xr-x 1 root root 270608 Aug 6 2014 /usr/share/arm-none-eabi/bin/ > arm-none-eabi-gcc > > Here's when I try to run it: > > $ /usr/share/arm-none-eabi/bin/arm-none-eabi-gcc > bash: /usr/share/arm-none-eabi/bin/arm-none-eabi-gcc: No such file or > directory > > Clues for the clueless?
Non-printing character in filename? In FreeBSD, "ls -B" (or "ls -b" for C-esque renderings) is your friend.
On Thu, 04 Jun 2015 11:46:57 -0700, Don Y wrote:

> On 6/4/2015 11:41 AM, Tim Wescott wrote: >> Sorry for the OT post, but I figure I'll get a quicker, more useful >> response here. >> >> Brand new computer, Xubuntu 14.04 instead of Lubuntu 12.04 >> >> I just copied over my Codesourcery directory to >> /usr/share/arm-none-eabi (where it was on the old machine, and where >> everything worked fine). >> >> Bash insists it's not there, even though I can see it in a directory: >> >> Here's ls: >> >> $ ls -l /usr/share/arm-none-eabi/bin/*gcc -rwxr-xr-x 1 root root 270608 >> Aug 6 2014 /usr/share/arm-none-eabi/bin/ >> arm-none-eabi-gcc >> >> Here's when I try to run it: >> >> $ /usr/share/arm-none-eabi/bin/arm-none-eabi-gcc bash: >> /usr/share/arm-none-eabi/bin/arm-none-eabi-gcc: No such file or >> directory >> >> Clues for the clueless? > > Non-printing character in filename? In FreeBSD, "ls -B" (or "ls -b" for > C-esque renderings) is your friend.
ls -B /usr/share/arm-none-eabi/bin/*gcc /usr/share/arm-none-eabi/bin/arm-none-eabi-gcc -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Tim Wescott <seemywebsite@myfooter.really> wrote:
> $ /usr/share/arm-none-eabi/bin/arm-none-eabi-gcc > bash: /usr/share/arm-none-eabi/bin/arm-none-eabi-gcc: No such file or > directory
Wrong ELF ABI tag? Missing ELF ABI-tag note section? Had this on many BSD's recently. Linking an executable without a note section identifying the ABI results in a non-executable executable. In this case, it would probably be easiest to get a newer binary version. Or use elfdump or a similar tool to find out in which way the binary differs from the system binaries. You could then try to tweak the binary with an interactive ELF editor. -- Nils M Holm < n m h @ t 3 x . o r g > www.t3x.org
On 6/4/2015 11:49 AM, Tim Wescott wrote:
> On Thu, 04 Jun 2015 11:46:57 -0700, Don Y wrote: > >> On 6/4/2015 11:41 AM, Tim Wescott wrote: >>> Sorry for the OT post, but I figure I'll get a quicker, more useful >>> response here. >>> >>> Brand new computer, Xubuntu 14.04 instead of Lubuntu 12.04 >>> >>> I just copied over my Codesourcery directory to >>> /usr/share/arm-none-eabi (where it was on the old machine, and where >>> everything worked fine). >>> >>> Bash insists it's not there, even though I can see it in a directory: >>> >>> Here's ls: >>> >>> $ ls -l /usr/share/arm-none-eabi/bin/*gcc -rwxr-xr-x 1 root root 270608 >>> Aug 6 2014 /usr/share/arm-none-eabi/bin/ >>> arm-none-eabi-gcc >>> >>> Here's when I try to run it: >>> >>> $ /usr/share/arm-none-eabi/bin/arm-none-eabi-gcc bash: >>> /usr/share/arm-none-eabi/bin/arm-none-eabi-gcc: No such file or >>> directory >>> >>> Clues for the clueless? >> >> Non-printing character in filename? In FreeBSD, "ls -B" (or "ls -b" for >> C-esque renderings) is your friend. > > ls -B /usr/share/arm-none-eabi/bin/*gcc > /usr/share/arm-none-eabi/bin/arm-none-eabi-gcc
Do, presumably, you can rm(1), mv(1), etc. successfully. What does file(1) claim? And, nm(1)?
Tim Wescott <seemywebsite@myfooter.really> writes:
> Clues for the clueless?
Try "type /usr/share/arm-none-eabi/bin/*gcc" and "ldd /usr/share/arm-none-eabi/bin/*gcc" - it might be that the older binaries were built against older libraries and/or dynamic linkers, so yu may need to install a compatibility package to run them as-is. Just because you copied the *gcc file, doesn't mean Linux has all the support files (/lib/ld.so.1, /lib/libc.so.*, etc) and the error message might be from one of those.
On Thu, 04 Jun 2015 15:36:34 -0400, DJ Delorie wrote:

> Tim Wescott <seemywebsite@myfooter.really> writes: >> Clues for the clueless? > > Try "type /usr/share/arm-none-eabi/bin/*gcc" and "ldd > /usr/share/arm-none-eabi/bin/*gcc" - it might be that the older binaries > were built against older libraries and/or dynamic linkers, so yu may > need to install a compatibility package to run them as-is. > > Just because you copied the *gcc file, doesn't mean Linux has all the > support files (/lib/ld.so.1, /lib/libc.so.*, etc) and the error message > might be from one of those.
The error message was that bash didn't see the file itself, not that it couldn't find the library. But -- maybe. Particularly since it's a 64-bit linux, and the old one was 32. -- www.wescottdesign.com
On Thu, 04 Jun 2015 15:36:34 -0400, DJ Delorie wrote:

> Tim Wescott <seemywebsite@myfooter.really> writes: >> Clues for the clueless? > > Try "type /usr/share/arm-none-eabi/bin/*gcc" and "ldd > /usr/share/arm-none-eabi/bin/*gcc" - it might be that the older binaries > were built against older libraries and/or dynamic linkers, so yu may > need to install a compatibility package to run them as-is. > > Just because you copied the *gcc file, doesn't mean Linux has all the > support files (/lib/ld.so.1, /lib/libc.so.*, etc) and the error message > might be from one of those.
+1 on ldd. I've had this happen before. ldd will show you what is missing. -- Chisolm Republic of Texas
Tim Wescott <tim@seemywebsite.com> writes:
> The error message was that bash didn't see the file itself, not that it > couldn't find the library.
The error message says that, but sometimes it lies. When Linux runs an ELF binary, that binary usually needs a "dynamic loader" to run *also*, which resolves all the shared library stuff. Much like a script needs its interpreter, ELF binaries need their loader. If the loader doesn't exist, the kernel might return "not found" when you try to run that binary. bash: "Please run this", kernel: "I couldn't find one of the files I need to do so". Strange but true. $ readelf -l /usr/bin/gcc . . . INTERP 0x00000000000002a8 0x00000000004002a8 0x00000000004002a8 0x000000000000001c 0x000000000000001c R 1 [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] . . .
On Thu, 04 Jun 2015 14:52:50 -0500, Tim Wescott wrote:

> On Thu, 04 Jun 2015 15:36:34 -0400, DJ Delorie wrote: > >> Tim Wescott <seemywebsite@myfooter.really> writes: >>> Clues for the clueless? >> >> Try "type /usr/share/arm-none-eabi/bin/*gcc" and "ldd >> /usr/share/arm-none-eabi/bin/*gcc" - it might be that the older >> binaries were built against older libraries and/or dynamic linkers, so >> yu may need to install a compatibility package to run them as-is. >> >> Just because you copied the *gcc file, doesn't mean Linux has all the >> support files (/lib/ld.so.1, /lib/libc.so.*, etc) and the error message >> might be from one of those. > > The error message was that bash didn't see the file itself, not that it > couldn't find the library. > > But -- maybe. Particularly since it's a 64-bit linux, and the old one > was 32.
From the man page for execve(2) ENOENT The file filename or a script or ELF interpreter does not exist, or a shared library needed for file or interpreter cannot be found. This error is going to percolate up to bash so you get the "No such file or directory" because, most likely, a shared library is not found. ldd will tell you what is missing. -- Chisolm Republic of Texas
The 2026 Embedded Online Conference