# Imx6ul Dart grub integration fw\_setenv intermittent error

**URL:** https://hub.mender.io/t/imx6ul-dart-grub-integration-fw-setenv-intermittent-error/5097
**Category:** General Discussions
**Tags:** grub, fw\_setenv
**Created:** [July 7, 2022, 3:43pm UTC](https://hub.mender.io/t/imx6ul-dart-grub-integration-fw-setenv-intermittent-error/5097 "2022-07-07T15:43:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![rlaybourn](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rlaybourn](https://hub.mender.io/u/rlaybourn)
#### Post date: [July 7, 2022, 3:43pm UTC](https://hub.mender.io/t/imx6ul-dart-grub-integration-fw-setenv-intermittent-error/5097/1 "2022-07-07T15:43:44Z")

</div>

Hi I am using a varicite Dart-6ul board according to the instructions in the board integrations section . It uses uboot grub integration. When doing file system upgrades occasionally everything runs fine until it trys to enable the new partition for boot. At this point i get an error  
“error: fw\_setenv returned failure: exit status 2  
2022-07-07 14:58:48 +0000 UTC error: transient error: exit status 2”  
This error is intermittent but with no particular pattern. I am using a commit\_enter script to check before committing and that script does have a 4 minute delay in it to allow the web server on the unit to start up before checking that it is responding ok. I dont know why this would be a problem but I suspect it might be as the delay used to be longer and with the longer delay the problem used to happen much more frequently.

---

<div class="post-metadata">

### Author: ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)
#### Post date: [July 8, 2022, 6:10am UTC](https://hub.mender.io/t/imx6ul-dart-grub-integration-fw-setenv-intermittent-error/5097/2 "2022-07-08T06:10:44Z")

</div>

In general exit status 2 refers to [not finding the environment location](https://github.com/mendersoftware/grub-mender-grubenv/blob/f39c2c7ec7c9c24aae0108a9b04a0e6e61a3e96b/fw_printenv#L104). The location is specified [here](https://github.com/mendersoftware/grub-mender-grubenv/blob/f39c2c7ec7c9c24aae0108a9b04a0e6e61a3e96b/fw_printenv#L30-L39). Are you sure the `/boot/efi` partition is mounted before the script runs?

The client service file has `data.mount` [here](https://github.com/mendersoftware/mender/blob/master/support/mender-client.service#L4) in order to ensure this for the data partition, but maybe `boot-efi.mount` should also be there?

---

<div class="post-metadata">

### Author: ![rlaybourn](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rlaybourn](https://hub.mender.io/u/rlaybourn)
#### Post date: [July 8, 2022, 9:20am UTC](https://hub.mender.io/t/imx6ul-dart-grub-integration-fw-setenv-intermittent-error/5097/3 "2022-07-08T09:20:52Z")

</div>

The intermittent nature of it would I guess support it being something like the the partition not having been mounted by that point although the by the time this happens the system has booted and been running for about 5 minutes so that would be a little surprising. I can try adding boot-efi.mount to the After clause and see. There is a part of our software which I have just discovered is calling fw\_printenv quite frequently so I am also wondering if that is ending up causing a problem with fw\_setenv in some unlucky cases

---

<div class="post-metadata">

### Author: ![rlaybourn](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rlaybourn](https://hub.mender.io/u/rlaybourn)
#### Post date: [July 11, 2022, 1:32pm UTC](https://hub.mender.io/t/imx6ul-dart-grub-integration-fw-setenv-intermittent-error/5097/4 "2022-07-11T13:32:39Z")

</div>

Just to complete this thread. I added the data.mount and boot-efi.mount to the after clause of the systemd service file. I also much reduced the rate at which the app polled the fw\_printenv program. These two things appear to have resolved the issue however I now have a different error appearing on some units.

Jul 11 12:19:36 netmaster mender[660]: time=“2022-07-11T12:19:36+01:00” level=error msg=“fw\_setenv returned failure: exit status 1”  
Jul 11 12:19:36 netmaster mender[660]: time=“2022-07-11T12:19:36+01:00” level=error msg=“Failed to probe the U-Boot environment for which separator to use. Got error: exit status 1”

Again this is intermittent and usually works with a retry
