Rpi fails to reboot to update and execute state script

I started with Raspbian, one of the versions mentioned as working here. I loaded it on the Pi so I could change some config and turn on ssh. I used dd to create an image of the SD card; we’ll call this image START.

I loaded up Raspbian again, updated all packages, and added a file called UPDATED to the home directory. Then I used dd again to create an image of this updated instance of Raspbian; let’s call this image END. I used PiShrink to shrink both START and END.

Then I used START as input for mender-convert to create an sdimg, flashed it to an SD card, and loaded it up on the Pi. I used END as input for mender-artifact to create just the artifact with the embedded Artifact state scripts.

All the scripts except for ArtifactReboot_Leave_00 simply concatenate a string to a file in /data. These all execute. ArtifactReboot_Leave_00 loops while attempting to reach 10.9.8.8:53 with netcat (I can’t remember the exact command, and I’m not near my work laptop to check, but the command executes fine while testing manually in Raspbian). When the command returns success, it exits the loop, all while writing status updates to /data/wait.log, but it never starts execution.

Even before I started working with the state scripts, I was getting:

error reporting update status: reporting status failed: Put https://ec2-***-***-***-***.compute-1.amazonaws.com/api/devices/v1/deployments/device/deployments/0cc289f8-9e09-41cd-b169-5cc0bd36b263/status: dial tcp: lookup ec2-***-***-***-***.compute-1.amazonaws.com on 10.9.8.8:53: dial udp 10.9.8.8:53: connect: network is unreachable

The ArtifactReboot_Leave script was an attempt to address that, without realizing that things were failing and rolling back before that point.

2019-12-12 19:06:32 +0000 UTC info: State transition: init [none] → after-reboot [ArtifactReboot_Leave]
2019-12-12 19:06:32 +0000 UTC debug: Have U-Boot variable: mender_check_saveenv_canary=1
2019-12-12 19:06:32 +0000 UTC debug: List of U-Boot variables:map[mender_check_saveenv_canary:1]
2019-12-12 19:06:32 +0000 UTC debug: Have U-Boot variable: mender_saveenv_canary=1
2019-12-12 19:06:32 +0000 UTC debug: List of U-Boot variables:map[mender_saveenv_canary:1]
2019-12-12 19:06:32 +0000 UTC debug: Have U-Boot variable: upgrade_available=0
2019-12-12 19:06:33 +0000 UTC debug: List of U-Boot variables:map[upgrade_available:0]
2019-12-12 19:06:34 +0000 UTC error: transient error: Reboot to new update failed. Expected “upgrade_available” flag to be true but it was false
2019-12-12 19:06:34 +0000 UTC info: State transition: after-reboot [ArtifactReboot_Leave] → rollback [ArtifactRollback]