startup script yum install fails with “signature could not be verified for google-cloud-sdk”

I reran the startup script using following command: sudo google_metadata_script_runner --script-type startup

All the yum install commands are failing with following error:

startup-script: INFO startup-script-url: Retrieving key from https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
startup-script: INFO startup-script-url: https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64/repodata/repomd.xml: [Errno -1] repomd.xml signature could not be verified for google-cloud-sdk
startup-script: INFO startup-script-url: Trying other mirror.
startup-script: INFO startup-script-url:  One of the configured repositories failed (Google Cloud SDK),

Any idea how I could fix this while instance provisioning or any workaround?


Solution 1:

As stated in BobCares.com's "Plesk update error on CentOS7 GCP",

The yum repositories do not usually use GPG keys for repository validation. Instead, it uses https endpoint as a trusted one.

I've tried it, and it solved the error in my case. So, try changing the GPG check:

sudo sed -i 's/repo_gpgcheck=1/repo_gpgcheck=0/g' /etc/yum.repos.d/google-cloud-sdk.repo

In my case (failure to update Plesk), I had this seeting ("repo_gpgcheck=1") in /etc/yum.repos.d/google-cloud-sdk.repo). So, first, locate where you have this setting set to 1, and change accordingly the instruction above.

Afterwards, run again your script. sudo google_metadata_script_runner --script-type startup

Hopefully it will now work without errors.