2

So, basically I was messing up with minix and qemu and I messed up too much.

me@meplepl ~ $ which
bash: /usr/bin/which: cannot execute binary file: Exec format error


me@meplepl ~ $ file  /bin/which
/bin/which: Minix-386 executable

I have the same problem with awk and somehow ssh. It turns out I somehow replaced my binaries with those from minix? Is there easy fix or I have to go back to my previous backup?

1
  • 2
    So you replaced some Linux executables with Minix ones? Reinstall them. What distribution?
    – schaiba
    Commented Dec 3, 2015 at 19:31

1 Answer 1

6

If your package manager is in a working state, you can force reinstallation of the packages containing the binaries you overwrote. Depending on your distro:

  • apt-get --reinstall install *package-name*

  • rpm -iv --replacepkgs *package-name*

  • yum reinstall *package-name*

  • emerge *package-name*

  • pacman -S *package-name*

If that doesn't work, you say you have backups so I would just restore /bin and /usr/bin from the backup.


A helpful way to avoid doing this in the future is the age old advice "don't use the root account when you don't need to". Once qemu is installed you can run it as your user. The benefit is that your user cannot overwrite /usr/bin on the host, so you can't mess up your system.

1
  • Thank you. This method with package manager didn't work, however replacing only /usr/bin and /bin with previous backup worked. I can only say that useful command is: dpkg -S path to binary. It gives you package name of the program. Thanks for the solution!
    – carpenter
    Commented Dec 3, 2015 at 19:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .