Hello everyone,
I am trying to implement an update that completes its installation but waits for a manual power cycle to reboot and commit the new image. I have found two possible methods but see some conflicting information and would appreciate some clarification.
State Script Approach
The documentation for state scripts suggests this is possible. It contains a tip that stalling in the ArtifactReboot_Enter
state script will wait for a power cycle without failing the update.
Tip: Since a power loss in ArtifactReboot_Enter will not be marked as a failure, this enables the user to stall the daemon in ArtifactReboot_Enter state forever, and thus an install will only be installed on a power cycle of the device.
My plan was to use an ArtifactReboot_Enter
script with a simple infinite loop, like this:
#!/bin/sh
while true; do
sleep 3600
done
exit 0
However, another forum post indicates this will not work as intended. It says the Mender client will eventually time out the script, to prevent loops bricking the device. I think this timeout is set by the StateScriptTimeoutSeconds parameter, which defaults to one hour. This seems to contradict the documentation’s tip about stalling “forever”.
Could you clarify if the script timeout will indeed prevent this approach from working? Is the documentation tip perhaps outdated or applicable only in specific configurations?
Update Control Framework Approach
The same forum post suggested using the DBus API and the Update Control framework as an alternative to pause the update flow indefinitely. The documentation points to a Python example for this.
My main concern here is that the GitHub repository containing this example (mender-client-python-example
) is archived. This makes me unsure if this is still a relevant or recommended solution.
Is using the DBus API still the correct way to achieve an indefinite pause? If so, are there any current examples or documentation available that I should be looking at?
Question: What is the current best practice for having a Mender update wait indefinitely for a user to power cycle the device before it reboots? Should I be using the state script method, and if so, how do I correctly configure it to avoid a timeout? Or is the DBus API the recommended path?
Thank you for your help!