# How to suppress errors in update modules

**URL:** <https://hub.mender.io/t/how-to-suppress-errors-in-update-modules/5991>\
**Category:** Update Modules\
**Tags:** buildroot, radxa-zero\
**Created:** [July 7, 2023, 2:31pm UTC](https://hub.mender.io/t/how-to-suppress-errors-in-update-modules/5991 "2023-07-07T14:31:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mister\_kanister](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mister\_kanister](https://hub.mender.io/u/mister_kanister)\
**Post date:** [July 7, 2023, 2:31pm UTC](https://hub.mender.io/t/how-to-suppress-errors-in-update-modules/5991/1 "2023-07-07T14:31:09Z")

</div>

Good Day Friends!

Due to the choise of hardware I’m forced to write an update module to make system updates. I was not able to integrate Mender with U-Boot. I managed to handle this but some commands in my update module always return non-zero codes even if the operation ended as expected or what I would consider successful.

My update module is receiving and rooftfs.ext4. This will be written to rootfsB with `dd`. After that the rootfsB filesystem will be resized with `resize2fs`. For this successful to happen, `e2fsck $target_partition -f -y` needs to be executed.

In my special case its the `e2fsck $target_partition -f -y || true`. This commands somehow return always non-zero code and the stage `ArtifactInstall` fails.

**How can I deal with this behaviour? How can I suppress such errors or make an exception?**

[Update module](https://pastebin.com/NTjgaCE6)  
[Deployment log](https://pastebin.com/hjEP6ZXL)  
k  
PS:  
One thing is that the eMMC is randomly switching between `/dev/mmcblk1` and `/dev/mmcblk0`  
U-Boot env is on the data partition /mnt/uboot.env. `bootcount` and `altboot` are triggered as expected.

---

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [July 31, 2023, 7:33am UTC](https://hub.mender.io/t/how-to-suppress-errors-in-update-modules/5991/2 "2023-07-31T07:33:58Z")

</div>

Hi @mister_kanister,

As far as I know, if you are not setting `set -e` in your script, it won’t exit on errors and Mender client should basically ignore any error happening there as long as the the script does `exit 0` at the end.

I don’t know what the problem you are having actually is. However,

One thing that is suspicious is that you are using `reboot` command from `ArtifactInstall` state, which messes up with the client state machine - the client will interpret that as an spontaneous reboot of the device. Instead you should use the option `NeedsArtifactReboot` and let the client do the reboot on the correct state (the `ArtifactReboot` state). See the documentation [here](https://github.com/mendersoftware/mender/blob/master/Documentation/update-modules-v3-file-api.md#artifactreboot-state).

---

<div class="post-metadata">

**Author:** ![mister\_kanister](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mister\_kanister](https://hub.mender.io/u/mister_kanister)\
**Post date:** [July 31, 2023, 7:39am UTC](https://hub.mender.io/t/how-to-suppress-errors-in-update-modules/5991/3 "2023-07-31T07:39:28Z")

</div>

Thanks for the additional info and documentation. These parts about `NeedsArtifactReboot` was crucial for me and I have not found this information in the official documentation for Mender 3.5

Thanks!
