# Mender\_boot\_part and upgrade\_available disappear from u-boot environment after artifact update

**URL:** https://hub.mender.io/t/mender-boot-part-and-upgrade-available-disappear-from-u-boot-environment-after-artifact-update/2452
**Category:** General Discussions
**Tags:** zeus, ts-4900
**Created:** [September 16, 2020, 12:54am UTC](https://hub.mender.io/t/mender-boot-part-and-upgrade-available-disappear-from-u-boot-environment-after-artifact-update/2452 "2020-09-16T00:54:00Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![mnorian](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mnorian/32/757_2.png) [@mnorian](https://hub.mender.io/u/mnorian)
#### Post date: [September 16, 2020, 12:54am UTC](https://hub.mender.io/t/mender-boot-part-and-upgrade-available-disappear-from-u-boot-environment-after-artifact-update/2452/1 "2020-09-16T00:54:00Z")

</div>

I have been struggling with this issue for a while, I would really appreciate the guidance.  
I am trying to integrate mender 2.3 with the board ts-4900, it has an older u-boot version 2014.10, after I deploy a new artifact, the deployment process will go all the way to 99%, then the board will fail to re-boot correctly. After checking the environment variables I found that the following two environment variables will disappear at the end of the update process ( mender\_boot\_part and upgrade\_available), and because of that the board will not be able to re-boot correctly at the end of the upgrade. I already checked that these two variables were there before the update process. any thoughts?

---

<div class="post-metadata">

### Author: ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)
#### Post date: [September 16, 2020, 7:01am UTC](https://hub.mender.io/t/mender-boot-part-and-upgrade-available-disappear-from-u-boot-environment-after-artifact-update/2452/2 "2020-09-16T07:01:20Z")

</div>

Probably something wrong with the integration of U-Boot or the configuration of the U-boot environment.

I would suggest you to run trough the following,

> **[Integration checklist | Mender documentation](https://docs.mender.io/system-updates-yocto-project/board-integration/bootloader-support/u-boot/integration-checklist)**

Which can help pin-point the issue.

---

<div class="post-metadata">

### Author: ![mnorian](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mnorian/32/757_2.png) [@mnorian](https://hub.mender.io/u/mnorian)
#### Post date: [September 16, 2020, 1:43pm UTC](https://hub.mender.io/t/mender-boot-part-and-upgrade-available-disappear-from-u-boot-environment-after-artifact-update/2452/3 "2020-09-16T13:43:00Z")

</div>

Thank you for the prompt response, ok, I will go through the checklist and let you know the result

---

<div class="post-metadata">

### Author: ![mnorian](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mnorian/32/757_2.png) [@mnorian](https://hub.mender.io/u/mnorian)
#### Post date: [September 18, 2020, 1:38pm UTC](https://hub.mender.io/t/mender-boot-part-and-upgrade-available-disappear-from-u-boot-environment-after-artifact-update/2452/4 "2020-09-18T13:38:01Z")

</div>

I have followed the Integration checklist, I could do all the steps with no issues. the only difference is that I will need to run the fw\_printenv and fw\_setenv as a sudo, if I don’t use sudo, I will get and error that said " Error opening lock file / _var_ / _lock_ / _fw\_printenv_ . _lock_" .  
I was able to track the issue to the following function " InstallUpdate()" in the file [https://github.com/mendersoftware/mender/tree/master/installer/](https://github.com/mendersoftware/mender/tree/master/installer/) dual\_rootfs\_device.go,  
after the execution of the following line of that function, the two variables mender\_boot\_part and upgrade\_available will disappear but not bootcount:  
err = d.WriteEnv(BootVars{“upgrade\_available”: “1”, “mender\_boot\_part”: inactivePartition, “mender\_boot\_part\_hex”: inactivePartitionHex, “bootcount”: “0”})  
I would appreciate any guidance that would bring me closer.

---

<div class="post-metadata">

### Author: ![dellgreen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dellgreen/32/85_2.png) [@dellgreen](https://hub.mender.io/u/dellgreen)
#### Post date: [September 18, 2020, 3:03pm UTC](https://hub.mender.io/t/mender-boot-part-and-upgrade-available-disappear-from-u-boot-environment-after-artifact-update/2452/5 "2020-09-18T15:03:17Z")

</div>

i would try writing and reading back the exact same variables i.e upgrade\_available, mender\_boot\_part, mender\_boot\_part\_hex manually and reboot to ensure that its not related to these in particular. Make sure you keep the latter two variables contain the same value when you change them

That should narrow it down to a uboot env issue or mender/uboot env issue  
It should be noted that it looks like the mender code is subtly using fw\_setenv in slightly different way than the checklist does. So you could also try testing the piping the key-value pairs to it to replicate what mender is doing.

Example:  
`echo "upgrade_available=1" | fw_setenv -s -`

---

<div class="post-metadata">

### Author: ![vhubert](https://avatars.discourse-cdn.com/v4/letter/v/3ab097/32.png) [@vhubert](https://hub.mender.io/u/vhubert)
#### Post date: [September 18, 2020, 3:18pm UTC](https://hub.mender.io/t/mender-boot-part-and-upgrade-available-disappear-from-u-boot-environment-after-artifact-update/2452/6 "2020-09-18T15:18:05Z")

</div>

I just encountered a similar issue when migrating from mender 1.7 to mender 2.2.

The commit “MEN-3684: Switch to fw\_setenv script syntax which libubootenv supports.” (5213de3916433dcd2d18a4495ecdf62b47124343) seems to have caused the issue by changing the syntax to set U-Boot env variables. It looks like some variants of fw-utils don’t support the `fw_setsenv var=value` syntax, thus leading to the variables being erased and the device not being able to boot after an update installation.

Updating the checklist in the doc might help to pinpoint the issue!

---

<div class="post-metadata">

### Author: ![dellgreen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dellgreen/32/85_2.png) [@dellgreen](https://hub.mender.io/u/dellgreen)
#### Post date: [September 18, 2020, 3:38pm UTC](https://hub.mender.io/t/mender-boot-part-and-upgrade-available-disappear-from-u-boot-environment-after-artifact-update/2452/7 "2020-09-18T15:38:23Z")

</div>

> **[\[MEN-3684\] Switch from u-boot-fw-utils-mender-auto-provided to libubootenv -...](https://tracker.mender.io/browse/MEN-3684)**

Can confirm my products are on older u-boot-fw-utils-mender-auto-provided package which doesn’t support the script option, but also using an older mender client prior to this change, is why i don’t see this issue myself yet.

---

<div class="post-metadata">

### Author: ![mnorian](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mnorian/32/757_2.png) [@mnorian](https://hub.mender.io/u/mnorian)
#### Post date: [September 23, 2020, 5:07pm UTC](https://hub.mender.io/t/mender-boot-part-and-upgrade-available-disappear-from-u-boot-environment-after-artifact-update/2452/8 "2020-09-23T17:07:00Z")

</div>

Thank you vhubert, yes that was the issue, I removed that commit and re-built mender locally and things worked, so as you stated fw\_setenv var=value will silently assign nothing to that variable and then that variable will disappear. the only way to assign env variables in my flavour of ubuntu is by doing fw\_setenv var value. with no equal sign.

---

<div class="post-metadata">

### Author: ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)
#### Post date: [September 25, 2020, 7:03am UTC](https://hub.mender.io/t/mender-boot-part-and-upgrade-available-disappear-from-u-boot-environment-after-artifact-update/2452/9 "2020-09-25T07:03:48Z")

</div>

Some additional information on this can be found here, [https://tracker.mender.io/browse/MEN-3970](https://tracker.mender.io/browse/MEN-3970)
