I've just upgraded one of my Gentoo systems from 32-bit to 64-bit. Now, I need to find any residual 32-bit binaries (mostly user-installed) so I can either re-compile them as 64-bit or install the 32-bit libraries they need. How do I do that?

A minor complication: this system is a fileserver and provides netboot services for ARM and 32-bit x86 systems, so there are both non-native binaries and binaries that are expected to be 32-bit, and I need to exclude the places where those are found from the search.

  • Do you want to search through all files or just files in some directories (like ones in your PATH) ? Have you tried the "file" command? it would tell you things like: ELF 64-bit or ELF 32-bit as well as machine type. If you use a wild card, you might use something like: "file -- *|grep 32-bit"...? – Astara Sep 3 '17 at 21:04
  • All files except the ones where 32-bit binaries are expected (ie. everything except a few specific subtrees). The upgrade process took care of pretty much everything in PATH. – Mark Sep 3 '17 at 21:40

You can do

find / -type f -executable -exec file {} \; | grep 32-bit

to find all the 32-bit executables on your system. (You might not want to start at /)

Then just use sed to filter out the directories where you are expecting 32-bit binaries

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.