J401 Board Flashing Error and Fix

When following the flashing instructions on this page: Flashing Instructions I encountered errors in which the flashing process would hang and never complete. The terminal would have messages like this

tar: Read checkpoint 140000
tar: Read checkpoint 150000
tar: Read checkpoint 160000
tar: Read checkpoint 170000
tar: Read checkpoint 180000
tar: Read checkpoint 190000
tar: Read checkpoint 200000
Erased 67108864 bytes from address 0x00000000 in flash
Flash failure
Cleaning up...

I tried this with both JP 5.1.1 and JP 5.1.2 multiple times with the same failure. I traced the problem to a line in tools/l4t_flash_prerequisities.sh which tries to install a non existent package “python”. I changed the line that says python to python-is-python3 and then the flashing worked as expected.

sudo apt-get update && \
sudo apt-get install -y abootimg \
                        binfmt-support \
                        binutils \
                        cpp \
                        device-tree-compiler \
                        dosfstools \
                        lbzip2 \
                        libxml2-utils \
                        nfs-kernel-server \
                        python-is-python3 \
                        python3-yaml \
                        qemu-user-static \
                        sshpass \
                        udev \
                        uuid-runtime \
                        whois \
                        openssl \

Hopefully this post helps someone get past this problem. I’m looking for the code repository for these scripts and will push an upstream patch when I find it. In the meantime I stored a tar file with the fix in this gcp bucket: Updated JP 5.1.1 flashing script (python fix)