Problems creating custom file system

when trying to create a custom file system inside the docker container as suggested in the docs I’m getting an error running the nvidia script

root@6938c494d85f:/l4t/tools/samplefs# sudo ./nv_build_samplefs.sh --abi aarch64 --distro ubuntu --flavor desktop --version focal
********************************************
     Create ubuntu sample filesystem     
********************************************
nv_build_samplefs.sh - download_samplefs
nv_build_samplefs.sh - extract_samplefs
nv_build_samplefs.sh - create_samplefs
chroot: failed to run command 'apt-get': Exec format error
nv_build_samplefs.sh - cleanup
root@6938c494d85f:/l4t/tools/samplefs# exit
exit

Any ideas on what I might be doing wrong? Any help appreciated.

Hi,
It looks like apt-get is not present in the docker. Please add it for a try. Or try the command outside docker.

Hum, that’s curious because I run the previous commands just fine. I can’t run outside docker because I’m not on a ubuntu20.04 machine

$ sudo docker run --privileged -it --rm -v /Linux_for_Tegra:/l4t ubuntu:20.04

(inside of container) $ apt-get update
(inside of container) $ apt-get install -y qemu-user-static wget sudo
(inside of container) $ cd /l4t/tools/samplefs

its after this when running the script that the problem occurs

it seems that is failing to do the last line, this is from the nvidia script to create a new file system

function create_samplefs()
{
	echo "${script_name} - create_samplefs"

	if [ ! -e "${tmpdir}" ]; then
		echo "ERROR: Temporary directory not found" > /dev/srderr
		exit 1
	fi

	pushd "${tmpdir}" > /dev/null 2>&1
	cp "${host_qemu_path}" "${target_qemu_path}"
	chmod 755 "${target_qemu_path}"

	mount /sys ./sys -o bind
	mount /proc ./proc -o bind
	mount /dev ./dev -o bind
	mount /dev/pts ./dev/pts -o bind

	if [ -s etc/resolv.conf ]; then
		sudo mv etc/resolv.conf etc/resolv.conf.saved
	fi
	if [ -e "/run/resolvconf/resolv.conf" ]; then
		sudo cp /run/resolvconf/resolv.conf etc/
	elif [ -e "/etc/resolv.conf" ]; then
		sudo cp /etc/resolv.conf etc/
	fi
	sudo LC_ALL=C chroot . apt-get update

Hi,
Please modify the script to have exact path to apt-get binary. Looks like it cannot find the binary in docker.

It seems that is trying to run apt-get in a different architecure that is not expecting, no? Isn’t that what Exec Format Error means?

Should the chroot point to the qemu binary for aarch64?

I needed to run inside the docker image, after that it worked

sudo update-binfmts --enable qemu-aarch64
1 Like