# Rpi fails to reboot to update and execute state script

**URL:** <https://hub.mender.io/t/rpi-fails-to-reboot-to-update-and-execute-state-script/1321>\
**Category:** General Discussions\
**Tags:** raspberry-pi-3, mender-convert, mender-artifact\
**Created:** [December 5, 2019, 12:53am UTC](https://hub.mender.io/t/rpi-fails-to-reboot-to-update-and-execute-state-script/1321 "2019-12-05T00:53:02Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![cwf](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@cwf](https://hub.mender.io/u/cwf)\
**Post date:** [December 13, 2019, 7:57am UTC](https://hub.mender.io/t/rpi-fails-to-reboot-to-update-and-execute-state-script/1321/7 "2019-12-13T07:57:24Z")

</div>

I started with Raspbian, one of the versions mentioned as working [here](https://hub.mender.io/t/raspberry-pi-3-model-b-b-raspbian/140). 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]

---

_[View the full topic](https://hub.mender.io/t/rpi-fails-to-reboot-to-update-and-execute-state-script/1321)._
