Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

The startup script only runs after resetting de VM instance

It seems that the startup script doesn’t run right after creating and running the VM but only after resetting the machine. Could someone help me with it?

Thank you


Santosh Kothapalli

The start up script doesnt seem to execute right after creating the instance

Santosh Kothapalli

can i get help , even on reset also i dont see Stack Driver

Jean Carlos Gomes Pinto

Same question. The script only works after restart!

1 Answers

I too experienced this. 

First thing to remember is that when running on a f1-micro instance it might take a while for the startup script to run.  This is especially so if it has a lot to download and install.

Looking in the logs of my compute instance it appeared that the startup script was hanging for a long time when rebuilding the man-db pages.   This can take an eternity on a small instance.

A pretty brutal way to speed this up is to edit the script so that it purges the man-db service just before you update the system.

apt-get remove -y --purge man-db  
apt-get -yq update  
apt-get -yq upgrade

This means that the instance wont have access to man pages, but it’s better than having the startup-script fail.

All in all, with the man-db service removed, it took 7 mins for the startup script to finish and copy the expected files over to the configured cloud bucket.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?