After the reboot, while the new system is running, but before committing the artifact. You can see the state diagram here.
If it is included in the Artifact, then it is guaranteed to run (assuming there are no other errors causing a rollback before that). You can check this with mender-artifact read artifact-file.mender. Of course if you want to test it, you can write something to the data partition and check afterwards that it was done.
This is part of how Artifacts work, Mender has its own storage area for scripts inside the data partition, and will run them at the right moment during the install. Systemd is not involved at all, although Mender of course has to be running, and this usually happens with Systemd. But launching Mender using SYSV would not make a difference with regards to State Script execution.
Since I’m running in standalone and systemd in not involved, how will the script ArtifactCommit_Enter_00, that should be launched on the reboot, be launched ?
The artifact state scripts are not stored persistently in the filesystem. They are part of the artifact, processed during the OTA flow and then discarded.
DEBU[0000] Reading Mender configuration from file /var/lib/mender/mender.conf module=config
INFO[0000] Loaded configuration file: /var/lib/mender/mender.conf module=config
DEBU[0000] Reading Mender configuration from file /etc/mender/mender.conf module=config
INFO[0000] Loaded configuration file: /etc/mender/mender.conf module=config
WARN[0000] No server URL(s) specified in mender configuration. module=config
WARN[0000] Server entry 1 has no associated server URL. module=config
DEBU[0000] Merged configuration = &conf.MenderConfig{MenderConfigFromFile:conf.MenderConfigFromFile{ClientProtocol:"", ArtifactVerifyKey:"/var/lib/mender/public.pem", HttpsClient:struct { Certificate string; Key string; SkipVerify bool }{Certificate:"", Key:"", SkipVerify:false}, RootfsPartA:"/dev/mmcblk0p2", RootfsPartB:"/dev/mmcblk0p3", DeviceTypeFile:"/var/lib/mender/device_type", UpdatePollIntervalSeconds:0, InventoryPollIntervalSeconds:0, RetryPollIntervalSeconds:0, StateScriptTimeoutSeconds:0, StateScriptRetryTimeoutSeconds:0, StateScriptRetryIntervalSeconds:0, ModuleTimeoutSeconds:0, ServerCertificate:"", ServerURL:"", UpdateLogPath:"", TenantToken:"", Servers:[]client.MenderServer{client.MenderServer{ServerURL:""}}}, ModulesPath:"/usr/share/mender/modules/v3", ModulesWorkPath:"/var/lib/mender/modules/v3", ArtifactInfoFile:"/etc/mender/artifact_info", ArtifactScriptsPath:"/var/lib/mender/scripts", RootfsScriptsPath:"/etc/mender/scripts"} module=config
DEBU[0000] Have U-Boot variable: mender_check_saveenv_canary=1 module=bootenv
DEBU[0000] List of U-Boot variables:map[mender_check_saveenv_canary:1] module=bootenv
DEBU[0000] Have U-Boot variable: mender_saveenv_canary=1 module=bootenv
DEBU[0000] List of U-Boot variables:map[mender_saveenv_canary:1] module=bootenv
DEBU[0000] Have U-Boot variable: mender_boot_part=3 module=bootenv
DEBU[0000] List of U-Boot variables:map[mender_boot_part:3] module=bootenv
DEBU[0000] Setting active partition from mount candidate: /dev/mmcblk0p3 module=partitions
INFO[0000] Mender running on partition: /dev/mmcblk0p3 module=cli
DEBU[0000] I/O read error for entry mender-agent.pem: open /var/lib/mender/mender-agent.pem: no such file or directory module=dirstore
DEBU[0000] private key does not exist module=keystore
DEBU[0000] ModuleTimeoutSeconds not set. Defaulting to 14400 seconds module=modules
DEBU[0000] Have U-Boot variable: mender_check_saveenv_canary=1 module=bootenv
DEBU[0000] List of U-Boot variables:map[mender_check_saveenv_canary:1] module=bootenv
DEBU[0000] Have U-Boot variable: mender_saveenv_canary=1 module=bootenv
DEBU[0000] List of U-Boot variables:map[mender_saveenv_canary:1] module=bootenv
DEBU[0000] Have U-Boot variable: upgrade_available=1 module=bootenv
DEBU[0000] List of U-Boot variables:map[upgrade_available:1] module=bootenv
DEBU[0000] Read data from device manifest file: artifact_name=release-1.1.0 module=device
DEBU[0000] Current manifest data: release-1.1.0 module=device
Committing Artifact...
DEBU[0000] statescript: timeout for executing scripts is not defined; using default of 1h0m0s seconds module=executor
DEBU[0000] Have U-Boot variable: mender_check_saveenv_canary=1 module=bootenv
DEBU[0000] List of U-Boot variables:map[mender_check_saveenv_canary:1] module=bootenv
DEBU[0000] Have U-Boot variable: mender_saveenv_canary=1 module=bootenv
DEBU[0000] List of U-Boot variables:map[mender_saveenv_canary:1] module=bootenv
DEBU[0000] Have U-Boot variable: upgrade_available=1 module=bootenv
DEBU[0000] List of U-Boot variables:map[upgrade_available:1] module=bootenv
INFO[0000] Committing update module=dual_rootfs_device
DEBU[0000] Have U-Boot variable: mender_check_saveenv_canary=1 module=bootenv
DEBU[0000] List of U-Boot variables:map[mender_check_saveenv_canary:1] module=bootenv
DEBU[0000] Have U-Boot variable: mender_saveenv_canary=1 module=bootenv
DEBU[0000] List of U-Boot variables:map[mender_saveenv_canary:1] module=bootenv
DEBU[0000] statescript: timeout for executing scripts is not defined; using default of 1h0m0s seconds module=executor
The script was found during installation:
INFO[0000] installer: authenticated digital signature of artifact module=installer
DEBU[0000] checking if device [raspberrypi3] is on compatible device list: [raspberrypi3]
module=installer
DEBU[0000] installer: processing script: ArtifactCommit_Enter_00.sh module=installer
DEBU[0000] installer: successfully read artifact [name: rpi3-release-1.1.0.mender; version: 3; compatible devices: [raspberrypi3]] module=installer
Hm, do not see it trying to execute the script in mender -commit.
Is /var/lib/mender a persistent location in you case? Because the script should have been unpacked there (I think under `/var/lib/mende/scripts) during the install state, and later executed during commit. So please verify that it is there and that this area is a persistent area.
In fact the file is unpacked to /var/lib/mender/scripts. However, due to an unknown reason, this directory is not linked anymore with /data/mender. Could it be because I use the rootfs_overlay of mender_convert to add the public key, device_type and client.conf files on /var/lib/mender ?