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 (.sofile) that doesn't exist. – mrb Sep 28 '12 at 14:32file /usr/bin/sshtell 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:45ldddoesn't... something's screwed up. Tryreadelf -l /usr/bin/sshand look for a "Requesting interpreter" line (or error). – Mat Sep 28 '12 at 14:48lddactually runs the program. So of course it doesn't work. (BTW:lddis a shell script;less \which ldd`` and you can see how it works) – derobert Sep 28 '12 at 14:51lddactually running the program to you, too. Its important that people know this, less they trylddwhen 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/viorldd /sbin/halt- this won't run vi orhalt. The runtime linker gets debug options from the environment, set up from thelddscript, and stops short from actually running the code. – Mat Sep 28 '12 at 14:57execveis failing. And so its not surprising that ldd does as well (as thatstraceshows, it actually does anexecveof the program) – derobert Sep 28 '12 at 15:00lddruns the executable, which would makelddbloody dangerous. We both agree, I think, thatlddnot managing to list dependencies andfilesaying 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/mainas 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.cacheand checking the contents of/etc/ld.so.confand/etc/ld.so.conf.d. Runldconfigto rebuild the cache afterwards. – Jim Paris Sep 28 '12 at 17:36