问题
I'm installing flexnet on an amazon lightsail instance. I've just extracted the contents to /opt
and in trying to run any lm* command. With ls
I can see I have ownership and permission to execute. I can run file
on any of the contents of the folder and it will tell me what it is.
But when I try to execute anything, bash will complain with No such file or directory. Example:
jabozzo@ICUC_services:/opt/flexnet/bin$ ls -all
total 4684
drwxr-xr-x 2 jabozzo jabozzo 4096 Nov 8 2016 .
drwxr-xr-x 6 jabozzo jabozzo 4096 Dec 19 15:46 ..
lrwxrwxrwx 1 jabozzo jabozzo 6 Dec 14 2016 lmcksum -> lmutil
lrwxrwxrwx 1 jabozzo jabozzo 6 Dec 14 2016 lmdown -> lmutil
-rwxr-xr-x 1 jabozzo jabozzo 1551536 Nov 8 2016 lmgrd
lrwxrwxrwx 1 jabozzo jabozzo 6 Dec 14 2016 lmhostid -> lmutil
lrwxrwxrwx 1 jabozzo jabozzo 6 Dec 14 2016 lmnewlog -> lmutil
lrwxrwxrwx 1 jabozzo jabozzo 6 Dec 14 2016 lmpath -> lmutil
lrwxrwxrwx 1 jabozzo jabozzo 6 Dec 14 2016 lmremove -> lmutil
lrwxrwxrwx 1 jabozzo jabozzo 6 Dec 14 2016 lmreread -> lmutil
lrwxrwxrwx 1 jabozzo jabozzo 6 Dec 14 2016 lmstat -> lmutil
lrwxrwxrwx 1 jabozzo jabozzo 6 Dec 14 2016 lmswitchr -> lmutil
-rwxr-xr-x 1 jabozzo jabozzo 1362736 Nov 8 2016 lmutil
lrwxrwxrwx 1 jabozzo jabozzo 6 Dec 14 2016 lmver -> lmutil
-rwxr-xr-x 1 jabozzo jabozzo 1701200 Nov 8 2016 mgcld
-rwxr-xr-x 1 jabozzo jabozzo 49088 Nov 8 2016 mgls_admin
-rwxr-xr-x 1 jabozzo jabozzo 1593 Nov 8 2016 mgls_child_ver
-rwxr-xr-x 1 jabozzo jabozzo 112736 Nov 8 2016 mgls_ok
jabozzo@ICUC_services:/opt/flexnet/bin$ file lmutil
lmutil: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-lsb-x86-64.so.3, for GNU/Linux 2.6.9, stripped
jabozzo@ICUC_services:/opt/flexnet/bin$ ./lmutil
-bash: ./lmutil: No such file or directory
jabozzo@ICUC_services:/opt/flexnet/bin$ /opt/flexnet/bin/lmutil
-bash: /opt/flexnet/bin/lmutil: No such file or directory
In the example, if I type ./lmu
and tab complete, it is completed as ./lmutils
. Using absolute path doesn't help either. I've also checked for the presence of needed shared libraries:
jabozzo@ICUC_services:/opt/flexnet/bin$ ldd lmutil
linux-vdso.so.1 => (0x00007ffe09bb1000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7e75ab4000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7e757ab000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7e75595000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7e751cb000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7e74fc7000)
/lib64/ld-lsb-x86-64.so.3 => /lib64/ld-linux-x86-64.so.2 (0x00007f7e75cd1000)
回答1:
If you try to run an executable and you get the "no such file or directory" error, this often means that the executable is unable to find the correct dynamic loader. If you look at the output from the file
command, you see:
...interpreter /lib64/ld-lsb-x86-64.so.3...
Does your system have /lib64/ld-lsb-x86-64.so.3
? If not, that suggests that these binaries were built for a different architecture (e.g., 64 bit vs 32 bit) or for a different version of the C library (glibc
).
Solutions include:
Install packages that contain the necessary interpreter.
Find a set of executables that have been compiled for the version of the C library installed on your system.
Run things inside a Docker container or
chroot
environment that has the appropriate C library installed.
A hacky solution would be to use the patchelf command to change the interpreter path embedded in the binaries. Depending on your environment, that might work or it just may make everything crash.
Also, just symlinking from the .so.2
to .so.3
might work.
来源:https://stackoverflow.com/questions/48175694/no-such-file-or-directory-cannot-execute-but-is-visible-to-ls-file-and-tab-com