[Solved] “No such file or directory” even though file exists

When trying to execute a file on Linux, you can get this error, even though the file does exist and is executable.

./start-server.sh: line 1: /root/ProNA/jk2ded: No such file or directory

This error occurs because there is a library dependency that the file isn’t able to load. To find out which one, you can type:

ldd filename.sh

root@1875-5348-4560:~# ldd jk2ded
linux-gate.so.1 => (0xb7788000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb777d000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7751000)
libcxa.so.1 => not found
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb75a6000)
/lib/ld-linux.so.2 (0xb7789000)

As you can see, this file relies on several libraries, and is not able to find the libcxa.so.1 library. Once that’s installed, it should run properly.

If you’re trying to run a 32-bit program on a 64-bit OS, the following package is a catch-all that should fix any missing dependencies:

sudo apt-get install ia32-libs