# Trigger reboot after artifact install

**URL:** <https://hub.mender.io/t/trigger-reboot-after-artifact-install/7755>\
**Category:** General Discussions\
**Created:** [May 7, 2025, 6:57am UTC](https://hub.mender.io/t/trigger-reboot-after-artifact-install/7755 "2025-05-07T06:57:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![craige](https://avatars.discourse-cdn.com/v4/letter/c/b782af/32.png) [@craige](https://hub.mender.io/u/craige)\
**Post date:** [May 7, 2025, 6:57am UTC](https://hub.mender.io/t/trigger-reboot-after-artifact-install/7755/1 "2025-05-07T06:57:35Z")

</div>

I have created an artifact for my device using the `directory-artifact-gen` script, which I have modified slightly to allow me to pass through the `--script` parameter to `mender-artifact` for my `ArtifactInstall_Leave_01` script. This script just copies some files around, unzips a .deb, and replaces some executables for my application.

However, this install process requires an OS reboot after completion. I can’t include a `reboot` command in my script because this interrupts the mender process resulting in a reported deployment failure.

I notice there is a state named “ArtifactReboot”, but as far as I can tell my device doesn’t go to this, but more likely reaches “ArtifactCommit” then returns to idle. I assume this Reboot state is used only for RootFS updates.

**How do I ensure my device reboots after an artifact install without interrupting the mender update process?**

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [May 7, 2025, 7:14am UTC](https://hub.mender.io/t/trigger-reboot-after-artifact-install/7755/2 "2025-05-07T07:14:54Z")

</div>

Hi @craige,

Thanks for reaching out! The straightforward way is to make a customized version of the `directory` Update Module, and add the following “state”:

```auto
    NeedsArtifactReboot)
        echo "Automatic"
        ;;

```

See also the example Update Module: [mender-update-modules/reboot/module/reboot at d8c4683e6660af6c65069e10ee4b8ee50ec1af46 · mendersoftware/mender-update-modules · GitHub](https://github.com/mendersoftware/mender-update-modules/blob/d8c4683e6660af6c65069e10ee4b8ee50ec1af46/reboot/module/reboot#L9)

This will reboot the device after successful installation of the artifact. Besides that you can keep the Update Module and the generator script as they are, just make sure to pick a new unique name, like `directory-reboot` for the Update Module script file on the device, and the generator script to use as the type.

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![craige](https://avatars.discourse-cdn.com/v4/letter/c/b782af/32.png) [@craige](https://hub.mender.io/u/craige)\
**Post date:** [May 7, 2025, 7:43am UTC](https://hub.mender.io/t/trigger-reboot-after-artifact-install/7755/3 "2025-05-07T07:43:12Z")

</div>

Thank you Josef, I’ll try that.

I’ve renamed my ‘directory’ script to ‘directory-reboot’, added that state, and updated my ‘directory-artifact-gen -T’ to point to the ‘directory-reboot’ script. Fingers crossed!

---

<div class="post-metadata">

**Author:** ![craige](https://avatars.discourse-cdn.com/v4/letter/c/b782af/32.png) [@craige](https://hub.mender.io/u/craige)\
**Post date:** [May 7, 2025, 7:58am UTC](https://hub.mender.io/t/trigger-reboot-after-artifact-install/7755/4 "2025-05-07T07:58:57Z")

</div>

I’ve just realised you mentioned I would need to update this on the client. I have to perform this update on hundreds of devices, so presumably the new ‘directory-reboot’ script would have to form part of the artifact itself?

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [May 7, 2025, 8:01am UTC](https://hub.mender.io/t/trigger-reboot-after-artifact-install/7755/5 "2025-05-07T08:01:01Z")

</div>

Hi @craige,

Yes and no. You can use the approach explained at [How to install a new Update Module](https://hub.mender.io/t/how-to-install-a-new-update-module/6630) to streamline the process.

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![craige](https://avatars.discourse-cdn.com/v4/letter/c/b782af/32.png) [@craige](https://hub.mender.io/u/craige)\
**Post date:** [May 9, 2025, 8:01am UTC](https://hub.mender.io/t/trigger-reboot-after-artifact-install/7755/6 "2025-05-09T08:01:33Z")

</div>

Is there a way to include 2 artifacts in one release?  
Obviously my preference would be to make one deployment which would first do a single-file update, and then execute the second artifact installation which would use the ‘directory-reboot’ script installed in the first.

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [May 9, 2025, 6:29pm UTC](https://hub.mender.io/t/trigger-reboot-after-artifact-install/7755/7 "2025-05-09T18:29:46Z")

</div>

Hi @craige,

Sorry no, the multiple artifact bundling scenario is currently not supported.

Greetz,  
Josef
