# Yocto state-script fw\_printenv not found

**URL:** <https://hub.mender.io/t/yocto-state-script-fw-printenv-not-found/7291>\
**Category:** General Discussions\
**Tags:** yocto, state-scripts, raspberry-pi-5\
**Created:** [November 1, 2024, 4:36pm UTC](https://hub.mender.io/t/yocto-state-script-fw-printenv-not-found/7291 "2024-11-01T16:36:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidlekve](https://avatars.discourse-cdn.com/v4/letter/d/c4cdca/32.png) [@davidlekve](https://hub.mender.io/u/davidlekve)\
**Post date:** [November 1, 2024, 4:36pm UTC](https://hub.mender.io/t/yocto-state-script-fw-printenv-not-found/7291/1 "2024-11-01T16:36:04Z")

</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  
2024-11-01 16:29:05.988 +0000 UTC info: Deployment with ID 486f7cc5-d445-4a22-b71e-b446167910c6 started.  
2024-11-01 16:29:05.988 +0000 UTC info: Sending status update to server  
2024-11-01 16:29:06.627 +0000 UTC info: Installing artifact…  
2024-11-01 16:29:18.855 +0000 UTC info: Update Module output (stdout): ================ STATISTICS ================  
2024-11-01 16:29:18.855 +0000 UTC info: Update Module output (stdout): Blocks written: 0  
2024-11-01 16:29:18.855 +0000 UTC info: Update Module output (stdout): Blocks omitted: 376  
2024-11-01 16:29:18.855 +0000 UTC info: Update Module output (stdout): Bytes written: 0  
2024-11-01 16:29:18.855 +0000 UTC info: Update Module output (stdout): ============================================  
2024-11-01 16:29:18.866 +0000 UTC info: Running State Script: /etc/mender/scripts/Download\_Leave\_10  
2024-11-01 16:29:18.875 +0000 UTC info: Collected output (stderr) while running script: batterybrain\_v1.1: Running Download\_Leave\_10  
2024-11-01 16:29:18.876 +0000 UTC info: Collected output (stderr) while running script: fw\_printenv not found  
2024-11-01 16:29:18.876 +0000 UTC error: Received error: (NonZero exit code error: Received error code: 1) when running the State Script scripts DownloadLeave  
2024-11-01 16:29:18.893 +0000 UTC info: Sending status update to server

If I go into the directory /sbin the file fw\_printenv is there but if I am in home and do ls -l /sbin/fw\_printenv it returns that it cannot be found. Does anyone know what is going on here? Thank you for your help 😊

---

<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:** [November 4, 2024, 8:52am UTC](https://hub.mender.io/t/yocto-state-script-fw-printenv-not-found/7291/2 "2024-11-04T08:52:02Z")

</div>

Hi @davidlekve,

Maybe a couple more details?

- is the `/sbin/fw_printenv` binary executable? What is the output of `ls -alh fw_printenv` while you are in `/sbin`
- which OS is this? How did the Mender integration happen?
- can you drop the output of `mount`?
- does the root filesystem update work?

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![davidlekve](https://avatars.discourse-cdn.com/v4/letter/d/c4cdca/32.png) [@davidlekve](https://hub.mender.io/u/davidlekve)\
**Post date:** [November 4, 2024, 10:31am UTC](https://hub.mender.io/t/yocto-state-script-fw-printenv-not-found/7291/3 "2024-11-04T10:31:00Z")

</div>

I found out the problem. It never was in sbin, the binary just worked there because then i didnt write a path in front of it… 😑 `which fw_printenv` returns `/usr/bin/fw_printenv`.

A rookie mistake, but I think I was too locked in on that the binary should be in /sbin because of the [example](https://github.com/mendersoftware/mender/blob/master/examples/state-scripts/retain-ssh-keys/Download_Leave_01). Sorry to bother you @TheYoctoJester

Just to be sure, do you think there is any problem with changing the path to `/usr/bin/fw_printenv` or should I instead try to make the yocto project build/move the fw\_printenv file in `sbin`. I am building for the pi5.

---

<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:** [November 4, 2024, 10:46am UTC](https://hub.mender.io/t/yocto-state-script-fw-printenv-not-found/7291/4 "2024-11-04T10:46:27Z")

</div>

Hi @davidlekve,

Great thanks for pointing it out, we definitely should fix the example. Not a problem per se, but I think checking through `which` would be the best approach. Analogous example: [mender/support/modules/rootfs-image at 0fb14b44e131ab7186bb86fe486332d420821de5 · mendersoftware/mender · GitHub](https://github.com/mendersoftware/mender/blob/0fb14b44e131ab7186bb86fe486332d420821de5/support/modules/rootfs-image#L14C1-L18C3)

Greetz,  
Josef
