Error 8 when trying to clone Xavier

I have a Jetson Xavier AGX with jetpack 4.2 installed on it.

I would like to clone its APP partition to another instance. When I run the flash command:

sudo ./flash -r -k APP -G my_image jetson-xavier mmcblk0p1

I get the following error:

Error: return value 8 Command tegradevflash_v2 --read APP /home/me/nvidia_sdk/JetPack_4.2_Linux_P2888/Linux_For_Tegra/my_image.img

The process then continues and I get an unusable raw image of about 300 Mb size.

What can be done to solve the problem?

I don’t know the specific meaning of return value 8, but how much space do you have remaining at that location?
df -H /home/me/nvidia_sdk/JetPack_4.2_Linux_P2888/Linux_For_Tegra

Were you using the USB-C port? Was there any HUB between Xavier and host PC?

I have 250GB free, and I have been using a USB-C cable without any hub.

Can I use any USB-C data cable?

I remind that I am able to flash the board normally.

I have some kind of warning during the attempted clone:
Warning (reg_format): “reg” property in /host1x/vi@15c10000/ports/port@0 has invalid length (4 bytes) (#address-cells == 2, #size-cells == 0)
Warning (reg_format): “reg” property in /host1x/vi@15c10000/ports/port@1 has invalid length (4 bytes) (#address-cells == 2, #size-cells == 0)
Warning (reg_format): “reg” property in /host1x/vi@15c10000/ports/port@2 has invalid length (4 bytes) (#address-cells == 2, #size-cells == 0)
Warning (reg_format): “reg” property in /host1x/vi@15c10000/ports/port@3 has invalid length (4 bytes) (#address-cells == 2, #size-cells == 0)
Warning (reg_format): “reg” property in /host1x/vi@15c10000/ports/port@0 has invalid length (4 bytes) (#address-cells == 2, #size-cells == 0)
Warning (reg_format): “reg” property in /host1x/vi@15c10000/ports/port@1 has invalid length (4 bytes) (#address-cells == 2, #size-cells == 0)
Warning (reg_format): “reg” property in /host1x/vi@15c10000/ports/port@2 has invalid length (4 bytes) (#address-cells == 2, #size-cells == 0)
Warning (reg_format): “reg” property in /host1x/vi@15c10000/ports/port@3 has invalid length (4 bytes) (#address-cells == 2, #size-cells == 0)

I believe any USB-C should work. These are generally of good quality. For systems using micro-B USB, those require care in selecting cables.

I do not know if those warnings are related to the issue or not. Possibly, but I do not know if that is something used in recovery mode or not. Anyone know? “host1x/vi@15c10000/”, all ports?

You could log the clone, and post the log as there might be more going on. Example to log:

sudo ./flash -r -k APP -G my_image.img jetson-xavier mmcblk0p1 2>&1 log_clone.txt

…then post the “log_clone.txt”.

Btw, a clone actually produces two files. One is the “sparse” (not unlike compression by marking empty spots in the filesystem instead of putting out a lot of NULL bytes), and the other is “raw”. The larger raw file can be manipulated and examined, or used for flash. The smaller sparse file can only be used for flash and cannot be used in any other way (and I’ve never found open source tools for dealing with this version of sparse file).

In the above command you would end up with two files:

  • my_image.img (sparse)
  • my_image.img.raw (raw)

I throw away the sparse file and keep only the raw file. If I am storing this long term, then I run “bzip2 -9” on the raw file (which takes a long time due to the huge file size).

How did you determine the clone failed with an invalid file? Was this by using the image to flash, and was it the raw image? If not, then perhaps the clone actually worked and all you would need to do is use the raw file instead of the sparse file.

you may also try cloning, e.g. to sdcard or to Host PC using the method described here: Jetson/AGX Xavier Alternative II For Cloning - eLinux.org
It is experimental and can be executed from running OS, after remounting disks in read only mode

It turned out I’ve been trying to clone using Jetpack 4.2. While flash.sh has the -G flag, it fails for some reason.
It also fails to create a bootable sdcard for Xavier, by the way.

However, when I have installed Jetpack 4.3 host side, I was able to clone Jetpack 4.2 target normally.

I have determined that the clone failed because it completed too fast and the resulting file was too small, and if I were to flash it, the target won’t boot.
I have found the solution, see my comment below, thank you.

@Andrey1984 how do you boot from sdcard in the first place? I cannot seem to find any information in the official documentation about booting Xavier AGX from sdcard…

I do not boot from sdcard; I am using it to dump disk to there and restore to the same device or to other devices from it

JetPack4.2 was the first release with L4T R32.x (it was R32.1). This required a patch to clone correctly. Every release after that (every L4T driver package) had this fixed.

The patch to R32.1 flash.sh:

    diff --git a/flash.sh b/flash.sh
    index 5242a68..d21d7ca 100755
    --- a/flash.sh
    +++ b/flash.sh
    @@ -2049,7 +2049,7 @@ if [ "${target_partname}" != "" ]; then
            else
                    FLASHARGS+="$BCT ${bctfilename} ";
            fi
    -       FLASHARGS+="${BCTARGS} ";
    +       FLASHARGS+="${BCTARGS}${NV_ARGS} ";
            FLASHARGS+="--cfg  ${localcfgfile} ${BINSARGS} ";
            FLASHARGS+=" --cmd \"";
            FLASHARGS+="${pre_cmds}";