Open ghost opened 3 years ago
I was running into the same issue on CentOS 8 with Packer. Setting SELinux to permissive mode in the user-supplied startup script fixed my issue and now the Packer build runs with no problems.
Just added this to the end of my startup script:
# Set SE Linux to permissive
setenforce 0
This issue was originally opened by @alexfouche as hashicorp/packer#7789. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.
This issue applies to the
googlecompute
builderThe issue appears when the hostname or FQDN of the linux instance does not match the instance name set when creating the instance. Or when hostname is modified (via a custom startup script or whatever at linux start, ...) or is set with
"instance_name":
in the builder json blockThe builder, when instanciating a VM adds a metadata
startup-script
. In this script, there is a shell functionSetMetadata()
, which is called at the end of the startup script to set instance metadatastartup-script-status=done
See startup.go#L27
The problem lies in the fact that
${HOSTNAME}
is used. The Google instance name should be used, not the hostname.Using the
GetMetadata()
function of the script, the instance name can be retrieved with