Good day,
I’m making a demo with State Scripts together with the single-file Update Module, and I wanted to clarify something about how failures are handled.
Here’s what happens in my setup:
-
I create an Artifact with a dummy payload (
/etc/hostname
) and attach a State Script. -
The State Script
ArtifactInstall_Enter_10_run_move.sh
runs fine. Inside it I run a Python program (python3 1.move.py
) to control some hardware (a small robot car on Raspberry Pi), and the hardware reacts exactly as expected. -
Please note that this State Script runs at
ArtifactInstall_Enter
, before the Update Module installation logic itself is executed. -
After the State Script finishes, the Update Module fails due to missing payload metadata:
2025-09-01 11:09:58.516 +0000 UTC info: Running State Script: /var/lib/mender/scripts/ArtifactInstall_Enter_10_run_move.sh
2025-09-01 11:09:58.52 +0000 UTC info: Collected output (stderr) while running script: + cd /home/tqcs/picar-x/example
2025-09-01 11:09:58.521 +0000 UTC info: Collected output (stderr) while running script: + /usr/bin/python3 1.move.py
2025-09-01 11:10:10.005 +0000 UTC info: Update Module output (stderr): cat: /var/lib/mender/modules/v3/payloads/0000/tree/files/dest_dir{…}
2025-09-01 11:10:10.005 +0000 UTC info: Update Module output (stderr): : No such file or directory
2025-09-01 11:10:10.005 +0000 UTC error: Process returned non-zero exit status: ArtifactInstall: Process exited with status 1
2025-09-01 11:10:10.023 +0000 UTC info: Update Module output (stderr): cat: /var/lib/mender/modules/v3/payloads/0000/tree/files/filename{…}
2025-09-01 11:10:10.023 +0000 UTC info: Update Module output (stderr): : No such file or directory
2025-09-01 11:10:10.023 +0000 UTC error: Process returned non-zero exit status: ArtifactRollback: Process exited with status 1
2025-09-01 11:10:10.044 +0000 UTC info: Sending status update to server
In this case, the error was missing metadata in the Artifact, but the same would apply to other errors in the Update Module. I believe this should be clarified, and I made a pull request on docs: clarify State Script success + Update Module failure scenario by Hoonydony · Pull Request #2660 · mendersoftware/mender-docs · GitHub
- does this make sense to clarify in mender.docs?
- But I’m also wondering if this affects Mender’s “atomicity” because even rollback cannot retrieve the result of running state script before the Update Module. My hardware has already reacted after being triggered by the state script, and Mender indicated the deployment as failed.
Thanks,