To recreate:
- install the google-cloud-sdk and configure your gcloud command line - cat >user-data.yaml <<EOF #cloud-config ssh_import_id: lp:<your lp id> EOF
# launch instance that can recreate - gcloud compute instances create recreate-lp1766287 --zone=europe-west1 --image daily-ubuntu-minimal-1804-bionic-v20180420 --metadata-from-file user-data=user-data.yaml --metadata=serial-port-enable=1
# get the ip of the instance into variable - IP=`gcloud compute instances list | awk '/recreate-lp1766287/ {print $5}'`
# connect to instance - ssh ubuntu@$IP;
# on the instance, set root password for serial console login - sudo bash; passwd
# update cloud-init-local.service config to Want/After systemd-udev-settle.service - sudo sed -i -e '/DefaultDependencies/i Wants=systemd-udev-settle.service\nAfter=systemd-udev-settle.service' /lib/systemd/system/cloud-init-local.service
# reset cloud-init - sudo cloud-init clean --logs --reboot
# in separate terminal, fire up serial console - cloud compute connect-to-serial-port recreate-lp1766287
# In the shell with the IP variable defined, # Run this loop to watch and trigger reboots if network comes up:
- COUNT=0; while true; do echo "---"; echo "COUNT=$COUNT"; ssh -o ConnectTimeout=5s ubuntu@$IP -- "sudo cloud-init status --wait; sudo cloud-init clean --logs; sudo shutdown --reboot +1; exit" 2>/dev/null; if [ "$?" = "0" ]; then echo "Boot Success!"; COUNT=$(($COUNT + 1)); fi; echo "waiting 4s"; sleep 4; done
To recreate:
- install the google-cloud-sdk and configure your gcloud command line
- cat >user-data.yaml <<EOF
#cloud-config
ssh_import_id: lp:<your lp id>
EOF
# launch instance that can recreate minimal- 1804-bionic- v20180420 --metadata- from-file user-data= user-data. yaml --metadata= serial- port-enable= 1
- gcloud compute instances create recreate-lp1766287 --zone=europe-west1 --image daily-ubuntu-
# get the ip of the instance into variable lp1766287/ {print $5}'`
- IP=`gcloud compute instances list | awk '/recreate-
# connect to instance
- ssh ubuntu@$IP;
# on the instance, set root password for serial console login
- sudo bash; passwd
# update cloud-init- local.service config to Want/After systemd- udev-settle. service encies/ i Wants=systemd- udev-settle. service\ nAfter= systemd- udev-settle. service' /lib/systemd/ system/ cloud-init- local.service
- sudo sed -i -e '/DefaultDepend
# reset cloud-init
- sudo cloud-init clean --logs --reboot
# in separate terminal, fire up serial console to-serial- port recreate-lp1766287
- cloud compute connect-
# In the shell with the IP variable defined,
# Run this loop to watch and trigger reboots if network comes up:
- COUNT=0; while true; do echo "---"; echo "COUNT=$COUNT"; ssh -o ConnectTimeout=5s ubuntu@$IP -- "sudo cloud-init status --wait; sudo cloud-init clean --logs; sudo shutdown --reboot +1; exit" 2>/dev/null; if [ "$?" = "0" ]; then echo "Boot Success!"; COUNT=$(($COUNT + 1)); fi; echo "waiting 4s"; sleep 4; done