I tried to include a state script in an artifact with the name ArtifactInstall_Leave_00 with this command:
./single-file-artifact-gen -n ${ARTIFACT_NAME} -t ${DEVICE_TYPE} -d ${DEST_DIR} -o ${OUTPUT_PATH} ${FILE} – --script ${SCRIPT}
However, the file seems not to be included in the artifact. This is the error I get on the target:
‘ArtifactInstall_Leave_00’: -1 : fork/exec /var/lib/mender/scripts/ArtifactInstall_Leave_00: no such file or directory
According to the manual Artifact state scripts should be included in the generated artifact: State scripts | Mender documentation
But when I check the content of the artifact file, the state script is not included. I also tried to include the state script with the -f parameter which does indeed include the state script as payload but it’s still not working (since it probably does not put the state script to the above specified path).
What else do I need to specify to successfully include a state script file in an artifact?
Update: I now see that the script is actually correctly installed on the device in the following directory:
However, the script is somehow not executed as we can see in the error log:
2019-12-16 12:41:34 +0000 UTC error: transient error: error executing leave script for update-install state: error running leave state script(s) for ArtifactInstall state: statescript: error executing ‘ArtifactInstall_Leave_00’: -1 : fork/exec /var/lib/mender/scripts/ArtifactInstall_Leave_00: no such file or directory
Any idea why the script is not executed?
Solved: Found the problem. The script was actually correctly executed - but there was a problem INSIDE the script. So the error message was a bit misleading