Run sudo apply_binaries.sh encounters error

I am learning how to use the jetson xavier nx platform to do something new recently. I have encounterd a problem with the “apply_binaries.sh”. here is the thing:

If the process of building the NVIDIA kernel ends with the execute of “apply_binaries.sh” before flash?
And what exactly did this file done?
If I have to cross compile kernel multiple times during my development, do I need to run this script every time after my compile before flash?

Here is the details:
I have compilied the kernel source obtained from the “public_source.tbz2” file, and flashed successfully.
But I get confused with the script apply_binaries.sh. Accodring to the NVIDIA Jetson Linux Developer Guide 32.5 Release-section “Kernel Customization”, the number 8 step is optional, however it also says “Use the archive to replace the one in the kernel directory of the extracted release package prior to running apply_binaries.sh:”.

I have tried to run the “apply_binaries.sh” after compile the kernel and before flash. And I accidentally ran this shell script twice and then I encountered this error listed below:

Using rootfs directory of: /home/ts/workspace/nv_nx/cross_compile/Linux_for_Tegra/rootfs
/home/ts/workspace/nv_nx/cross_compile/Linux_for_Tegra/nv_tegra/nv-apply-debs.sh
Root file system directory is /home/ts/workspace/nv_nx/cross_compile/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
~/workspace/nv_nx/cross_compile/Linux_for_Tegra/rootfs ~/workspace/nv_nx/cross_compile/Linux_for_Tegra
Installing BSP Debian packages in /home/ts/workspace/nv_nx/cross_compile/Linux_for_Tegra/rootfs
(Reading database ... 123395 files and directories currently installed.)
Preparing to unpack .../nvidia-l4t-core_32.4.2-20200408182620_arm64.deb ...
Pre-installing... skip compatibility checking.
Unpacking nvidia-l4t-core (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Setting up nvidia-l4t-core (32.4.2-20200408182620) ...
(Reading database ... 123395 files and directories currently installed.)
Preparing to unpack .../jetson-gpio-common_2.0.8_arm64.deb ...
Unpacking jetson-gpio-common (2.0.8) over (2.0.8) ...
Preparing to unpack .../python3-jetson-gpio_2.0.8_arm64.deb ...
Unpacking python3-jetson-gpio (2.0.8) over (2.0.8) ...
Preparing to unpack .../python-jetson-gpio_2.0.8_arm64.deb ...
Unpacking python-jetson-gpio (2.0.8) over (2.0.8) ...
Preparing to unpack .../nvidia-l4t-3d-core_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-3d-core (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-apt-source_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-apt-source (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-camera_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-camera (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-configs_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-configs (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-cuda_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-cuda (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-firmware_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-firmware (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-graphics-demos_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-graphics-demos (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-gstreamer_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-gstreamer (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-init_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-init (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-initrd_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-initrd (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-jetson-io_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-jetson-io (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-multimedia_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-multimedia (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-multimedia-utils_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-multimedia-utils (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-oem-config_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-oem-config (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-tools_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-tools (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-wayland_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-wayland (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-weston_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-weston (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-x11_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-x11 (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-xusb-firmware_32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-xusb-firmware (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-kernel_4.9.140-tegra-32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-kernel (4.9.140-tegra-32.4.2-20200408182620) over (4.9.140-tegra-32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-kernel-dtbs_4.9.140-tegra-32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-kernel-dtbs (4.9.140-tegra-32.4.2-20200408182620) over (4.9.140-tegra-32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-kernel-headers_4.9.140-tegra-32.4.2-20200408182620_arm64.deb ...
Unpacking nvidia-l4t-kernel-headers (4.9.140-tegra-32.4.2-20200408182620) over (4.9.140-tegra-32.4.2-20200408182620) ...
Preparing to unpack .../nvidia-l4t-bootloader_32.4.2-20200408182620_arm64.deb ...
Pre-installing bootloader package, skip flashing
Unpacking nvidia-l4t-bootloader (32.4.2-20200408182620) over (32.4.2-20200408182620) ...
Setting up jetson-gpio-common (2.0.8) ...
Setting up python3-jetson-gpio (2.0.8) ...
Setting up python-jetson-gpio (2.0.8) ...
Setting up nvidia-l4t-apt-source (32.4.2-20200408182620) ...
Pre-installing... skip changing source list.
Setting up nvidia-l4t-configs (32.4.2-20200408182620) ...
Setting up nvidia-l4t-firmware (32.4.2-20200408182620) ...
Setting up nvidia-l4t-init (32.4.2-20200408182620) ...
groupadd: group 'crypto' already exists
groupadd: group 'trusty' already exists
dpkg: error processing package nvidia-l4t-init (--install):
 installed nvidia-l4t-init package post-installation script subprocess returned error exit status 9
Setting up nvidia-l4t-multimedia-utils (32.4.2-20200408182620) ...
Setting up nvidia-l4t-oem-config (32.4.2-20200408182620) ...
Setting up nvidia-l4t-tools (32.4.2-20200408182620) ...
Setting up nvidia-l4t-wayland (32.4.2-20200408182620) ...
Setting up nvidia-l4t-weston (32.4.2-20200408182620) ...
dpkg: dependency problems prevent configuration of nvidia-l4t-x11:
 nvidia-l4t-x11 depends on nvidia-l4t-init (= 32.4.2-20200408182620); however:
  Package nvidia-l4t-init is not configured yet.

dpkg: error processing package nvidia-l4t-x11 (--install):
 dependency problems - leaving unconfigured
Setting up nvidia-l4t-xusb-firmware (32.4.2-20200408182620) ...
Pre-installing xusb firmware package, skip flashing
Setting up nvidia-l4t-kernel (4.9.140-tegra-32.4.2-20200408182620) ...
Setting up nvidia-l4t-kernel-dtbs (4.9.140-tegra-32.4.2-20200408182620) ...
Setting up nvidia-l4t-kernel-headers (4.9.140-tegra-32.4.2-20200408182620) ...
Unpacking kernel headers...
Setting up nvidia-l4t-bootloader (32.4.2-20200408182620) ...
Pre-installing bootloader package, skip flashing
dpkg: dependency problems prevent configuration of nvidia-l4t-3d-core:
 nvidia-l4t-3d-core depends on nvidia-l4t-init (= 32.4.2-20200408182620); however:
  Package nvidia-l4t-init is not configured yet.
 nvidia-l4t-3d-core depends on nvidia-l4t-x11 (= 32.4.2-20200408182620); however:
  Package nvidia-l4t-x11 is not configured yet.

dpkg: error processing package nvidia-l4t-3d-core (--install):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of nvidia-l4t-camera:
 nvidia-l4t-camera depends on nvidia-l4t-3d-core (= 32.4.2-20200408182620); however:
  Package nvidia-l4t-3d-core is not configured yet.

dpkg: error processing package nvidia-l4t-camera (--install):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of nvidia-l4t-cuda:
 nvidia-l4t-cuda depends on nvidia-l4t-3d-core (= 32.4.2-20200408182620); however:
  Package nvidia-l4t-3d-core is not configured yet.

dpkg: error processing package nvidia-l4t-cuda (--install):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of nvidia-l4t-graphics-demos:
 nvidia-l4t-graphics-demos depends on nvidia-l4t-3d-core (= 32.4.2-20200408182620); however:
  Package nvidia-l4t-3d-core is not configured yet.

dpkg: error processing package nvidia-l4t-graphics-demos (--install):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of nvidia-l4t-gstreamer:
 nvidia-l4t-gstreamer depends on nvidia-l4t-camera (= 32.4.2-20200408182620); however:
  Package nvidia-l4t-camera is not configured yet.
 nvidia-l4t-gstreamer depends on nvidia-l4t-cuda (= 32.4.2-20200408182620); however:
  Package nvidia-l4t-cuda is not configured yet.

dpkg: error processing package nvidia-l4t-gstreamer (--install):
 dependency problems - leaving unconfigured
Setting up nvidia-l4t-initrd (32.4.2-20200408182620) ...
Setting up nvidia-l4t-jetson-io (32.4.2-20200408182620) ...
dpkg: dependency problems prevent configuration of nvidia-l4t-multimedia:
 nvidia-l4t-multimedia depends on nvidia-l4t-3d-core (= 32.4.2-20200408182620); however:
  Package nvidia-l4t-3d-core is not configured yet.
 nvidia-l4t-multimedia depends on nvidia-l4t-cuda (= 32.4.2-20200408182620); however:
  Package nvidia-l4t-cuda is not configured yet.

dpkg: error processing package nvidia-l4t-multimedia (--install):
 dependency problems - leaving unconfigured
Processing triggers for nvidia-l4t-kernel (4.9.140-tegra-32.4.2-20200408182620) ...
Errors were encountered while processing:
 nvidia-l4t-init
 nvidia-l4t-x11
 nvidia-l4t-3d-core
 nvidia-l4t-camera
 nvidia-l4t-cuda
 nvidia-l4t-graphics-demos
 nvidia-l4t-gstreamer
 nvidia-l4t-multimedia

I am a beginer so please explain this to me in details, thank you so much!

What’s the version?

Hi chengda0203,

Please run below two command and try again:

$ sudo apt-get update
$ sudo apt-get install qemu-user-static

Additional note: Before “apply_binaries.sh” is run, the content in “Linux_for_Tegra/rootfs/” is purely Ubuntu. After “apply_binaries.sh” the “rootfs/” will contain NVIDIA content, e.g, drivers for the GPU and some firmware.

When you flash “normally” the root filesystem image is generated based on “rootfs/” and some optional boot edits. If you’ve run “apply_binaries.sh” once, then normally you would not need to run it again (the packages are already in “rootfs/” and “rootfs/” does not need to have the same thing added twice). Some content you might add to “rootfs/” would still be there on every flash. The exception would be content which collides with either the “apply_binaries.sh” packages or the boot content.

The boot content ("Linux_for_Tegra/rootfs/boot/") does get content added based on options to the flash, e.g., naming the boot device and kernel and device tree. Beware if your content is overwriting what an NVIDIA package added since an OTA update can then overwrite what you originally replaced in a package. A custom kernel, initrd, device tree, or “/boot/extlinux/extlinux.conf” configuration might be lost upon update.

If you add a new kernel and use an alternate name, e.g., “/boot/Image-4.9.140-custom”, then a package will never overwrite this. Similar for device tree and initrd. You could then add a new entry in extlinux.conf and name the new entry as default (leaving the original boot content available for pick at boot time if you use a serial console).

1 Like

Thank you for your suggestions, I had already installed the qemu-user-static before the compile and flash.

I have already solved this problem, my confusition about the apply_binaries.sh files has already been soved.

Thank you for your kind advice, the problem has been solved!
I believe friend linuxdev has explained everything I want to know.

Thank you for tell me all these details, it really helped me a lot!
It seems like I have a long way to go in learning linux.

Thank you for your kind ask, my peoblem has been solved.