After OTA update the version of Jetpack stays the same but should be updated

Hi guys. I have a question.

I have a question regarding the OTA update.
Following the above steps I encounter a small issue. Everything goes fine and there is a partition swap with all my data exchanged between partitions A and B after the artifact update but there is no system update. Before and after the update when I do cat / etc / nv_tegra_release I get the same 32.6.1 version. I wanted to update from version 32.6.1 to version 32.7.3

Here are all my steps that I followed through the installation process:

Install a fresh Jetpack Linux version on AGX that supports A/B update ( I used 32.6.1 ):

On Host computer:

tar xpf Jetson_Linux_<rel>_aarch64.tbz2
cd ./Linux_for_Tegra/rootfs
sudo tar -jxpf ../../Tegra-Linux-Sample-Root-Filesystem_<release_type>.tbz2
cd ../..
tar xpf ./ota_tools_<rel>_aarch64.tbz2
tar xpf ./secureboot_<rel>_aarch64.tbz2
cd Linux_for_Tegra

Check the Sector size and No. of sectors of the hard drive you want to flash:
sector size: cat /sys/block/nvme0n1/queue/hw_sector_size
num_sectors: cat /sys/block/nvme0n1/size
In the Linux_for_Tegra/tools/kernel_flash/flash_l4t_nvme_rootfs_ab.xml <device type="nvme" instance="0" sector_size="512" num_sectors="1000215216">

sudo ./apply_binaries.sh

sudo ROOTFS_AB=1 ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1 -c ./tools/kernel_flash/flash_l4t_nvme_rootfs_ab.xml --external-only -S 32GiB --showlogs jetson-agx-xavier-devkit external

On Jetson AGX Xavier:

sudo mkfs.ext4 /dev/nvme0n1p12

sudo mkdir -p /data
sudo su -c "echo '/dev/nvme0n1p12 /data ext4 defaults 0 0' >> /etc/fstab"
sudo mount -a

sudo apt update && sudo apt upgrade
sudo apt install curl
sudo apt install nano

curl -fLsS https://get.mender.io -o get-mender.sh
sudo bash get-mender.sh mender-client

configure mender client → hosted mender server credentials.

sudo mv /var/lib/mender /data
sudo ln -s /data/mender /var/lib/mender
sudo mkdir -p /usr/share/mender/modules/v3
sudo touch  /usr/share/mender/modules/v3/rootfs-image-jetson
cd /usr/share/mender/modules/v3
sudo nano rootfs-image-jetson
#!/bin/sh

set -ue

STATE="$1"
FILES="$2"

ota_payload_package="$FILES"/files/ota_payload_package.tar.gz
nvidia_tools="$FILES"/files/ota_tools_aarch64.tbz2

# Nvidia uses the concept of "slots", they will
# be always 0 and 1 values for A and B partitions

MENDER_ROOTFS_PART_A_NUMBER="0"
MENDER_ROOTFS_PART_B_NUMBER="1"

# Some useful information for integrity check
mkdir -p "/data/fs_update/"
mender_boot_part="/data/fs_update/mender_boot_part"
active_num="$(nvbootctrl get-current-slot)"

if test $active_num -eq $MENDER_ROOTFS_PART_A_NUMBER; then
    passive_num=$MENDER_ROOTFS_PART_B_NUMBER
else
    passive_num=$MENDER_ROOTFS_PART_A_NUMBER
fi

case "$STATE" in
      Download)
        if [ "$(nvbootctrl get-number-slots)" != "2" ]; then
            echo "Your device need to be configured to use A/B partitioning"
            exit 1
        fi
        ;;

    ArtifactInstall)
        # Let's record what slot we expect to boot next time
        echo $passive_num > $mender_boot_part
        # Let's enable Nvidia's scripts
        mkdir -p "$HOME"/workdir
        export WORKDIR="$HOME"/workdir
        tar -jxvf $nvidia_tools -C $WORKDIR
        # UDA partition as temp location disabled initially
        UDA=""
        # If you have a big enough UDA partition or a small rootfs
        # partition size, uncomment the following line  
        #UDA="data/"
        # Let's move the payload
        mkdir -p "/${UDA}ota/"
        mv $ota_payload_package "/${UDA}ota/"
        mkdir -p "/${UDA}ota_work"
        if [ ! -z "$UDA" ]
        then
            ln -sfn "/${UDA}ota_work" "/ota_work"
        fi
        # Let's run the upgrade process
        cd ${WORKDIR}/Linux_for_Tegra/tools/ota_tools/version_upgrade
        ./nv_ota_start.sh /dev/nvme0n1 "/${UDA}ota/ota_payload_package.tar.gz"
        # nv_ota_start.sh set the unused slot to active for next reboot
        >&2 echo "Next boot will load Slot $passive_num" 
        #cleaning up the disk
        if [ ! -z "$UDA" ]; then
            rm -rf "/${UDA}ota_work"
            rm -rf "/${UDA}ota/"
        fi   
        ;;

    PerformsFullUpdate)
        echo "Yes"
        ;;

    NeedsArtifactReboot)
        echo "Automatic"
        ;;

    SupportsRollback)
        echo "Yes"
        ;;

    ArtifactVerifyReboot)
        # We use stderr for logging as Mender protocol uses stdout for exchanging messages with the server.
        >&2 echo "ArtifactVerifyReboot: The active partition is $active_num while the last passive was $(cat $mender_boot_part)"
        if test "$(cat $mender_boot_part)" != "$active_num"; then
            exit 1
        fi
        # Recommend calling sync at the end here as well
        sync
        ;;

    ArtifactVerifyRollbackReboot)
        >&2 echo "ArtifactVerifyRollbackReboot: The active partition is $active_num while the last passive was $(cat $mender_boot_part)"
        if test "$(cat $mender_boot_part)" = "$active_num"; then
            exit 1
        fi
        # Recommend calling sync at the end here as well
        sync
        ;;

    ArtifactCommit)
        >&2 echo "ArtifactCommit: The active partition is $active_num while the last passive was $(cat $mender_boot_part)"
        if test "$(cat $mender_boot_part)" = "$active_num"; then
            nvbootctrl mark-boot-successful
        else
            # If we get here, an upgrade in standalone mode failed to  
            # boot and the user is trying to commit from the old OS.
            # This communicates to the user that the upgrade failed.
            echo "Upgrade failed and was reverted: refusing to commit!"
            exit 1
        fi
        ;;

    ArtifactRollback)
        >&2 echo "ArtifactRollback: The active partition is $active_num while the last passive was $(cat $mender_boot_part)"
        if test "$(cat $mender_boot_part)" = "$active_num"; then
            nvbootctrl set-active-boot-slot $passive_num
        fi
        sync
        ;;

esac
exit 0

a small note-----> I replaced in this part of the script the internal with my external drive: ./nv_ota_start.sh /dev/nvme0n1 "/${UDA}ota/ota_payload_package.tar.gz"

sudo chmod +x /usr/share/mender/modules/v3/rootfs-image-jetson
sudo systemctl restart mender-client

sudo su
sudo mender snapshot dump | ssh $USER@$HOST /bin/sh -c ‘cat > $HOME/my-jetson-fs.raw’

on Host computer:

New Jetpack version ( I used 32.7.3 ):

tar xpf Jetson_Linux_<rel>_aarch64.tbz2
cd ./Linux_for_Tegra/rootfs
sudo tar -jxpf ../../Tegra-Linux-Sample-Root-Filesystem_<release_type>.tbz2
cd ../..
tar xpf ./ota_tools_<rel>_aarch64.tbz2
cd Linux_for_Tegra

BASE_BSP=/tmp/Jetpack_Linux/32_6_1/Linux_for_Tegra
TARGET_BSP=/tmp/Jetpack_Linux/32_7_3/Linux_for_Tegra

check:
echo $TARGET_BSP
echo $BASE_BSP

sudo ./tools/ota_tools/version_upgrade/build_base_recovery_image.sh jetson-agx-xavier-devkit R32-6 ${BASE_BSP} ${BASE_BSP}/rootfs ${TARGET_BSP}

go to the Mender snapshot file and run this commands to mount it as a filesystem image:

mkdir -p tmp-fs
sudo mount -o loop my-jetson-fs.raw tmp-fs
cd tmp-fs
sudo tar -cvpzf ../image_fs.tar.gz --exclude=./data --exclude=./image_fs.tar.gz --one-file-system ./
cd ..
cp tools/ota_tools/version_upgrade/nv_ota_rootfs_updater.sh rootfs_updater.sh
sudo ./tools/ota_tools/version_upgrade/l4t_generate_ota_package.sh -sr -o rootfs_updater.sh -f /home/petar/jetson/image_fs.tar.gz jetson-agx-xavier-devkit R32-6

Create Mender Arthefact:
ARTIFACT_NAME=“R37_2_3_update”
DEVICE_TYPE=“jetson-agx-xavier”
OUTPUT_PATH=“/home/petar/R37_2_3_update.mender”
IMAGE=“/tmp/Jetpack_Linux/32_7_3/Linux_for_Tegra/bootloader/jetson-agx-xavier-devkit/ota_payload_package.tar.gz”
OTA_TOOLS=“/tmp/Jetpack_Linux/32_7_3/ota_tools_aarch64.tbz2”
mender-artifact write module-image -T rootfs-image-jetson -n ${ARTIFACT_NAME} -t ${DEVICE_TYPE} -o ${OUTPUT_PATH} -f ${IMAGE} -f ${OTA_TOOLS}

upload to mender server using GUI or CLI

check jetpack version:
cat / etc / nv_tegra_release

When I did the update without this command part below It went ok but it’s just a new installation of Jetpack without the backuped files. I want the jetpack update + all the programs installed on the previous version.

mkdir -p tmp-fs
sudo mount -o loop my-jetson-fs.raw tmp-fs
cd tmp-fs
sudo tar -cvpzf ../image_fs.tar.gz --exclude=./data --exclude=./image_fs.tar.gz --one-file-system ./
cp tools/ota_tools/version_upgrade/nv_ota_rootfs_updater.sh rootfs_updater.sh
sudo ./tools/ota_tools/version_upgrade/l4t_generate_ota_package.sh -sr -o rootfs_updater.sh -f /home/petar/jetson/image_fs.tar.gz jetson-agx-xavier-devkit R32-6

Thank you.

Hi kalafatic99,

Are you using the devkit or custom board for AGX Xavier?

Have you tried to update through apt command as following instruction?
NVIDIA Jetson Linux Developer Guide : Over-the-Air Update | NVIDIA Docs

It seems a more simple way for you to do Jetpack upgrade.

Hello @KevinFFF ,

Thank you for the answer. I am using devkit.

Yes I tried with apt and works well but I am more interested using this way I mentioned because I want rollback support. Could you maybe help me out?

The apt way in the documentation supports only new point and new minor releases. What about mayor releases to version 35.x.x.?

Do you mean upgrade from Jetpack4.x(R32.x) to Jetpack5(R35.x)?
You could refer to the instruction of image-based OTA as following.
Software Packages and the Update Mechanism — Updating Jetson Linux with Image-Based Over-the-Air Update

Could we ignore for a sec the update to version R35.X. Maybe sometime in the future.

Just the update from R32.6.1 to R32.7.3.
After I perform the update all my apps and data are there ( the partitions A and B swapped with no problem ) but the system version is not 32.7.3 as it should be but still 32.6.1.

As I understand this set of commands should preserve the data before the update ( system snapshot ):

mkdir -p tmp-fs
sudo mount -o loop my-jetson-fs.raw tmp-fs
cd tmp-fs
sudo tar -cvpzf ../image_fs.tar.gz --exclude=./data --exclude=./image_fs.tar.gz --one-file-system ./
cd ..
cp tools/ota_tools/version_upgrade/nv_ota_rootfs_updater.sh rootfs_updater.sh
sudo ./tools/ota_tools/version_upgrade/l4t_generate_ota_package.sh -sr -o rootfs_updater.sh -f /home/petar/jetson/image_fs.tar.gz jetson-agx-xavier-devkit R32-6

When I do the update without all the above commands, just using this one:

sudo ./tools/ota_tools/version_upgrade/l4t_generate_ota_package.sh jetson-agx-xavier-devkit R32-6

all goes well but the data before the update are not preserved.
Am I missing something here?

Thank you

If you have enabled ROOTFS_AB support, you might need to do it twice for each partition.

Image-based OTA would reset all data under rootfs.
If you have something need to be preserved, you could edit ota_backup_files_list.txt to specify what do you want to preserve.

For more details, you could refer to the following instruction.
Guide : Over-the-Air Update - Back Up and Restore Files on the APP Partition

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