# \#state-scripts

**URL:** https://hub.mender.io/tag/state-scripts/78.md

[Latest](https://hub.mender.io/latest.md) · [Categories](https://hub.mender.io/categories.md) · [Tags](https://hub.mender.io/tags.md)

---

## [State scripts not running in Debian](https://hub.mender.io/t/state-scripts-not-running-in-debian/8268)

<div class="topic-metadata">

**Author:** [@Michiel](https://hub.mender.io/u/Michiel)\
**Replies:** 2\
**Last updated:** [May 18, 2026, 6:04am UTC](https://hub.mender.io/t/state-scripts-not-running-in-debian/8268 "2026-05-18T06:04:12Z")

</div>

I’m fairly new to Mender and I’m trying out state scripts. As a tryout, I created two state scripts, names Idle\_Enter and Idle\_Leave in /etc/mender/scripts/. The scripts are very simple: #!/bin/sh touch /var/lib/mender…

---

## [How to pause an update indefinitely for a power cycle: State Script vs DBus?](https://hub.mender.io/t/how-to-pause-an-update-indefinitely-for-a-power-cycle-state-script-vs-dbus/7979)

<div class="topic-metadata">

**Author:** [@Trab40](https://hub.mender.io/u/Trab40)\
**Replies:** 2\
**Last updated:** [September 4, 2025, 9:21am UTC](https://hub.mender.io/t/how-to-pause-an-update-indefinitely-for-a-power-cycle-state-script-vs-dbus/7979 "2025-09-04T09:21:13Z")

</div>

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 inform…

---

## [State-Scripts seem to be broken on Scarthgap](https://hub.mender.io/t/state-scripts-seem-to-be-broken-on-scarthgap/7777)

<div class="topic-metadata">

**Author:** [@HunterR\_PP](https://hub.mender.io/u/HunterR_PP)\
**Replies:** 3\
**Last updated:** [May 22, 2025, 4:15pm UTC](https://hub.mender.io/t/state-scripts-seem-to-be-broken-on-scarthgap/7777 "2025-05-22T16:15:35Z")

</div>

Recently, I updated my Yocto project from Dunfell to Scarthgap. In so doing, we had to modify and change some of the device-trees and some U-Boot build configurations. This requires the use of a post-install state script…

---

## [State scrips cleanup in Yocto](https://hub.mender.io/t/state-scrips-cleanup-in-yocto/7449)

<div class="topic-metadata">

**Author:** [@filcopetti](https://hub.mender.io/u/filcopetti)\
**Replies:** 3\
**Last updated:** [January 14, 2025, 8:29am UTC](https://hub.mender.io/t/state-scrips-cleanup-in-yocto/7449 "2025-01-14T08:29:55Z")

</div>

Hi, I’m developing yocto images. I need to run some state scripts based on the customer, so on some images mender needs to run script ArtifactInstall\_Leave\_11 while in some images it needs to run script ArtifactInstall…

---

## [Yocto state-script fw\_printenv not found](https://hub.mender.io/t/yocto-state-script-fw-printenv-not-found/7291)

<div class="topic-metadata">

**Author:** [@davidlekve](https://hub.mender.io/u/davidlekve)\
**Replies:** 3\
**Last updated:** [November 4, 2024, 10:46am UTC](https://hub.mender.io/t/yocto-state-script-fw-printenv-not-found/7291 "2024-11-04T10:46:27Z")

</div>

My statescript start with the following if \[ ! -x /sbin/fw\_printenv \]; then echo “printenv not found” \>&2 exit 1 fi And I get this from my log: 2024-11-01 16:29:05.988 +0000 UTC info: Running Mender client 4.0.4 2…

---

## [ArtifactInstall\_leave script is not executed (no such file or directory)](https://hub.mender.io/t/artifactinstall-leave-script-is-not-executed-no-such-file-or-directory/7252)

<div class="topic-metadata">

**Author:** [@erezst](https://hub.mender.io/u/erezst)\
**Replies:** 2\
**Last updated:** [October 21, 2024, 8:17am UTC](https://hub.mender.io/t/artifactinstall-leave-script-is-not-executed-no-such-file-or-directory/7252 "2024-10-21T08:17:00Z")

</div>

Hello community - I’m building a mender artifact as follows: mender-artifact write rootfs-image -f release.ext4 -n "v1.0" -o "v1.0.mender" -t dm1 -script ArtifactInstall\_Leave\_00 -script ArtifactInstall\_Enter\_10 But w…

---

## [Artifact dependency not satisfied does run Download\_Error state scripts](https://hub.mender.io/t/artifact-dependency-not-satisfied-does-run-download-error-state-scripts/6304)

<div class="topic-metadata">

**Author:** [@pseyfert](https://hub.mender.io/u/pseyfert)\
**Replies:** 5\
**Last updated:** [February 7, 2024, 12:26pm UTC](https://hub.mender.io/t/artifact-dependency-not-satisfied-does-run-download-error-state-scripts/6304 "2024-02-07T12:26:35Z")

</div>

Hi I’m working with three state scripts. Download\_Enter\_…, Download\_Error\_… and Download\_Leave… to ensure that upgrade processes and software running on the device don’t interfere with each other. (e.g. download enter:…

---

## [Retrieving artifact version in state script](https://hub.mender.io/t/retrieving-artifact-version-in-state-script/6461)

<div class="topic-metadata">

**Author:** [@I\_Iob](https://hub.mender.io/u/I_Iob)\
**Replies:** 1\
**Last updated:** [January 12, 2024, 12:52pm UTC](https://hub.mender.io/t/retrieving-artifact-version-in-state-script/6461 "2024-01-12T12:52:23Z")

</div>

I should implement a user confirmation before installing an update; the confirmation procedure should be different when the update is a just a bug fix or feature changes. In order to decide which procedure to adopt, the …

---

## [Determine update type in state script](https://hub.mender.io/t/determine-update-type-in-state-script/6431)

<div class="topic-metadata">

**Author:** [@zivkapl](https://hub.mender.io/u/zivkapl)\
**Replies:** 5\
**Last updated:** [January 11, 2024, 2:42pm UTC](https://hub.mender.io/t/determine-update-type-in-state-script/6431 "2024-01-11T14:42:16Z")

</div>

Hi, I need to have the state scripts do 2 different things when its an app update vs rootfs update. How can I get that info (meaning - which artifact type is it) from inside the state script? thanks

---

## [Pass Arguments to the state scripts](https://hub.mender.io/t/pass-arguments-to-the-state-scripts/6448)

<div class="topic-metadata">

**Author:** [@zivkapl](https://hub.mender.io/u/zivkapl)\
**Replies:** 1\
**Last updated:** [January 9, 2024, 3:35pm UTC](https://hub.mender.io/t/pass-arguments-to-the-state-scripts/6448 "2024-01-09T15:35:22Z")

</div>

Hi, Is it possible to pass parameters to the state scripts? Are “$FILES” accessible from it? I image a state script the does a pre check to the installation. For exmaple, assert the installed OpenSSL version, but I wa…

---

## [State script on app/container updates](https://hub.mender.io/t/state-script-on-app-container-updates/6430)

<div class="topic-metadata">

**Author:** [@zivkapl](https://hub.mender.io/u/zivkapl)\
**Replies:** 1\
**Last updated:** [December 26, 2023, 9:19pm UTC](https://hub.mender.io/t/state-script-on-app-container-updates/6430 "2023-12-26T21:19:13Z")

</div>

Hi, I understand the concept and use of the state script. However, the documentation is not clear as if it is only applied for rootfs stile update, or can it be used for lighter updates such as container or app updates…

---

## [Additional behaviour in ArtifactDownload state](https://hub.mender.io/t/additional-behaviour-in-artifactdownload-state/6342)

<div class="topic-metadata">

**Author:** [@mister\_kanister](https://hub.mender.io/u/mister_kanister)\
**Replies:** 0\
**Last updated:** [November 16, 2023, 10:24am UTC](https://hub.mender.io/t/additional-behaviour-in-artifactdownload-state/6342 "2023-11-16T10:24:30Z")

</div>

Good Day Friends! I was wondering if its is possible to implement some custom logic in other states. In my update module with something like: case "$STATE" in ArtifactDownload\_Enter) touch /root/downloading\_enter …

---

## [Adding state scripts to an existing snapshot artifact](https://hub.mender.io/t/adding-state-scripts-to-an-existing-snapshot-artifact/6188)

<div class="topic-metadata">

**Author:** [@pyxlwuff](https://hub.mender.io/u/pyxlwuff)\
**Replies:** 0\
**Last updated:** [September 7, 2023, 12:16pm UTC](https://hub.mender.io/t/adding-state-scripts-to-an-existing-snapshot-artifact/6188 "2023-09-07T12:16:17Z")

</div>

Hi there, I have an image created through mender-artifact write rootfs-image directly from a golden Raspberry Pi 4 device running Bullseye. This automatically creates a .mender artifact that I can then deploy to the men…

---

## [How to create artifact using management APIs with state scripts](https://hub.mender.io/t/how-to-create-artifact-using-management-apis-with-state-scripts/5993)

<div class="topic-metadata">

**Author:** [@nareshtech20](https://hub.mender.io/u/nareshtech20)\
**Replies:** 4\
**Last updated:** [July 11, 2023, 7:04am UTC](https://hub.mender.io/t/how-to-create-artifact-using-management-apis-with-state-scripts/5993 "2023-07-11T07:04:34Z")

</div>

How to create artifact using management APIs with state scripts ? Don’t see any option to include state script in following API, https://hosted.mender.io/api/management/v1/deployments/artifacts/generate Regards, Nare…

---

## [ArtifactInstall and ArtifactCommit state scripts are not getting executed, only Download script is executing](https://hub.mender.io/t/artifactinstall-and-artifactcommit-state-scripts-are-not-getting-executed-only-download-script-is-executing/5985)

<div class="topic-metadata">

**Author:** [@nareshtech20](https://hub.mender.io/u/nareshtech20)\
**Replies:** 2\
**Last updated:** [July 7, 2023, 5:10pm UTC](https://hub.mender.io/t/artifactinstall-and-artifactcommit-state-scripts-are-not-getting-executed-only-download-script-is-executing/5985 "2023-07-07T17:10:51Z")

</div>

ArtifactInstall and ArtifactCommit state scripts are not getting executed, only Download scripts are executing, any reason ? Tried single, multiple artifacts and update custom module installation, all deployments are s…

---

## [Device-side control of update: delaying, pausing, rescheduling](https://hub.mender.io/t/device-side-control-of-update-delaying-pausing-rescheduling/5987)

<div class="topic-metadata">

**Author:** [@nareshtech20](https://hub.mender.io/u/nareshtech20)\
**Replies:** 6\
**Last updated:** [July 7, 2023, 11:27am UTC](https://hub.mender.io/t/device-side-control-of-update-delaying-pausing-rescheduling/5987 "2023-07-07T11:27:20Z")

</div>

How to increase update-control-map expiry time ?

---

## [Sync\_Error script not called for unauthorized device](https://hub.mender.io/t/sync-error-script-not-called-for-unauthorized-device/5722)

<div class="topic-metadata">

**Author:** [@Rhen](https://hub.mender.io/u/Rhen)\
**Replies:** 1\
**Last updated:** [May 16, 2023, 8:33am UTC](https://hub.mender.io/t/sync-error-script-not-called-for-unauthorized-device/5722 "2023-05-16T08:33:38Z")

</div>

Hi there, in our project we would like to track the outcome of the sync state. We noticed, that for an unauthorized device, the Sync\_Error\_XX scripts are not called. Is this intended? The failed authorization attempt…

---

## [State script returning exit status 1 leads to retry loop instead of abort](https://hub.mender.io/t/state-script-returning-exit-status-1-leads-to-retry-loop-instead-of-abort/5624)

<div class="topic-metadata">

**Author:** [@pseyfert](https://hub.mender.io/u/pseyfert)\
**Replies:** 7\
**Last updated:** [April 9, 2023, 4:57pm UTC](https://hub.mender.io/t/state-script-returning-exit-status-1-leads-to-retry-loop-instead-of-abort/5624 "2023-04-09T16:57:55Z")

</div>

Hi, I’m working on a state script (Download\_Enter in my case) that shall (depending on stuff) return 0, 1, or 21, depending on if i want the upgrade to go on, abort, or delay until later (following the docs here). I mo…

---

## [Alter files in the new filesystem before reboot](https://hub.mender.io/t/alter-files-in-the-new-filesystem-before-reboot/5584)

<div class="topic-metadata">

**Author:** [@adriannawenz](https://hub.mender.io/u/adriannawenz)\
**Replies:** 2\
**Last updated:** [February 6, 2023, 6:14am UTC](https://hub.mender.io/t/alter-files-in-the-new-filesystem-before-reboot/5584 "2023-02-06T06:14:02Z")

</div>

I want to symlink certain files from the new artifact to a /data partition before rebooting. Is this possible to do in the ArtifactInstall\_Leave? I believe ArtifactInstall\_Leave occurs in the old file system. Is there a …

---

## [Aborting a deployment purposely stalled in the ArtifactReboot\_Enter state](https://hub.mender.io/t/aborting-a-deployment-purposely-stalled-in-the-artifactreboot-enter-state/5009)

<div class="topic-metadata">

**Author:** [@kadler](https://hub.mender.io/u/kadler)\
**Replies:** 3\
**Last updated:** [June 14, 2022, 7:04am UTC](https://hub.mender.io/t/aborting-a-deployment-purposely-stalled-in-the-artifactreboot-enter-state/5009 "2022-06-14T07:04:32Z")

</div>

Hi all, I’m looking to delay rootfs updates until the user power cycles their device. My approach is based on the Power loss section of the state scripts documentation. Tip: Since a power loss in ArtifactReboot\_Enter …

---

## [ArtifactInstall\_Enter strange workflow behavior](https://hub.mender.io/t/artifactinstall-enter-strange-workflow-behavior/5004)

<div class="topic-metadata">

**Author:** [@Gilles](https://hub.mender.io/u/Gilles)\
**Replies:** 3\
**Last updated:** [June 7, 2022, 7:54am UTC](https://hub.mender.io/t/artifactinstall-enter-strange-workflow-behavior/5004 "2022-06-07T07:54:37Z")

</div>

Hi, I’m working for a customer for whom I set up Mender (Yocto). We use it in stand-alone mode, as the target is in a specific industrial environment, where we want to control the update workflow. One of our problems t…

---

## [Update stuck in 'rebooting' state on hosted mender](https://hub.mender.io/t/update-stuck-in-rebooting-state-on-hosted-mender/4915)

<div class="topic-metadata">

**Author:** [@perceval](https://hub.mender.io/u/perceval)\
**Replies:** 3\
**Last updated:** [May 3, 2022, 10:33am UTC](https://hub.mender.io/t/update-stuck-in-rebooting-state-on-hosted-mender/4915 "2022-05-03T10:33:39Z")

</div>

Hello all :smiley: I tryed to add a state script to my Jetson TX2. Once I updated my device through hosted.mender the device reboot correctly and the update is installed but the device state on hosted mender is stuck at…

---

## [Test and debug state scripts](https://hub.mender.io/t/test-and-debug-state-scripts/4677)

<div class="topic-metadata">

**Author:** [@dimant](https://hub.mender.io/u/dimant)\
**Replies:** 1\
**Last updated:** [February 22, 2022, 9:09pm UTC](https://hub.mender.io/t/test-and-debug-state-scripts/4677 "2022-02-22T21:09:49Z")

</div>

Hi all, i’m using mender in standalone mode ,is possible to “manually” run the state scripts via mender client cli?? … i need to debug the scripts without restart the entire update process every time. Thanks in advance

---

## [State scripts and user input from terminal](https://hub.mender.io/t/state-scripts-and-user-input-from-terminal/4669)

<div class="topic-metadata">

**Author:** [@karamanr](https://hub.mender.io/u/karamanr)\
**Replies:** 3\
**Last updated:** [February 22, 2022, 8:29pm UTC](https://hub.mender.io/t/state-scripts-and-user-input-from-terminal/4669 "2022-02-22T20:29:36Z")

</div>

Hi, I’ve been testing a Download\_Leave state script that’s supposed to take input from the terminal, however when it’s called with Mender it doesn’t work as intended. The script works fine when executed from terminal, b…

---

## [State-scripts documentation: how to use them without Yocto](https://hub.mender.io/t/state-scripts-documentation-how-to-use-them-without-yocto/744)

<div class="topic-metadata">

**Author:** [@ster](https://hub.mender.io/u/ster)\
**Replies:** 27\
**Last updated:** [February 8, 2022, 2:29pm UTC](https://hub.mender.io/t/state-scripts-documentation-how-to-use-them-without-yocto/744 "2022-02-08T14:29:04Z")

</div>

The documentation doesn’t really help to understand how to implement and include state scripts. Question I have (and probably other newcomers will): can state scripts be included in artifacts or they are a part of Me…

---

## [State script clarifications](https://hub.mender.io/t/state-script-clarifications/4369)

<div class="topic-metadata">

**Author:** [@dimaxano](https://hub.mender.io/u/dimaxano)\
**Replies:** 6\
**Last updated:** [December 2, 2021, 1:54pm UTC](https://hub.mender.io/t/state-script-clarifications/4369 "2021-12-02T13:54:01Z")

</div>

Hi! After reading State Scripts section in docs I’m still unclear about its behavior. Is there difference where to put state-scripts: /etc/mender/scripts or /data/mender/scripts? If I want to run an ArtifactInstall\_En…

---

## [Download State Timeout does not report as failure](https://hub.mender.io/t/download-state-timeout-does-not-report-as-failure/4021)

<div class="topic-metadata">

**Author:** [@SegFault](https://hub.mender.io/u/SegFault)\
**Replies:** 1\
**Last updated:** [August 20, 2021, 5:35am UTC](https://hub.mender.io/t/download-state-timeout-does-not-report-as-failure/4021 "2021-08-20T05:35:17Z")

</div>

Board: imx8-som running Yocto Dunfell deployment Mender Version: 2.5.1 Exhibited Behavior: We are running an update procedure that has a Download\_Enter state script being called. This state script has a retry ability t…

---

## [Standalone State Scripts not executed](https://hub.mender.io/t/standalone-state-scripts-not-executed/3965)

<div class="topic-metadata">

**Author:** [@jabas](https://hub.mender.io/u/jabas)\
**Replies:** 3\
**Last updated:** [August 5, 2021, 9:13am UTC](https://hub.mender.io/t/standalone-state-scripts-not-executed/3965 "2021-08-05T09:13:59Z")

</div>

Hi, I’m running Mender standalone client 1.6.0. I have built an artifact with state scripts using Yocto (Sumo). Both 1.4.0 and 1.6.0 produce the same result. If I look inside the artifact, they are indeed included. Fo…

---

## [Web UI deployment status progress bar keeps advancing even if state script exited with 1](https://hub.mender.io/t/web-ui-deployment-status-progress-bar-keeps-advancing-even-if-state-script-exited-with-1/3450)

<div class="topic-metadata">

**Author:** [@andrea.nencini](https://hub.mender.io/u/andrea.nencini)\
**Replies:** 1\
**Last updated:** [April 1, 2021, 8:01am UTC](https://hub.mender.io/t/web-ui-deployment-status-progress-bar-keeps-advancing-even-if-state-script-exited-with-1/3450 "2021-04-01T08:01:27Z")

</div>

Hi guys. I wrote a state script associated with the Sync Leave state, that alternatively exits with RC 0 or RC 1 based on a certain condition. My idea is to allow or block the update process through this script. As you …

---

## [Updating passive rootfs partitions in script and directory updates](https://hub.mender.io/t/updating-passive-rootfs-partitions-in-script-and-directory-updates/3422)

<div class="topic-metadata">

**Author:** [@arpit.ts](https://hub.mender.io/u/arpit.ts)\
**Replies:** 1\
**Last updated:** [March 23, 2021, 5:49pm UTC](https://hub.mender.io/t/updating-passive-rootfs-partitions-in-script-and-directory-updates/3422 "2021-03-23T17:49:44Z")

</div>

Hi I made a simple script artifact using mender-artifact write module-image -T script ... and a single script file test.sh. All the script does is create a /home/pi/test-file file and does nothing else. After deploying …

[Next page](https://hub.mender.io/tag/state-scripts/78.md?match_all_tags=true&page=1&tags%5B%5D=state-scripts)
