Occur GPG error .... NO_PUBKEY 871920D1991BC93C in docker build

Hi,
When build Dockefile in travis, occur below errors:

W: GPG error: http://ports.ubuntu.com/ubuntu-ports noble InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C
E: The repository 'http://ports.ubuntu.com/ubuntu-ports noble InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C
E: The repository 'http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C
E: The repository 'http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease' is not signed.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports noble-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C
E: The repository 'http://ports.ubuntu.com/ubuntu-ports noble-security InRelease' is not signed.
E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true'
E: Sub-process returned an error code

But I build the same Dockefile in local is successful.

My .travis.yml as below:


arch: arm64-graviton2
virt: vm
os: linux
group: edge
language: python

dist: focal
sudo: required

python:
  - 3.8
cache: pip
services:
  - docker
.
.
.

Dockerfile as below:

FROM --platform=linux/arm64 ubuntu:noble
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
       apt-get install -y --no-install-recommends procps apt-utils locales curl default-jre
.
.
.

Does anyone know why this happened?

You need to retrieve the GPG key:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C

So something like:

arch: arm64-graviton2
virt: vm
os: linux
group: edge
language: python

dist: focal
sudo: required

python:
  - 3.8
cache: pip
services:
  - docker

before_install:
  - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C || 
    (sudo mkdir -p /etc/apt/keyrings && 
     sudo curl -fsSL https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x871920D1991BC93C | sudo tee /etc/apt/keyrings/noble.gpg > /dev/null &&
     sudo chmod 644 /etc/apt/keyrings/noble.gpg)
  - sudo apt update

Should do it.

Hi Montana,

Since my base docker image is ubuntu:noble , there are no GPG related components by default, so when run “apt-key adv --keyserver keyserver.ubuntu.com --recv-keys …” command, it will reply that there is no GPG related tools.

It seems to only happen with arm64, not amd64.