Apply_binaries.sh exec format error

Hello, I’m trying to make the TX2 kernel (version 32.5.0) inside a Docker image. When I run sudo ./apply_binaries.sh I encounter the following error:

Using rootfs directory of: /home/user/my_kernel/Linux_for_Tegra/rootfs
Installing extlinux.conf into /boot/extlinux in target rootfs
/home/user/my_kernel/Linux_for_Tegra/nv_tegra/nv-apply-debs.sh
Root file system directory is /home/user/my_kernel/Linux_for_Tegra/rootfs
Copying public debian packages to rootfs
Start L4T BSP package installation
QEMU binary is not available, looking for QEMU from host system
Found /usr/bin/qemu-aarch64-static
Installing QEMU binary in rootfs
/home/user/my_kernel/Linux_for_Tegra/rootfs /home/user/my_kernel/Linux_for_Tegra
Installing BSP Debian packages in /home/user/my_kernel/Linux_for_Tegra/rootfs
chroot: failed to run command 'dpkg': Exec format error

Digging deeper, it appears that the error occurs on the first chroot call in this excerpt of nv-apply-debs.sh:

echo "Installing QEMU binary in rootfs"
install --owner=root --group=root "${QEMU_BIN}" "${L4T_ROOTFS_DIR}/usr/bin/"

mknod -m 444 "${L4T_ROOTFS_DIR}/dev/random" c 1 8
mknod -m 444 "${L4T_ROOTFS_DIR}/dev/urandom" c 1 9

pushd "${L4T_ROOTFS_DIR}"
touch "${L4T_ROOTFS_DEB_DIR}/.nv-l4t-disable-boot-fw-update-in-preinstall"
echo "Installing BSP Debian packages in ${L4T_ROOTFS_DIR}"
if [ "${#pre_deb_list[@]}" -ne 0 ]; then
	LC_ALL=C PYTHONHASHSEED=0 chroot . dpkg -i --path-include="/usr/share/doc/*" "${pre_deb_list[@]}"
fi
LC_ALL=C PYTHONHASHSEED=0 chroot . dpkg -i --path-include="/usr/share/doc/*" "${deb_list[@]}"
rm -f "${L4T_ROOTFS_DEB_DIR}/.nv-l4t-disable-boot-fw-update-in-preinstall"
popd

This workflow succeeds for kernel version 32.2.1. Any ideas what could be causing this error with the updated kernel?

Hi,

Would you mind sharing more details with us?

Are you running the container on a desktop machine and want to use an l4t docker with the QEMU simulator?
Or just want to compile a kernel on a host but within the container?

Thanks.

In general, exec format error means you are running the program on the wrong architecture. The program is intended to be run on a regular desktop PC running Ubuntu, and not on the Jetson (the PC has flash software, and apply_binaries.sh is part of flash setup).

I’m trying to compile the kernel inside a container. The container is running on a Lenovo ThinkPad running Ubuntu.

The wrong dpkg architecture is being used. Either an x86_64/amd64 is attempting to run on arm64/aarch64, or the reverse of that. Keep in mind that you have a container with one architecture, and apparently this is running QEMU, which is the other architecture. One of them is using the dpkg from the other. Perhaps QEMU is trying to use the PC architecture dpkg, or perhaps despite having QEMU the dpkg command was not running in QEMU (or perhaps QEMU itself is the wrong one).

Thanks for the help everyone. Re-creating the docker container seemed to fix the issue.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.