mozilla-platform-ops / monopacker

builds taskcluster worker images for AWS and GCP using packer
Mozilla Public License 2.0
6 stars 9 forks source link

dns issues building images in my own GCP project #125

Open bhearsum opened 8 months ago

bhearsum commented 8 months ago

I end up with:

googlecompute.generic_translations_gcp: Provisioning with shell script: scripts/ubuntu-jammy/30-packages.sh ==> googlecompute.generic_translations_gcp: sudo: unable to resolve host packer-65aa977a-59b8-4252-80cc-a5074a4d73eb: Name or service not known ==> googlecompute.generic_translations_gcp: ==> googlecompute.generic_translations_gcp: # init helpers ==> googlecompute.generic_translations_gcp: helpers_dir=${MONOPACKER_HELPERS_DIR:-"/etc/monopacker/scripts"} ==> googlecompute.generic_translations_gcp: + helpers_dir=/etc/monopacker/scripts ==> googlecompute.generic_translations_gcp: for h in ${helpers_dir}/.sh; do ==> googlecompute.generic_translations_gcp: . $h; ==> googlecompute.generic_translations_gcp: done ==> googlecompute.generic_translations_gcp: + for h in ${helpers_dir}/.sh ==> googlecompute.generic_translations_gcp: + . /etc/monopacker/scripts/funcs.sh ==> googlecompute.generic_translations_gcp: #!/bin/bash ==> googlecompute.generic_translations_gcp: ==> googlecompute.generic_translations_gcp: set -ex ==> googlecompute.generic_translations_gcp: ++ set -ex ==> googlecompute.generic_translations_gcp: set +v ==> googlecompute.generic_translations_gcp: ++ set +v ==> googlecompute.generic_translations_gcp: ++ log_dir=/var/log/monopacker/scripts ==> googlecompute.generic_translations_gcp: ++ set -v ==> googlecompute.generic_translations_gcp: ==> googlecompute.generic_translations_gcp: retry apt-get update ==> googlecompute.generic_translations_gcp: + retry apt-get update ==> googlecompute.generic_translations_gcp: + set +e ==> googlecompute.generic_translations_gcp: + local n=0 ==> googlecompute.generic_translations_gcp: + local max=5 ==> googlecompute.generic_translations_gcp: + true ==> googlecompute.generic_translations_gcp: + apt-get update ==> googlecompute.generic_translations_gcp: Failed to start apt-news.service: Transaction for apt-news.service/start is destructive (systemd-sysusers.service has 'stop' job queued, but 'start' is included in transaction). ==> googlecompute.generic_translations_gcp: See system logs and 'systemctl status apt-news.service' for details. ==> googlecompute.generic_translations_gcp: Failed to start esm-cache.service: Transaction for esm-cache.service/start is destructive (systemd-fsck@dev-disk-by\x2dlabel-UEFI.service has 'stop' job queued, but 'start' is included in transaction). ==> googlecompute.generic_translations_gcp: See system logs and 'systemctl status esm-cache.service' for details.

It seems like this may be somewhat intermittent. I thought I could fix it with:

diff --git a/scripts/ubuntu-jammy/02-grub.sh b/scripts/ubuntu-jammy/02-grub.sh
index 5b7af5a..e042545 100644
--- a/scripts/ubuntu-jammy/02-grub.sh
+++ b/scripts/ubuntu-jammy/02-grub.sh
@@ -32,10 +32,12 @@ cat "${GRUB_INFILE}"
 rm -rf "${TMP_DIR}" 2>/dev/null

 # FIXME does not exist?
 # shown here https://launchpad.net/ubuntu/+source/linux-signed/4.15.0-58.64
 # retry apt-get install -y linux-image-$KERNEL_VERSION-dbgsym

 # Shutdown and wait forever; packer will consider this script to have finished and
 # start on the next script when it reconnects
+cat /etc/resolv.conf
+echo 'nameserver 8.8.8.8' > /etc/resolv.conf
 shutdown -r now
 while true; do sleep 1; done

...which worked once, but the error kept happening again after that.