• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1703
  • Last Modified:

got error, " cannot execute binary file" when issue passwd command

Dear all,

When i issue the command " passwd username " to change the password in linux (suse) . it pop up the
error message "-bash: /usr/sbin/passwd: cannot execute binary file"

what is the problem ? how to fix it ?

thanks,
0
ikhmer
Asked:
ikhmer
  • 13
  • 7
  • 4
  • +3
2 Solutions
 
sunnycoderCommented:
Hello ikhmer,

What is the output of following command

ls -l /usr/bin/passwd

Regards,
sunnycoder
0
 
omarfaridCommented:
are you user root when trying to run the command? Try as root ans if fails please show perms on the  /usr/bin/passwd file
0
 
TintinCommented:
Please post the results of

ls -l /usr/sbin/passwd

Note this is a different path to /usr/bin/passwd
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
ikhmerAuthor Commented:
Dear all,

Here is the result of ls -l

-rwxrwxrw- 1 root shadow 78208 Jan 20 09:40 /usr/bin/passwd
-rwxrwxrwx 1 root root 78208 Mar 24 16:10 /usr/sbin/passwd

Notice that there is no passwd file in /usr/sbin . but i copy from /usr/bin and i still got the same result !

thanks,
0
 
TintinCommented:
/usr/bin/passwd should have permissions of 4755, where as you have permissions of 0776.

0
 
ikhmerAuthor Commented:
Dear,

do you mean i need to chmod 4755 passwd ? although i do this it still the same !
please see ls -l result

-rwsr-xr-x 1 root shadow 78208 Jan 20 09:40 passwd

thanks,
0
 
omarfaridCommented:
are you root when you run the passwd command?
0
 
ikhmerAuthor Commented:
Yes, root user
0
 
omarfaridCommented:
is the system in multi-user mode? It could be that the root filesystem is mounted read-only. what is the output of

df -k
mount
0
 
ikhmerAuthor Commented:
Please see this :

Tuktuk # df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda5             20972152   2127100  18845052  11% /
udev                   1033688       148   1033540   1% /dev
/dev/sda6             34096872     32872  34064000   1% /home


thanks,
0
 
omarfaridCommented:
what is the output of commands below

mount

who -r
0
 
ikhmerAuthor Commented:
Hi there,

Here is the out put:

Tuktuk:~ # mount
/dev/sda5 on / type reiserfs (rw,acl,user_xattr)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
debugfs on /sys/kernel/debug type debugfs (rw)
udev on /dev type tmpfs (rw)
devpts on /dev/pts type devpts (rw,mode=0620,gid=5)
/dev/sda6 on /home type reiserfs (rw,acl,user_xattr)
securityfs on /sys/kernel/security type securityfs (rw)

Tuktuk:~ #
Tuktuk:~ # who -r
         run-level 3  Jan  8 03:17                   last=S
Tuktuk:~ #
0
 
Hugh FraserConsultantCommented:
The "file" command might identify if the passwd file itself has been corrupted.

file /usr/bin/passwd

should produce something similar to

/usr/bin/passwd: setuid ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped

Also, if you're running selinux, it might be labelled incorrectly.

ls -lZ /usr/bin/passwd

should produce the following output:

-rwsr-xr-x  root root system_u:object_r:passwd_exec_t:s0 /usr/bin/passwd
0
 
ikhmerAuthor Commented:
So, what could i do next ?

Here is the output :

# file /usr/bin/passwd
/usr/bin/passwd: setuid ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.4, stripped

ls -l /usr/bin/passwd
-rwsr-xr-x 1 root shadow 78208 Jan 20 09:40 /usr/bin/passwd
0
 
TintinCommented:
If you type in

/usr/bin/passwd

do you still get the error?
0
 
ikhmerAuthor Commented:
Yes, same result
0
 
TintinCommented:
If your system has strace installed, could you post the output of

strace /usr/bin/passwd
0
 
ikhmerAuthor Commented:
NO i don't have-- what it could help ?

Anyone know what is the exactly problem was?
0
 
woolmilkporcCommented:
>>  # file /usr/bin/passwd
>>  /usr/bin/passwd: setuid ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.4, stripped
Does the above match your machine's architecture? What is the output of 'uname -a' ?
 


0
 
Hugh FraserConsultantCommented:
If the "uname -a" command shows you're not running the 64 bit kernel, then the file command will have shown you've somehow got an incompatible version of the passwd command and need t replace it with the x86 version.

If, however, it shows it's the correct version, could you re-do the "ls -lZ /usr/bin/passwd" command, noting the "Z" option. This will display the selinux labelling, which is the Security-Enhanced Linux additional access rights.
0
 
ikhmerAuthor Commented:
Please see the output :

# uname -a
Tuktuk 2.6.16.21-0.25-smp #1 SMP Tue Sep 19 07:26:15 UTC 2006 i686 i686 i386 GNU/Linux

# ls -lZ /usr/bin/passwd
/bin/ls: invalid option -- Z
Try `/bin/ls --help' for more information.


It does not support Z option .

thanks,
0
 
omarfaridCommented:
is  your system 64 bits?
0
 
woolmilkporcCommented:
Obviously it isn't ->  ... i686 i686 i386 GNU/Linux

Where does the wrong binary come from?

0
 
omarfaridCommented:
did you copy the binary file over from some other system? do you have a backup of your system? if yes then restore this file from backup
0
 
ikhmerAuthor Commented:
someone installed it for a long while ! and it was work fine, but recently it does not work-- i really don't know if someone modify something ...

so, what should be the solution ?
0
 
omarfaridCommented:
do you have a backup of this system?
0
 
woolmilkporcCommented:
Try some other binaries in /usr/bin or /usr/sbin with 'file [name_of_binary]' to see if all, some or only few are wrong.

To examine all of them to find out how many files are affected do
find /usr/bin | xargs -i{} file {} | grep "ELF 64-bit" | wc -l
find /usr/sbin | xargs -i{} file {} | grep "ELF 64-bit" | wc -l


If all (or quite a lot) ot them were wrong, I fear you will have to find out  what happened and probably  restore your system to a valid state.
If it's only  for a few, try to get them from another system with the same architecture and OS.
 
0
 
ikhmerAuthor Commented:
Only one file is , usr/bin/passwd  and usr/sbin/passwd

(note: i copy passwd from /usr/bin into /usr/sbin , because there is no passwd in /usr/sbin before i start diagnose)

thanks,
0
 
woolmilkporcCommented:
So remove /usr/sbin/passwd, as it is not needed, and try to get /usr/bin/passwd either from a backup or from another system with the same architecture and OS.
wmp
 
 
0
 
Hugh FraserConsultantCommented:
You should be able to replace the passwd program using apt-get or yum depending upon the Linux distro you're using. That will ensure you get the correct version.

Failing that, you could simply download the package from a repository and install it by hand.
0
 
ikhmerAuthor Commented:
i don't have backup one -- I try to update "pwdutils" rpm but it does not work.
May be i have to re-install again :-(
0
 
Hugh FraserConsultantCommented:
Re-installing to restore a single package is pretty severe, since you've already verified it's the only one that's not i386. How did you do the update and how did it fail? Correcting this should be quicker than a re-install.

You could also simply copy the file from another system if you have one available.
0
 
ikhmerAuthor Commented:
I accept these answer, since it's most likely correct . but i reinstall it a fresh new, and want to update new version also .

Thanks all
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 13
  • 7
  • 4
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now