Knowledge Base:Chrooting returns exec format error

From Gentoo Wiki
Jump to: navigation, search

Synopsis

During the installation of Gentoo Linux, attempting to chroot into the new environment breaks with the following error:

root #chroot /mnt/gentoo /bin/bash
chroot: failed to run command `/bin/bash': Exec format error

Environment

This article applies to Gentoo Linux installations on an x86_64 platform (amd64 architecture).

Analysis

The error Exec format error means that the binary being executed is made for a different architecture than the environment currently booted. It usually occurs when the system has been booted on a 32-bit system when a 64-bit environment is trying to load.

Resolution

Reboot the live environment and choose the correct architecture (most LiveCDs support a 64-bit kernel as well as a 32-bit option, although it is not booted by default). Look for entries labeled gentoo64 or linux64 if trying to boot a 64-bit system.

See also

  • Chroot — a Unix system utility used to change the apparent root directory to create a new environment logically separate from the main system's root directory.