OK, I just ran to it .. but, unfortunately, after 30 minutes there was no timeout that made it work. Fortunatly nelasx correctly diagnosed and corrected. I add this to give the steps that I had to take based on his beautiful question and commented on the answer. I just gathered the information that I had to gather together to find a solution.
Symptoms: when you start the google instance - refusal was refused After checking the serial console output, you will see:
Jul 8 10:17:14 instance-1 google: Waiting for metadata server, attempt 412
You can try to wait, not work for me, and check out https://github.com/GoogleCloudPlatform/compute-image-packages/blob/master/google-startup-scripts/usr/share/google/onboot
# Failed to resolve host or connect to host. Retry indefinitely. 6|7) sleep 1.0 log "Waiting for metadata server, attempt ${count}"
He ordered me to believe that this would not work.
So, the solution was to tinker with the disk in order to add nelasx to the solution: "edit ifcfg-eth and change PEERDNS = no edit / etc / resolv.conf and enable over your name servers + change the domain domain / etc / hosts and add: 169.254.169.254 metadata.google.internal "
To do this,
It is best to back up the snapshot before you start if it goes wrong.
Uncheck "Delete boot disk when deleting instance" for your instance
Delete instance
Create a micro instance
Install disk
sudo ls -l / dev / disk / by-id / * # this will give you the instance name
sudo mkdir / mnt / new
sudo mount / dev / disk / by-id / scsi-0Google_PersistentDisk_instance-1-part1 / mnt / new
where instance-1 will be modified according to your setup
Go into editing according to nelasx's solution - the idiot trap that I fell into - use the relative path - not only sudo vi / etc / hosts use / mnt / new / etc / hosts - it cost me 15 more minutes since I had to go through: got depressed, scratched his head, started kicking himself.
Delete the debug instance, make sure that the selected option to delete the connected drive is not checked
Create a new instance that matches your original, with the edited disk as the boot disk and run it.
source share