WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Find cause of "not found" error  (Read 3210 times)

Offline viselike

  • Newbie
  • *
  • Posts: 5
Find cause of "not found" error
« on: July 14, 2023, 06:56:07 AM »
I'm trying to run Embarcadero's PAServer (https://docwiki.embarcadero.com/RADStudio/Sydney/en/PAServer,_the_Platform_Assistant_Server_Application) on TinyCore, and it fails with just the message "/bin/sh: ./paserver: not found"

As far as I understand, it fails to find some library, but which one? Is it possible to find this out?

What I've tried already:

  • use strace. It elaborated only that the error happens in the execve call.
  • run "ldd -v" on Ubuntu and install all these packages on TinyCore
  • run the app with sudo

So, is there any way to find out which library it does not find?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14812
Re: Find cause of "not found" error
« Reply #1 on: July 14, 2023, 08:49:51 AM »
Typically that message means it cannot find bash, perl, python or similar.

Offline viselike

  • Newbie
  • *
  • Posts: 5
Re: Find cause of "not found" error
« Reply #2 on: August 07, 2023, 04:07:51 AM »
Python was already present there, adding bash to the image didn't help, and I know no other "complex dependencies" like perl it might need.

For example, on Ubuntu all it needs is:
Code: [Select]
apt-get -yy install \
    build-essential \
    libcurl4-openssl-dev \
    libcurl3-gnutls \
    libgl1-mesa-dev \
    libgtk-3-bin \
    libosmesa-dev \
    libpython3.10 \
    xorg

And on TinyCore I tried to add all following packages:
Code: [Select]
RUN tce-load -wic \
    python3.9

RUN tce-load -wic glibc_base-dev
RUN tce-load -wic glibc_add_lib
RUN tce-load -wic glibc_apps
RUN tce-load -wic glibc_gconv
RUN tce-load -wic glibc_i18n_locale
RUN tce-load -wic libGL
RUN tce-load -wic curl
RUN tce-load -wic curl-dev
RUN tce-load -wic curlg
RUN tce-load -wic curlg-dev
RUN tce-load -wic gtk3
RUN tce-load -wic gtk3-dev
RUN tce-load -wic gtk3-gir
RUN tce-load -wic Xorg-7.7
RUN tce-load -wic zlib_base-dev

RUN tce-load -wic coreutils
RUN tce-load -wic util-linux
RUN tce-load -wic bash

Perhaps there is any tool to not guess, but see for sure, which file it has not found?

Offline polikuo

  • Hero Member
  • *****
  • Posts: 723
Re: Find cause of "not found" error
« Reply #3 on: August 07, 2023, 04:25:48 AM »
Locate your file 'paserver'
Code: [Select]
find /places -name paserverCheck file type
Code: [Select]
file /path/to/paserverIf it's any type of script, check the shebang
Code: [Select]
head -n1 /path/to/paserverUsually you'll see what you're looking for this way.
Like Juanito said, typically bash and stuff.

Offline viselike

  • Newbie
  • *
  • Posts: 5
Re: Find cause of "not found" error
« Reply #4 on: August 07, 2023, 07:22:17 AM »
Locate your file 'paserver'
Code: [Select]
find /places -name paserver

It's a docker image I am creating myself, so both locations where I put the paserver are well known to me - it's a root and tmp folder:
Code: [Select]
/ $ find / -name paserver
/tmp/PAServer-22.0/paserver
/paserver

Quote
Check file type
Code: [Select]
file /path/to/paserver

file fails with the same error:
Code: [Select]
/ $ file /paserver
/bin/sh: file: not found

But it's an ELF executable:
Code: [Select]
/ $ od -t c /paserver | head -n 2
0000000 177   E   L   F 002 001 001  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000020 002  \0   >  \0 001  \0  \0  \0 300 341   ~  \0  \0  \0  \0  \0

Btw, the paserver tool itself is available at https://altd.embarcadero.com/releases/studio/22.0/113/LinuxPAServer22.0.tar.gz

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11618
Re: Find cause of "not found" error
« Reply #5 on: August 07, 2023, 08:28:17 AM »
Hi viselike
... file fails with the same error:
Code: [Select]
/ $ file /paserver
/bin/sh: file: not found
...
No, that error means  file.tcz  is not installed.

Also, see what this returns:
Code: [Select]
ldd Path/To/paserver | grep -i found

Offline viselike

  • Newbie
  • *
  • Posts: 5
Re: Find cause of "not found" error
« Reply #6 on: August 07, 2023, 08:57:05 AM »
Hi Rich

Code: [Select]
/bin/sh: file: not found ...
No, that error means  file.tcz  is not installed.
Indeed, thanks. Here what the file gives:
Code: [Select]
/ $ file /paserver
/paserver: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=725d773692b6f962a395205c93c4c7ba409d6ca1, with debug_info, not stripped

Quote
Also, see what this returns:
Code: [Select]
ldd Path/To/paserver | grep -i found

Nothing if grep for "found":
Code: [Select]
/ $ ldd /paserver | grep -i found
/ $

And here is the full output:
Code: [Select]
/ $ ldd /paserver
        linux-vdso.so.1 (0x00007fff1454a000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fb6f532f000)
        libc.so.6 => /lib/libc.so.6 (0x00007fb6f5173000)
        libdl.so.2 => /lib/libdl.so.2 (0x00007fb6f516e000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00007fb6f5169000)
        libm.so.6 => /lib/libm.so.6 (0x00007fb6f50a9000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007fb6f5094000)
        /lib64/ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x00007fb6f5354000)

Offline polikuo

  • Hero Member
  • *****
  • Posts: 723
Re: Find cause of "not found" error
« Reply #7 on: August 07, 2023, 09:05:45 AM »
Code: [Select]
/ $ file /paserver
/paserver: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=725d773692b6f962a395205c93c4c7ba409d6ca1, with debug_info, not stripped
Code: [Select]
/ $ ldd /paserver
        linux-vdso.so.1 (0x00007fff1454a000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fb6f532f000)
        libc.so.6 => /lib/libc.so.6 (0x00007fb6f5173000)
        libdl.so.2 => /lib/libdl.so.2 (0x00007fb6f516e000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00007fb6f5169000)
        libm.so.6 => /lib/libm.so.6 (0x00007fb6f50a9000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007fb6f5094000)
        /lib64/ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x00007fb6f5354000)

You're using a pre-compiled binary and it's looking for /lib64/ld-linux-x86-64.so.2
A simple fix would be
Code: [Select]
sudo ln -s /lib /lib64
You'll need to backup that softlink if you wanna keep it persistent.
I would modify /opt/bootlocal.sh instead of putting that in /opt/.filetool.lst
It saves space
« Last Edit: August 07, 2023, 09:14:32 AM by polikuo »

Offline viselike

  • Newbie
  • *
  • Posts: 5
Re: Find cause of "not found" error
« Reply #8 on: August 07, 2023, 11:20:49 AM »
You're using a pre-compiled binary and it's looking for /lib64/ld-linux-x86-64.so.2
A simple fix would be
Code: [Select]
sudo ln -s /lib /lib64
This fixed the problem. Thanks, polikuo, and all others!

Quote
You'll need to backup that softlink if you wanna keep it persistent.
It's a Docker image, so I will add a link creation command to the Dockerfile.