Install at shutdown on the device


Is it possible to create a deploy with pause after download and install at shutdown on the device?
I have tried the following

  • Add a mender shutdown update service that runs before mender-client at shutdown and run the script
  • In the script, use dbus-send to change all states to force_continue

It transitions to ArtifactInstall_Leave, but not to ArtifactReboot_Enter, and the deployment fails.
Is it possible to transition to ArtifactReboot_Enter during shutdown?


Description=Mender shutdown update service


[Install] (snip)


    \"priority\": $CONTROL_MAP_PRIORITY,\
    \"states\": { \
        \"ArtifactInstall_Enter\": { \
            \"action\": \"$CONTROL_MAP_ACTION_FORCE_CONTINUE\"
        }, \
        \"ArtifactReboot_Enter\": { \
            \"action\": \"$CONTROL_MAP_ACTION_FORCE_CONTINUE\" \
        }, \
        \"ArtifactCommit_Enter\": { \
            \"action\": \"$CONTROL_MAP_ACTION_FORCE_CONTINUE\" \
        } \
    }, \
    \"id\": \"$CONTROL_MAP_ID\" \

dbus-send --print-reply --system --dest=io.mender.UpdateManager /io/mender/UpdateManager io.mender.Update1.SetUpdateControlMap string:"${CONTROL_MAP}" >/dev/null 2>&1

# Wait for transition to ArtifactReboot_Enter, but no transition

Execution log

2022-04-20 13:28:11 +0000 UTC info: Received an update control map via D-Bus: {    "priority": 10,    "states": {         "ArtifactInstall_Enter": {             "action": "force_continue"
        },         "ArtifactReboot_Enter": {             "action": "force_continue"         },         "ArtifactCommit_Enter": {             "action": "force_continue"         }     },     "id": "*snip*" }
2022-04-20 13:28:11 +0000 UTC info: Forced wake-up from sleep
2022-04-20 13:28:11 +0000 UTC info: State transition: mender-update-control-pause [none] -> mender-update-control [none]
2022-04-20 13:28:11 +0000 UTC info: Forced continue from a control map
2022-04-20 13:28:11 +0000 UTC info: State transition: mender-update-control [none] -> update-install [ArtifactInstall]
2022-04-20 13:28:11 +0000 UTC info: Executing script: ArtifactInstall_Enter_00_UpdateStateFile
2022-04-20 13:28:12 +0000 UTC info: Enabling partition with new image installed to be a boot candidate: 33
2022-04-20 13:28:12 +0000 UTC info: Output (stderr) from command "fw_printenv": ERR: no such variable: mender_check_saveenv_canary
2022-04-20 13:28:12 +0000 UTC info: Output (stderr) from command "fw_printenv": ERR: no such variable: mender_check_saveenv_canary
2022-04-20 13:28:12 +0000 UTC error: error forwarding from client to backend: websocket: close 1006 (abnormal closure): unexpected EOF
2022-04-20 13:28:12 +0000 UTC warning: error while sending close message: write tcp [::1]:43999->[::1]:50562: use of closed network connection
2022-04-20 13:28:12 +0000 UTC info: State transition: update-install [ArtifactInstall] -> mender-update-control-refresh-maps [none]
2022-04-20 13:28:12 +0000 UTC info: Executing script: ArtifactInstall_Leave_80_bl-update
2022-04-20 13:28:15 +0000 UTC info: Output (stdout) from command "/var/lib/mender/scripts/ArtifactInstall_Leave_80_bl-update": Installing NVIDIA bootloader update payload
2022-04-20 13:28:15 +0000 UTC info: Output (stdout) from command "/var/lib/mender/scripts/ArtifactInstall_Leave_80_bl-update": Current boot slot: 0
  Processing bpmp-fw_b... [OK]
  Processing sce-fw_b... [OK]
  Processing cpu-bootloader_b... [OK]
  Processing spe-fw_b... [no update needed]
  Processing secure-os_b... [OK]
  Processing adsp-fw_b... [OK]
  Processing BMP_b... [OK]
  Processing mts-bootpack_b... [OK]
  Processing mts-preboot_b... [no update needed]
  Processing sc7_b... [OK]
  Processing bpmp-fw-dtb_b... [OK]
  Processing bootloader-dtb_b... [OK]
  Processing VER_b... [no update needed]
  Processing MB1_BCT_b... [no update needed]
  Processing kernel_b... [OK]
  Processing kernel-dtb_b... [OK]
  Processing mb2_b... [no update needed]
  Processing BCT... [offset=3584,no update needed]...[offset=16384,no update needed]...[offset=0,no update needed]...[OK]
  Processing mb1_b... [no update needed]
  Processing mb1... [no update needed]
Slot 1 marked as active for next boot
Successful bootloader update
2022-04-20 13:28:15 +0000 UTC info: Executing script: ArtifactInstall_Leave_99_UpdateStateFile
2022-04-20 13:29:11 +0000 UTC info: Daemon terminated with SIGTERM


  • mender-client: v3.0.0
  • board: Jetson TX2
  • OS: Yocto

Best Regards,