I changed the order of things in the script and installed the stackdriver agent first after I noticed it was not completing.
I found that apt-get command were not completing.
I also found this pull request in your github and verified that it does work. The pull request references a stack overflow issue.
Stack Overflow thread:
It looks like Christophe Chuvan may have found a workaround after checking the local syslog and running ‘dpkg –configure -a’. Link to Christophe’s post:
I just used Ubuntu 18.04 as the image OS instead and it all works as expected, if that helps anyone?
Hey, thank you all–Tony, Christophe, Ben, and Steve!
I tried to repro this, myself–and although I did see some messages about
dpkg, it never seemed to freeze on me and it always seemed to still install and run
stress just fine and write the file to the bucket. Regardless, I looked into the helpful links you all provided (and some more, for good measure) and combined them into what I believe should be a more robust startup script. And that is now available in the repo and linked from the lecture.
TL;DR: I have updated the script and it should work better, now. 🙂