LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-12-2009, 08:08 AM   #1
tamilselvan.forum
LQ Newbie
 
Registered: Oct 2009
Posts: 7

Rep: Reputation: 0
Question 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.
 
Old 10-12-2009, 08:18 AM   #2
tamilselvan.forum
LQ Newbie
 
Registered: Oct 2009
Posts: 7

Original Poster
Rep: Reputation: 0
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
 
Old 10-12-2009, 08:23 AM   #3
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Rep: Reputation: 55
Hello tamilselvan.forum,

Quote:
Originally Posted by tamilselvan.forum View Post
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...
 
Old 10-12-2009, 07:44 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Tell us which distro and version you've got.
 
Old 10-12-2009, 09:40 PM   #5
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,330

Rep: Reputation: 227Reputation: 227Reputation: 227
that does not make sense
 
Old 10-12-2009, 09:52 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
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
 
Old 10-13-2009, 06:45 AM   #7
tamilselvan.forum
LQ Newbie
 
Registered: Oct 2009
Posts: 7

Original Poster
Rep: Reputation: 0
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.
 
Old 10-13-2009, 07:12 AM   #8
tamilselvan.forum
LQ Newbie
 
Registered: Oct 2009
Posts: 7

Original Poster
Rep: Reputation: 0
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.
 
Old 10-13-2009, 12:58 PM   #9
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by tamilselvan.forum View Post
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.
 
Old 10-13-2009, 07:50 PM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
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?
 
Old 10-13-2009, 08:39 PM   #11
cola
Senior Member
 
Registered: Sep 2007
Location: Dhaka,Bangladesh
Distribution: Debian
Posts: 1,031

Rep: Reputation: 63
Quote:
Originally Posted by tamilselvan.forum View Post
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?

Last edited by cola; 10-13-2009 at 08:41 PM.
 
Old 10-14-2009, 06:04 AM   #12
tamilselvan.forum
LQ Newbie
 
Registered: Oct 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by chrism01 View Post
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
 
Old 10-14-2009, 08:15 PM   #13
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
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).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot execute binary file loss Linux - Newbie 28 06-12-2009 10:32 AM
cannot execute binary file kenpeter Linux - Newbie 2 01-16-2008 08:01 PM
Can't execute a binary file inverted.gravity Linux - General 4 08-07-2006 11:08 PM
cannot execute binary file babaliciouse Linux - Software 2 10-21-2004 12:50 PM
cannot execute binary file.... ttaylor Linux - General 4 10-02-2001 02:37 AM


All times are GMT -5. The time now is 09:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration