Pi Partitions Questions

Hello,

I’m working on a Pi project and doing a PoC of Hosted Mender (Raspian Stretch + Pi3b). I had a few questions come up and I’m hoping to see if someone can help with the answers.

  1. Factory reset approach - Can a command be triggered from the device (maybe an API call), that triggers a new deployment for it? The idea would be a going back to a good/golden image to start over what’s running on the device. Pushing out a new deployment of a golden image, withhout having to go in through the web console manually?

  2. Force booting to the the non-active partition - Is there something I can do to tell the Pi device to run the image that is on partition #2 (the current non-active partition)? This would be essentially a manual rollback. Both images on partition are OK, but customer wanted to back to previous version they had running.

Thanks!

Factory reset approach - Can a command be triggered from the device (maybe an API call), that triggers a new deployment for it? The idea would be a going back to a good/golden image to start over what’s running on the device. Pushing out a new deployment of a golden image, withhout having to go in through the web console manually?

You can do standalone deployments, which do not involve the server,

https://docs.mender.io/2.0/architecture/standalone-deployments

But then you still need to provide the image somehow, either from USB or if you store a “recovery” image on the device, e.g on the persistent partition.

Force booting to the the non-active partition - Is there something I can do to tell the Pi device to run the image that is on partition #2 (the current non-active partition)? This would be essentially a manual rollback. Both images on partition are OK, but customer wanted to back to previous version they had running.

You can do the following to force a partition swap (replace 2 with 3 for #2 partition):

fw_setenv mender_boot_part 2
fw_setenv mender_boot_part_hex 2
fw_setenv upgrade_available 1
fw_setenv bootcount 0

You will also need to run mender -commit to confirm the change.

But this assumes that both partitions are in a known state, and this is not always true with the inactive partition unless you always restore it to something known. You could have an uncompleted update on the active part, e.g due to a power loss and unless you do not restore it it will be broken.

Good info, thanks for the quick response @mirzak . Much appreciated.