How to suppress errors in update modules

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
Deployment log
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.

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.

1 Like

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!