ROOTFS_AB does not switch to APP_B partition

I flashed the Orin NX device with a rootfs A/B partition, setting each partition size to 30GB. After booting, it shows that the current rootfs slot is A, and the / is mounted on /dev/nvme0n1p1. Then, I used the command nvbootctrl -t rootfs set-active-boot-slot B to switch to slot B. After rebooting, it indeed shows that it has switched to slot B, but the root directory is still mounted on /dev/nvme0n1p1.


Flash command:

sudo ROOTFS_AB=1 ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1 -c tools/kernel_flash/flash_l4t_nvme_rootfs_ab.xml -p "-c bootloader/t186ref/cfg/flash_t234_qspi.xml" --showlogs --network usb0 jetson-orin-nano-devkit internal

flash_l4t_nvme_rootfs_ab.xml:

<?xml version="1.0"?>

<!-- Nvidia Tegra Partition Layout Version 1.0.0 -->

<partition_layout version="01.00.0000">
    <device type="external" instance="0" sector_size="512" num_sectors="122159104">
        <partition name="master_boot_record" type="protective_master_boot_record">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 512 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <description> **Required.** Contains protective MBR. </description>
        </partition>
        <partition name="primary_gpt" type="primary_gpt">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 19968 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <description> **Required.** Contains primary GPT of the `nvme` device. All
              partitions defined after this entry are configured in the kernel, and are
              accessible by standard partition tools such as gdisk and parted. </description>
        </partition>
        <partition name="APP" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> APPSIZE </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 0x8 </allocation_attribute>
            <align_boundary> 4096 </align_boundary>
            <percent_reserved> 0 </percent_reserved>
            <filename> APPFILE </filename>
            <unique_guid> APPUUID </unique_guid>
            <description> **Required.** Contains the rootfs. This partition must be defined
              after `primary_GPT` so that it can be accessed as the fixed known special device
              `/dev/nvme0n1p1`. </description>
        </partition>
        <partition name="APP_b" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> APPSIZE </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 0x8 </allocation_attribute>
            <align_boundary> 4096 </align_boundary>
            <percent_reserved> 0 </percent_reserved>
            <filename> APPFILE_b </filename>
            <unique_guid> APPUUID_b </unique_guid>
            <description> **Required.** Contains the rootfs. This partition must be defined
              after `primary_GPT` so that it can be accessed as the fixed known special device
              `/dev/nvme0n1p2`. </description>
        </partition>
        <partition name="kernel" type="kernel">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 67108864 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <filename> LNXFILE </filename>
            <description> **Required.** Chain A; contains boot.img (kernel, initrd, etc)
              which is loaded in when cpu-bootloader failes to launch the kernel
              from the rootfs at `/boot`. </description>
        </partition>
        <partition name="kernel-dtb" type="kernel_dtb">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 458752 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <filename> DTB_FILE </filename>
            <description> **Required.** Chain A; contains kernel device tree blob. </description>
        </partition>
        <partition name="reserved_for_chain_A_user" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 33554432 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <description> **Required.** Reserved space for chain A on user device. </description>
        </partition>
        <partition name="kernel_b" type="kernel">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 67108864 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <filename> LNXFILE_b </filename>
            <description> **Required.** Chain B; contains boot.img (kernel, initrd, etc)
              which is loaded in when cpu-bootloader failes to launch the kernel
              from the rootfs at `/boot`. </description>
        </partition>
        <partition name="kernel-dtb_b" type="kernel_dtb">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 458752 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <filename> DTB_FILE </filename>
            <description> **Required.** Chain B; contains kernel device tree blob. </description>
        </partition>
        <partition name="reserved_for_chain_B_user" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 33554432 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <description> **Required.** Reserved space for chain B on user device. </description>
        </partition>
        <partition name="RECNAME" type="kernel">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> RECSIZE </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <filename> RECFILE </filename>
            <description> **Required.** Contains recovery image. </description>
        </partition>
        <partition name="RECDTB-NAME" type="kernel_dtb">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 524288 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <filename> RECDTB-FILE </filename>
            <description> **Required.** Contains recovery DTB image. </description>
        </partition>
        <partition name="RECROOTFS" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> RECROOTFSSIZE </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 0x8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <description> **Optional.** Reserved for future use by the recovery filesystem;
              removable. </description>
        </partition>
        <partition name="esp" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 67108864 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 0x8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <filename> ESP_FILE </filename>
            <partition_type_guid> C12A7328-F81F-11D2-BA4B-00A0C93EC93B </partition_type_guid>
            <description> **Required.** EFI system partition with L4T Launcher. </description>
        </partition>
        <partition name="RECNAME_alt" type="kernel">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> RECSIZE </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <description> **Required.** For fail-safe recovery update. </description>
        </partition>
        <partition name="RECDTB-NAME_alt" type="kernel_dtb">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 524288 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <description> **Required.** For fail-safe recovery DTB update. </description>
        </partition>
        <partition name="esp_alt" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 67108864 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 0x8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <description> **Required.** EFI system partition for fail-safe ESP update. </description>
        </partition>
        <partition name="UDA" type="data">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 18432 </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 0x808 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <description> **Required.** Automatically takes all remaining space on the device except that
              occupied by the `secondary_gpt` partition. Allocation attribute must be set to 0x808.
              May be mounted and used to store user data. </description>
        </partition>
        <partition name="secondary_gpt" type="secondary_gpt">
            <allocation_policy> sequential </allocation_policy>
            <filesystem_type> basic </filesystem_type>
            <size> 0xFFFFFFFFFFFFFFFF </size>
            <file_system_attribute> 0 </file_system_attribute>
            <allocation_attribute> 8 </allocation_attribute>
            <percent_reserved> 0 </percent_reserved>
            <description> **Required.** Contains secondary GPT of the `nvme`
              device. </description>
        </partition>
    </device>
</partition_layout>

Hi zjy523213189zjy,

Are you using the devkit or custom board for Orin Nano?
What’s your Jetpack version in use?

Could you try to mount /dev/nvme0n1p2 and check the /boot/extlinux/extlinux.conf for the device for rootfs?

  1. custom board
  2. Jetpack 5.1.1 [L4T 35.3.1]
root@b1 /d/orca# mount /dev/nvme0n1p2 /media
root@b1 /d/orca# cd /media
root@b1 /media# ll
total 4.1G
-rw-rw-rw-   1 root root   62 Mar 19  2023 README.txt
lrwxrwxrwx   1 root root    7 Aug  1  2020 bin -> usr/bin/
drwxr-xr-x   4 root root  12K Mar 18 18:27 boot/
drwxr-xr-x   2 root root 4.0K Mar  6 15:48 data/
drwxr-xr-x   2 root root 4.0K Mar  6 09:13 dev/
drwxr-xr-x 149 root root  12K Nov 22 05:10 etc/
drwxr-xr-x   3 root root 4.0K Mar  6 14:49 home/
lrwxrwxrwx   1 root root    7 Aug  1  2020 lib -> usr/lib/
drwx------   2 root root  16K Mar  6 14:25 lost+found/
drwxr-xr-x   3 root root 4.0K Mar  6 14:51 media/
drwxr-xr-x   3 root root 4.0K Nov 22 05:10 mnt/
drwxr-xr-x   5 orca orca 4.0K Apr  8 10:23 opt/
drwxr-xr-x   2 root root 4.0K Apr 15  2020 proc/
drwx------   7 root root 4.0K May  9 18:15 root/
drwxr-xr-x  18 root root 4.0K Jul  7  2021 run/
lrwxrwxrwx   1 root root    8 Aug  1  2020 sbin -> usr/sbin/
drwxr-xr-x   2 root root 4.0K Mar  6 14:50 snap/
drwxr-xr-x   2 root root 4.0K Aug  1  2020 srv/
-rw-------   1 root root 4.0G Mar  6 14:49 swapfile
drwxr-xr-x   2 root root 4.0K Apr 15  2020 sys/
drwxrwxrwt  19 root root 4.0K Nov 22 05:11 tmp/
drwxr-xr-x  11 root root 4.0K Mar  4  2021 usr/
drwxr-xr-x  15 root root 4.0K Mar  5 16:58 var/
root@b1 /media# cd boot/extlinux/
root@b1 /m/b/extlinux# cat extlinux.conf
TIMEOUT 30
DEFAULT primary

MENU TITLE L4T boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      FDT /boot/dtb/kernel_tegra234-p3767-0001-p3509-a02.dtb
      INITRD /boot/initrd
      APPEND ${cbootargs} root=PARTUUID=972469d0-1eea-49f0-88bd-957a95319fd8 rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 console=ttyAMA0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 

# When testing a custom kernel, it is recommended that you create a backup of
# the original kernel and add a new entry to this file so that the device can
# fallback to the original kernel. To do this:
#
# 1, Make a backup of the original kernel
#      sudo cp /boot/Image /boot/Image.backup
#
# 2, Copy your custom kernel into /boot/Image
#
# 3, Uncomment below menu setting lines for the original kernel
#
# 4, Reboot

LABEL backup
    MENU LABEL backup kernel
    LINUX /boot/Image.backup
    FDT /boot/dtb/kernel_tegra234-p3767-0001-p3768-0000-a0.dtb
    INITRD /boot/initrd
    APPEND ${cbootargs}

root@b1 /m/b/extlinux# 

I used the dd command to cover all nvme0n1p1 on nvme0n1p2. Will this cause problems?

Why did you do this?

Oh! I found a problem. The dd command causes the partuuid pointed in extlinux.conf to become the A partition.
After I modified the A partition, I wanted to keep the AB partition consistent, so I used the dd command to overwrite it.

YES. Exactly.
That’s why Kevin asked you to check extlinux.conf.

1 Like

thank you all

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