I transfered /etc/*
files from one Linux server to another and now I have a strange error. Both are Debian Squeeze.
When I run a command, e.g. ssh
, I get an error:
bash: /usr/bin/ssh: No such file or directory
It looks like the binary exists:
-rwxr-xr-x 1 root root 358756 Sep 21 14:30 /usr/bin/ssh
Bash also autocompletes the command when I type ss
and press Tab. I tried reinstalling, purging etc but it didn't solve anything. There is probably something cached under /etc/
but I don't know what excatly.
ldd /usr/bin/ssh
? It might depend on a library (.so
file) that doesn't exist. – mrb Sep 28 '12 at 14:32file /usr/bin/ssh
tell you? – Mat Sep 28 '12 at 14:38scp -r /etc/* user@remote:/etc/
and the output of the "file" command is/usr/bin/ssh: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
– Lauris Sep 28 '12 at 14:42dpkg --set-selections
&apt-get dselect-upgrade
. – Lauris Sep 28 '12 at 14:45ldd
doesn't... something's screwed up. Tryreadelf -l /usr/bin/ssh
and look for a "Requesting interpreter" line (or error). – Mat Sep 28 '12 at 14:48ldd
actually runs the program. So of course it doesn't work. (BTW:ldd
is a shell script;less \
which ldd`` and you can see how it works) – derobert Sep 28 '12 at 14:51ldd
actually running the program to you, too. Its important that people know this, less they tryldd
when analyzing an untrusted binary. – derobert Sep 28 '12 at 14:53strace -f ldd \
which cat` |& grep execve:
… [pid 8490] execve("/bin/cat", ["cat"], [/* 46 vars */] <unfinished ...>` – derobert Sep 28 '12 at 14:55ldd /usr/bin/vi
orldd /sbin/halt
- this won't run vi orhalt
. The runtime linker gets debug options from the environment, set up from theldd
script, and stops short from actually running the code. – Mat Sep 28 '12 at 14:57execve
is failing. And so its not surprising that ldd does as well (as thatstrace
shows, it actually does anexecve
of the program) – derobert Sep 28 '12 at 15:00ldd
runs the executable, which would makeldd
bloody dangerous. We both agree, I think, thatldd
not managing to list dependencies andfile
saying it is dynamically linked, is a problem, right? – Mat Sep 28 '12 at 15:02/etc
? Weird that it broke ssh, but ls still works. Were the two machines the same architecture (or at least running the same, i.e., both running i386)? – derobert Sep 28 '12 at 15:15_start
/main
as normal when called on a normal dynamically-linked executable, but an executable can be crafted to run arbitrary code on being examined with some versions of ldd. – Random832 Sep 28 '12 at 16:12/usr/bin/ssh
(i.e. full path)? Is the file actually executable? – jw013 Sep 28 '12 at 16:44/etc/ld.so.cache
and checking the contents of/etc/ld.so.conf
and/etc/ld.so.conf.d
. Runldconfig
to rebuild the cache afterwards. – Jim Paris Sep 28 '12 at 17:36