Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I login using SSH, all I can see is this...

-bash: /usr/bin/id: cannot execute binary file
-bash: [: : integer expression expected

I couldn't do anything in here. Commands such as halt, poweroff, reboot will return command not found.

How can I fix this? I am using Debian Squeeze Linux

share|improve this question
2  
What did you do to that machine? –  slhck Jun 12 '12 at 21:32
1  
the very last thing I did was install logwatch. Nothing else. –  superuser Jun 12 '12 at 21:33
3  
PATH is an environment variable which contains a list of folders which the shell searches for programs. ls for example, usually refers to /bin/ls, and your shell finds it by going through the folders listed in PATH one-by-one until it finds it, or if it doesn't find it in any of them, it gives up. I suppose a better starting point would be, what is the output of echo $PATH ? (edit: the export command is a way to define an environment variable in bash.) –  Darth Android Jun 12 '12 at 21:41
1  
Ah... I warned you not to shut the system down :P Can you get console access to it (physical monitor+keyboard attached)? Try booting the system in single-user mode (might be labelled as recovery mode) and see if you can get to a root shell. –  Darth Android Jun 12 '12 at 21:51
2  
@David you won't see any output after typing export PATH=/bin:/user/bin:/sbin:/usr/sbin. It's a silent command. –  Ben Richards Jun 12 '12 at 21:57

4 Answers 4

up vote 13 down vote accepted

Usually that error message means Linux doesn't recognize the file as a shell script or as an executable file.

Typically the cause is running an executable on the wrong architecture - if you try to run x86 executables on an ARM CPU, this message comes up.

Did /usr/bin/id get overwritten, possibly?

share|improve this answer
2  
"if you try to run x86 executables on an ARM CPU, this message comes up." That was EXACTLY what caused it. Thanks everyone for your inputs! –  superuser Jun 13 '12 at 4:18
    
Wow I lost so much time, before I found your answer! For something that stupid haha! Hope this can help some other people too, here's a vote –  Hugo Dozois Apr 6 '13 at 0:57

I'm making some wild guesses here, but it looks like the following is happening:

  1. You log in over SSH, triggering bash to run your ~/.profile or ~/.bashrc to set up your environment for you (this is normal).
  2. At some point it tries to execute /bin/id to get your uid, which fails, causing integer expression error, and terminating the script before it can set up your $PATH.
  3. Because your $PATH is not set, bash is only able to run commands with the full path specified.

Use export PATH=/bin:/usr/bin:/sbin:/usr/sbin to fix the $PATH issue until you can fix the root cause of /bin/id failing.

share|improve this answer

Try to run it using ./executablefilename instead of using sh executablefilename. It's not a shell script after all.

share|improve this answer

binary file consists of machine instructions the processor can understand. Your operating system does not mean the same executable will run. move back and forth between the processor instruction set compatible with will usually work well, if they are not compatible CPU will not be able to understand instructions.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.