I made a simple script artifact using
mender-artifact write module-image -T script ... and a single script file
test.sh. All the script does is create a
/home/pi/test-file file and does nothing else. After deploying this on my device, I could see that the script ran and the file
test-file indeed got created.
However, after taking out the SD card from the raspberry pi and looking at its partitions, the file
/home/pi/test-file was only present on one of the rootfs partitions, not both. Is this how it’s supposed to work? I expected that since the update got committed (the device’s system software version got updated on hosted.mender.io) it would automatically update the passive partition as well with the file changes.
If I’m looking at this incorrectly, please help point me to the correct documentation that describes the intended behaviour.
Also, I haven’t tried this out with directory update module but I expect that it should also update the passive partition with the directory changes once the update succeeds. Please tell me if I’m wrong here also.
This is indeed the expected behavior. The passive partition is intended as a target for full image updates only. Update artifacts of type directory for script generally will only affect the currently active filesystem.
You should consider the contents of the passive partition as undefined unless doing a full image update. Consider the case where you attempt a full image update but the system reboots before it completes downloading. At this point you have a mix of old and new content in that partition and it is not likely mountable. There will be no way to copy files into that partition until a full update is completed.
If you can explain how you were expecting to use the passive partition, we may be able to suggest a mechanism for whatever your use case is.