Ubuntu – During a chroot attempt, I got this error: “chroot: failed to run command ‘/bin/bash’: Exec format error”


I was following the instructions of this tutorial HOWTO: Purge and Reinstall Grub 2 from the Live CD, when I encountered an error at step 1, as I launched the command

sudo chroot /mnt/temp

The error was the following:

chroot: failed to run command `/bin/bash': Exec format error

Where does that come from? How do I get through?

Best Answer

Verify that you are using the right Live CD. For example, verify you are not using a 32bit CD instead of a 64bit CD. You need a 64bit kernel to run 64bit code, so check your architecture.

Assuming you mounted your system to be chrooted in /media/sda1, to determine the architecture you can:

ls /media/sda1/*

if you see lib64 in the output, it's probably a 64bit system

Related Question