Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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

share|improve this answer
It is but still cannot chroot – Starx Mar 29 '12 at 10:03

The error means that your jail (/mnt/temp) does not contain a bash shell, or does not contain the libraries required to run the bash shell.

If you created your jail using something like this:

debootstrap --variant=buildd --arch i386 lucid /mnt/temp \

You probably meant to do this instead:

debootstrap --variant=minbase --arch i386 lucid /mnt/temp \

However, as a technical answer to your problem, try:

cp -r /bin /lib /mnt/temp

This should allow you to chroot successfully, at which point you can do other things.

There are about a million things wrong with doing that though, and almost certainly you do not want to do that. Use minbase when you create your jail, or install ubuntu on a blank target (eg. a virtual machine) and create a tar archive of the entire system which you then decompress into /mnt/temp.

share|improve this answer

Indeed this is a 64-bit 32-bit incompatibility.

Although with

cp /bin/bash /mount/temp/tmp

(copies 32-bit exec to the new root in the tmp directory

chroot /mount/temp /tmp/bash

chroot is fine, all commands still fail. You would have to copy them all over.

share|improve this answer

In my case, I was trying to chroot into a 64-bit version of Linux but my current Linux was 32-bit.

I had mounted a disk image (master image, for replication on multiple machines).

Hope this helps somebody, it took me an hour before I realized my mistake.

share|improve this answer

I think in is a BUG.


but not


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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