Yocto Mender integration (DUNFELL) on colibri IMX6 updates correctly but fallsback to previous partition

Hi,
After integrating mender on the Colibri IMX6ULL board, I’m facing some problems while updating.

My procedure is simple:

  1. I create a yocto build
  2. I flash the .ubimg file by means of copying it to a SD and asking uboot to flash it on the ubi partition.
  3. After booting I can see the board conecting to hosted.mender.io
  4. I accept the connection request from hosted.mender.io
  5. I edit /etc/mender/artifact_info and change artifact_name value to some random name so I can use the same build just for testing.

So far so good, I create a deployment, mender downloads and installs it, the system reboots and I can clearly see it booted from the rootfsb vol (ubi0_1), but now the problems start:

Problem 1: Once it boots on the recently updated partition (rootfsb) I need to manually reauthorize the device at hosted.mender.io, logs are like this:

Jan 17 20:37:05 colibri-imx6ull systemd[1]: Condition check resulted in Mender persistent data dir being skipped.
Jan 17 20:37:05 colibri-imx6ull systemd[1]: Started Mender OTA update service.
Jan 17 20:37:05 colibri-imx6ull mender[542]: time="2021-01-17T20:37:05Z" level=info msg="Loaded configuration file: /etc/mender/mender.conf"
Jan 17 20:37:05 colibri-imx6ull mender[542]: time="2021-01-17T20:37:05Z" level=info msg="No dual rootfs configuration present"
Jan 17 20:37:05 colibri-imx6ull mender[542]: time="2021-01-17T20:37:05Z" level=info msg="State transition: init [none] -> init [none]"
Jan 17 20:37:05 colibri-imx6ull mender[542]: time="2021-01-17T20:37:05Z" level=info msg="State transition: init [none] -> idle [Idle]"
Jan 17 20:37:05 colibri-imx6ull mender[542]: time="2021-01-17T20:37:05Z" level=info msg="State transition: idle [Idle] -> authorize-wait [Idle]"
Jan 17 20:37:05 colibri-imx6ull mender[542]: time="2021-01-17T20:37:05Z" level=info msg="State transition: authorize-wait [Idle] -> authorize [Sync]"
Jan 17 20:37:05 colibri-imx6ull mender[542]: time="2021-01-17T20:37:05Z" level=info msg="Device keys not present or bootstrap forced, generating"
Jan 17 20:37:19 colibri-imx6ull mender[542]: time="2021-01-17T20:37:19Z" level=error msg="Authorize failed: transient error: authorization request failed: (request_id: ): authentication request rejected server error message: dev auth: unauthorized"
Jan 17 20:37:19 colibri-imx6ull mender[542]: time="2021-01-17T20:37:19Z" level=info msg="State transition: authorize [Sync] -> authorize-wait [Idle]"

I checked the u-boot environment at this point and I can clearly see the following variables set:

upgrade_available=1
mender_boot_part=1
mender_boot_part_hex=1

Problem 2: If I manually reboot, it falls back to previous partition (rootfsA) even when nothing bad ® happened with the previous update

Bootloader logs after reboot:

U-Boot 2020.07-5.1.0-devel+git.51b7d2f591d3 (Nov 30 2020 - 20:20:40 +0000)
CPU:   Freescale i.MX6ULL rev1.0 792 MHz (running at 396 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 47C
Reset cause: POR
DRAM:  512 MiB
NAND:  512 MiB
MMC:   FSL_SDHC: 0
Loading Environment from UBI... Read 131072 bytes from volume u-boot-env-1 to 9deee9c0
Read 131072 bytes from volume u-boot-env-2 to 9df0ea00
OK
In:    serial
Out:   serial
Err:   serial
Model: Toradex Colibri iMX6ULL 512MB Wi-Fi / BT IT V1.1A, Serial# 06399268
Setting usb power: ON [0]
Net:   Could not get PHY for FEC1: addr 2
No ethernet found.

Saving Environment to UBI... Writing to redundant UBI... done
OK
Warning: Bootlimit (1) exceeded. Using altbootcmd.
Hit any key to stop autoboot:  0 
Saving Environment to UBI... Writing to UBI... done
OK
Booting from NAND...
Loading file '/boot/zImage' to addr 0x81000000...
Done
Loading file '/boot/imx6ull-colibri-zymbiot-wifi.dtb' to addr 0x82100000...
Done

After this, it boots back on rootfsA (ubi0_0) and logs are like this:

Jan 17 21:08:22 colibri-imx6ull mender[490]: time="2021-01-17T21:08:22Z" level=info msg="Loaded configuration file: /var/lib/mender/mender.conf"
Jan 17 21:08:22 colibri-imx6ull mender[490]: time="2021-01-17T21:08:22Z" level=info msg="Loaded configuration file: /etc/mender/mender.conf"
Jan 17 21:08:22 colibri-imx6ull mender[490]: time="2021-01-17T21:08:22Z" level=warning msg="Could not resolve path link: ubi0_0 Attempting to continue"
Jan 17 21:08:22 colibri-imx6ull mender[490]: time="2021-01-17T21:08:22Z" level=warning msg="Could not resolve path link: ubi0_1 Attempting to continue"
Jan 17 21:08:22 colibri-imx6ull mender[490]: time="2021-01-17T21:08:22Z" level=info msg="Mender running on partition: ubi0_0"
Jan 17 21:08:22 colibri-imx6ull mender[490]: time="2021-01-17T21:08:22Z" level=info msg="State transition: init [none] -> init [none]"
Jan 17 21:08:22 colibri-imx6ull mender[490]: time="2021-01-17T21:08:22Z" level=info msg="Handling loaded state: reboot"
Jan 17 21:08:22 colibri-imx6ull mender[490]: time="2021-01-17T21:08:22Z" level=info msg="Running Mender client version: 2.4.1"
Jan 17 21:08:22 colibri-imx6ull mender[490]: time="2021-01-17T21:08:22Z" level=info msg="State transition: init [none] -> after-reboot [ArtifactReboot_Leave]"
Jan 17 21:08:22 colibri-imx6ull mender[490]: time="2021-01-17T21:08:22Z" level=error msg="transient error: Reboot to the new update failed. Expected \"upgrade_available\" flag to be true but it was false. Either the switch to the new partition was unsuccessful, or the bootloader rolled back"
Jan 17 21:08:22 colibri-imx6ull mender[490]: time="2021-01-17T21:08:22Z" level=info msg="State transition: after-reboot [ArtifactReboot_Leave] -> rollback [ArtifactRollback]"
Jan 17 21:08:22 colibri-imx6ull mender[490]: time="2021-01-17T21:08:22Z" level=info msg="Performing rollback"
Jan 17 21:08:22 colibri-imx6ull mender[490]: time="2021-01-17T21:08:22Z" level=info msg="No update available, so no rollback needed."
Jan 17 21:08:22 colibri-imx6ull mender[490]: time="2021-01-17T21:08:22Z" level=info msg="State transition: rollback [ArtifactRollback] -> rollback-reboot [ArtifactRollbackReboot_Enter]"
Jan 17 21:08:22 colibri-imx6ull mender[490]: time="2021-01-17T21:08:22Z" level=info msg="Rebooting device(s) after rollback"
Jan 17 21:08:22 colibri-imx6ull mender[490]: time="2021-01-17T21:08:22Z" level=info msg="Mender rebooting from inactive partition: ubi0_0"

Any idea what could be going on? Im now checking step by step, but might be someone sees something obvivous :slight_smile:

Hi, Did you find the solution to this? I think I’m encountering a similar situation.