LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cannot execute binary file (https://www.linuxquestions.org/questions/linux-newbie-8/cannot-execute-binary-file-761347/)

tamilselvan.forum 10-12-2009 07:08 AM

cannot execute binary file
 
Hi,

I am getting the error message "-bash: /bin/hostname: cannot execute binary file" while login to my server through SSH. Can anyone please help me to resolve this problem? I searched on the web, but not found useful solution.

Also, i could not use the command like,
1. cat /var/log/messages --- its working
2. cat /var/log/messages --- it gives the error message bash: /bin/more: cannot execute binary file


Thanks.
Tamilselvan.

tamilselvan.forum 10-12-2009 07:18 AM

Hi,

I am getting the error message "-bash: /bin/hostname: cannot execute binary file" while login to my server through SSH. Can anyone please help me to resolve this problem? I searched on the web, but not found useful solution.

Also, i could not use the command like,
1. cat /var/log/messages --- its working
2. cat /var/log/messages --- it gives the error message bash: /bin/more: cannot execute binary file

vinaytp 10-12-2009 07:23 AM

Hello tamilselvan.forum,

Quote:

Originally Posted by tamilselvan.forum (Post 3716332)
1. cat /var/log/messages --- its working
2. cat /var/log/messages --- it gives the error message bash: /bin/more: cannot execute binary file

Here both the commands are same...when you will get 1st output and when you will get the second one..?

Please explain in detail what you have done till now to get this message...

chrism01 10-12-2009 06:44 PM

Tell us which distro and version you've got.

smeezekitty 10-12-2009 08:40 PM

that does not make sense

chrism01 10-12-2009 08:52 PM

It sounds to me like he's lost the +x perms on various binaries; I'd like to see

ls -l more
ls -l hostname

As I asked above, it's going to be easier to suggest a fix if we know what distro he's got.
eg for Redhat systems (assuming std binaries installed via yum) http://www.cyberciti.biz/tips/reset-...ermission.html

tamilselvan.forum 10-13-2009 05:45 AM

Sorry, I missed the "more" in my second point. When i run the command cat /var/log/messages|more - it gives the error message as bash: /bin/more: cannot execute binary file.

I am using the RedHat Linux Enterprise Server. The "uname -a" is showing the output:
Linux (none) 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:15 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux

Also, how can we know which binary is installed in the server?

Thanks
Tamilselvan.

tamilselvan.forum 10-13-2009 06:12 AM

I tried to list out the installed rpm packages, it shows the error message
rpm -qa
bash: /bin/rpm: cannot execute binary file

What would be the problem?
Thanks for helping me.

lutusp 10-13-2009 11:58 AM

Quote:

Originally Posted by tamilselvan.forum (Post 3717491)
I tried to list out the installed rpm packages, it shows the error message
rpm -qa
bash: /bin/rpm: cannot execute binary file

What would be the problem?
Thanks for helping me.

The problem is that you are trying to execute a binary executable file that is not meant for the computer at which you are sitting. I won't venture a guess as to how this could happen.

Somehow, your system contains binaries that are not intended for the computer (or the OS) they are installed on.

chrism01 10-13-2009 06:50 PM

Can we have

cat /etc/redhat-release

ls -l more
ls -l hostname

file more
file hostname

and have you tried that reset link I gave you? What were the results/msgs?

cola 10-13-2009 07:39 PM

Quote:

Originally Posted by tamilselvan.forum (Post 3716325)
Hi,

I am getting the error message "-bash: /bin/hostname: cannot execute binary file" while login to my server through SSH. Can anyone please help me to resolve this problem? I searched on the web, but not found useful solution.

Also, i could not use the command like,
1. cat /var/log/messages --- its working
2. cat /var/log/messages --- it gives the error message bash: /bin/more: cannot execute binary file


Thanks.
Tamilselvan.

You have run ssh from ??
Which distribution was that?

tamilselvan.forum 10-14-2009 05:04 AM

Quote:

Originally Posted by chrism01 (Post 3718202)
Can we have

cat /etc/redhat-release

ls -l more
ls -l hostname

file more
file hostname

and have you tried that reset link I gave you? What were the results/msgs?

I tried that link to reset the permission. But not worked. Used the command
#rpm --setperms /bin/more
The result was bash: /bin/rpm: cannot execute binary file

I am connecting to our server thru SSH and working on it.

The result for cat /etc/redhat-release is
Red Hat Enterprise Linux Server release 5.2 (Tikanga)

ls -l more is
-rwxr-xr-x 1 root root 44072 Jan 11 2009 more

ls -l hostname is
-rwxr-xr-x 1 root root 24200 Jan 11 2009 hostname


file more is
more: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), corrupted program header size, corrupted section header size

file hostname is

hostname: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), corrupted program header size, corrupted section header size

But the command file cat is
cat: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped

It seems some of the bin directory files are corrupted.
What can we do for this?

Thanks chrism01, we are in the right way to solve the problem

chrism01 10-14-2009 07:15 PM

Ok, you need to use this page to figure out which pkgs need a re-install http://kbase.redhat.com/faq/docs/DOC-2531 and then do a '--force' re-install.
I suspect it's prob coreutils or somesuch.

Actually, if 'file rpm' shows corruption, it could get tricky.
Try the above advice anyway. If it fails, I think you may be looking at backing up any user data/cfgs & re-install Os.

Alternately, if you have another system with same version of RHEL (or you can install a pc temporarily), you could just replace the corrupted binaries by copyng over from a clean install.
Basically, cd into the relevant dir(s) and run

file * |grep corrupt >corrupted_files.lst

to get the list(s).


All times are GMT -5. The time now is 05:22 AM.