0

I'm attempting to install Google Cloud Ops Agent on Ubuntu via Docker and running into a couple issues.

Firstly, running the following returns an error saying that some GPG signatures can't be verified:

FROM ubuntu:impish

RUN apt update
RUN apt -y install curl

RUN curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh && bash add-google-cloud-ops-agent-repo.sh --also-install --verbose

CMD ["tail", "/dev/null"]

Error:

#6 20.71 Hit:1 http://ports.ubuntu.com/ubuntu-ports impish InRelease
#6 21.00 Hit:2 http://ports.ubuntu.com/ubuntu-ports impish-updates InRelease
#6 21.00 Get:3 https://packages.cloud.google.com/apt google-cloud-ops-agent-impish-all InRelease [5474 B]
#6 21.09 Err:3 https://packages.cloud.google.com/apt google-cloud-ops-agent-impish-all InRelease
#6 21.09   The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FEEA9169307EA071 NO_PUBKEY 8B57C5C2836F4BEB
#6 21.33 Hit:4 http://ports.ubuntu.com/ubuntu-ports impish-backports InRelease
#6 21.64 Hit:5 http://ports.ubuntu.com/ubuntu-ports impish-security InRelease
#6 21.72 Reading package lists...
#6 22.12 W: GPG error: https://packages.cloud.google.com/apt google-cloud-ops-agent-impish-all InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FEEA9169307EA071 NO_PUBKEY 8B57C5C2836F4BEB
#6 22.12 E: The repository 'https://packages.cloud.google.com/apt google-cloud-ops-agent-impish-all InRelease' is not signed.

To get around this, following some advice I found online I added:

RUN apt -y install software-properties-common
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FEEA9169307EA071 8B57C5C2836F4BEB

Giving me the following Dockerfile:

FROM ubuntu:impish

RUN apt update
RUN apt -y install software-properties-common curl

RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FEEA9169307EA071 8B57C5C2836F4BEB
RUN curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh && bash add-google-cloud-ops-agent-repo.sh --also-install --verbose

CMD ["tail", "/dev/null"]

Which results in a warning that apt-key is deprecated and an "installation failed" error for Ops Agent:

#7 7.659 E: Unable to locate package google-cloud-ops-agent
#7 7.659 + fail 'google-cloud-ops-agent  installation failed.'
#7 7.660 ++ date +%Y-%m-%dT%H:%M:%S%z
#7 7.661 + echo '[2022-05-02T20:40:14+0000] google-cloud-ops-agent  installation failed.'
#7 7.661 [2022-05-02T20:40:14+0000] google-cloud-ops-agent  installation failed.

According to Ops Agent Google docs Ubuntu Impish is supported. Changing Ubuntu from version 21.10 (impish) to 20.04 (focal) doesn't seem to help either.

Any advice on better ways of fixing the GPG issue, and getting Google Ops Agent installed on Ubuntu would be much appreciated.

1 Answer 1

1
+50

You're missing a package required to import the gpg key, so you get the initial error because the import fails.

Replace the packages installation line with the following:

RUN apt-get -y install curl gnupg

Tip: Use apt-get in scripts instead of apt, since apt is meant to be easy to use for end users, the "real" work is done behind by apt-get.

Also, the apt-key command that you added on your second attempt tries to get the key from Ubuntu servers, but the package is being downloaded from Google servers so the key import should be done from there.

You can see in the installation script for ops-agent that a similar apt-key command is executed but it targets https://packages.cloud.google.com/apt/doc/apt-key.gpg.

So, you don't need to import the key yourself since the installation script does it for you, given that you have the required package, in this case gnupg.

2
  • Thanks for your help, that did solve the gpg issue. Unfortunately Ops Agent still didn't install due to an error saying E: Unable to locate package google-cloud-ops-agent. Running apt-cache search --names-only 'google-cloud' doesn't seem to show up the package that is referenced in their script... so I'm not sure what's going on but seems like the package might be missing on Ubuntu... Commented May 16, 2022 at 4:24
  • I just ran a docker build with your initial Dockerfile and adding the gnupg package. Then I ran a docker exec -it and searched for the package and its definitely there: google-cloud-ops-agent/google-cloud-ops-agent-impish-all,now 2.15.0~ubuntu21.10 amd64 [installed]. You're right that the package isn't available on the Ubuntu repo, but the script that you referenced should add the Google repo and install the agent. Double check if its being installed correctly and that you're using the first Dockerfile with the added gnupg. Commented May 17, 2022 at 0:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .