Originally from this post:
A custom update module supporting rollback and reboot for .deb packages does not reboot after rollback
A mender artifact containing some .deb packages could be installed succesfully. The reboot takes place and mender-client continues according to the state machine
An other mender artifact, containing a deb file, which always fails to install (for testing the rollback, returning -1 on postinst script) the rollback takes place as expected, but the reboot does not.
The statemachine switches directly to ArtifactFailure. (NeedsArtifactReboot="Automatic" or "Yes")
Logging the calls to the update module with its parameters shows, that in this case the module never gets called with the parameter NeedsArtifactReboot
The reason is that NeedsArtifactReboot is only called after ArtifactInstall in order to catch cases where the installation of a deb package triggered the need for a reboot. This information is then stored in the database. However, if this information is missing (signaling that ArtifactInstall never finished), it should also be called before ArtifactRollbackReboot.