Solved

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

Posted on 2009-03-28
33
1,452 Views
Last Modified: 2013-12-16
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
Comment
Question by:ikhmer
  • 13
  • 7
  • 4
  • +3
33 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 24011528
Hello ikhmer,

What is the output of following command

ls -l /usr/bin/passwd

Regards,
sunnycoder
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24011580
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
 
LVL 48

Expert Comment

by:Tintin
ID: 24011623
Please post the results of

ls -l /usr/sbin/passwd

Note this is a different path to /usr/bin/passwd
0
 

Author Comment

by:ikhmer
ID: 24011731
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
 
LVL 48

Expert Comment

by:Tintin
ID: 24011744
/usr/bin/passwd should have permissions of 4755, where as you have permissions of 0776.

0
 

Author Comment

by:ikhmer
ID: 24011752
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
 
LVL 40

Expert Comment

by:omarfarid
ID: 24011760
are you root when you run the passwd command?
0
 

Author Comment

by:ikhmer
ID: 24011771
Yes, root user
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24011776
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
 

Author Comment

by:ikhmer
ID: 24012592
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
 
LVL 40

Expert Comment

by:omarfarid
ID: 24015962
what is the output of commands below

mount

who -r
0
 

Author Comment

by:ikhmer
ID: 24016694
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
 
LVL 12

Expert Comment

by:hfraser
ID: 24018220
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
 

Author Comment

by:ikhmer
ID: 24025914
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
 
LVL 48

Expert Comment

by:Tintin
ID: 24026015
If you type in

/usr/bin/passwd

do you still get the error?
0
 

Author Comment

by:ikhmer
ID: 24026959
Yes, same result
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 48

Expert Comment

by:Tintin
ID: 24027021
If your system has strace installed, could you post the output of

strace /usr/bin/passwd
0
 

Author Comment

by:ikhmer
ID: 24027165
NO i don't have-- what it could help ?

Anyone know what is the exactly problem was?
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24027242
>>  # 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
 
LVL 12

Expert Comment

by:hfraser
ID: 24027325
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
 

Author Comment

by:ikhmer
ID: 24027475
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
 
LVL 40

Expert Comment

by:omarfarid
ID: 24027725
is  your system 64 bits?
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24027779
Obviously it isn't ->  ... i686 i686 i386 GNU/Linux

Where does the wrong binary come from?

0
 
LVL 40

Expert Comment

by:omarfarid
ID: 24027814
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
 

Author Comment

by:ikhmer
ID: 24027907
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
 
LVL 40

Expert Comment

by:omarfarid
ID: 24027949
do you have a backup of this system?
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24028012
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
 

Author Comment

by:ikhmer
ID: 24028618
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
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 250 total points
ID: 24028693
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
 
LVL 12

Assisted Solution

by:hfraser
hfraser earned 250 total points
ID: 24034823
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
 

Author Comment

by:ikhmer
ID: 24125317
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
 
LVL 12

Expert Comment

by:hfraser
ID: 24125670
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
 

Author Comment

by:ikhmer
ID: 24292643
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now