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?

Braiam
  • 35,991
carpenter
  • 1,221

1 Answers1

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.

casey
  • 14,754
  • 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 Dec 03 '15 at 19:59