41

I am trying to build Raspberry Pi docker images but I am always having the same error, similar to this one, this one and this one.

While running the command apt update as root in a arm32v7/ubuntu:20.04 (or just ubuntu:latest), I get the following output:

root@273d63597ce6:/# apt update
Get:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease [265 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [111 kB]
Get:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease [98.3 kB]
Get:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [107 kB]
Err:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease
  At least one invalid signature was encountered.
Err:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
  At least one invalid signature was encountered.
Err:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
  At least one invalid signature was encountered.
Err:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
  At least one invalid signature was encountered.
Reading package lists... Done
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://ports.ubuntu.com/ubuntu-ports focal-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://ports.ubuntu.com/ubuntu-ports focal-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

I have tried the suggested solutions of cleaning apt, cleaning docker and removing/recreating /var/lib/apt/lists without success. The SD card is 32G and the OS is a fresh install. df shows 26G free.

Some more information:

  • This is happening on a fresh install of 2020-05-27-raspios-buster-lite-armhf on a raspberry pi 4 B
  • The same error happens on another Raspberry Pi 4 B running HypriotOS
  • The same command in the same image works fine on a raspberry pi 3 B that has Arch linux installed
  • The error does not happen if I use an older version of ubuntu (ubuntu:18.04, 16.04, 14.04)
2
  • Thanks for the reply ! I don't think this is how you prune an image, but I tried both docker image rm ubuntu:20.04 and docker system prune -a -f and it did not fix the problem.
    – TSpark
    Jul 30, 2020 at 19:04
  • 4
    For me, I had run out of disk space in docker4mac and just needed to run docker system prune Mar 3, 2021 at 15:00

4 Answers 4

49

The root cause of the problem is in libseccomp. The newer version fixes the problem, but it is not yet available in Debian's stable repos. There are two way to fix this problem:

Method 1

Start the container with --privileged. This bypasses docker's security measures, so it is not recommended. Or with --security-opt seccomp:unconfined as a little more secure. docker run -it --security-opt seccomp:unconfined ubuntu:latest

Method 2

Upgrade libseccomp manually on the host system. Dowload version from unstable repos (I tested with 2.4.3-1) here.

Install the new version:

sudo dpkg -i libseccomp2_2.4.3-1+b1_armhf.deb

Note: The above methods solved the problems for systems based on Raspbian. The error was also happening on a Ubuntu 20.04 aarch64 system, for which @NeonLines' answer was able to help.

5
  • 3
    The "Method 2" description in this answer is helpful, although it is not immediately clear whether I need to perform the libseccomp2 upgrade on the Raspberry Pi host system or in the docker image: It needs to be upgraded in the RaspiOS host system. The forced purge of the old version is unnecessary, an upgrade performed by dpkg -i is successful without first uninstalling the old version. Aug 9, 2020 at 15:00
  • 2
    Good to know ! I updated the answer to reflects this.
    – TSpark
    Aug 10, 2020 at 14:55
  • 3
    Thanks, method 2 worked for me on rpi3. Nov 3, 2020 at 0:13
  • 2
    Just upgraded it to 2.4.4-1~bpo10+1 and it worked. I am on Raspberry Pi OS (debian) Buster. Thanks for the answer. packages.debian.org/buster-backports/libseccomp2 Dec 21, 2020 at 23:06
  • 4
    amazing, just ran this on the host rpi without restarting the container cd /tmp;wget http://ftp.us.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_2.5.1-1_armhf.deb;sudo dpkg -i libseccomp2_2.5.1-1_armhf.deb May 6, 2021 at 23:32
2

At least one invalid signature was encountered

The error suggests that one of the files in /var/lib/apt/lists consist at least one invalid/corrupted signature (could be the result of apt-key misuse or something else).

Try to run Apt update with the debug messages:

apt-get -oDebug::pkgAcquire::Worker=1 update

which should point you to the corrupted file, e.g.

0% [Working] <- gpgv:400%20URI%20Failure%0aMessage:%20At%20least%20one%20invalid%20signature%20was%20encountered.%0aURI:%20gpgv:/var/lib/apt/lists/partial/CorruptedFile_InRelease

Edit the file, find and remove the corrupted parts, or remove the whole file, so it can be recreated.

1

TSpark's, HyperCreeks and ibster1st123s answers did work for me on a Rasbian 10 and the latest docker version from the official repositories. As NeonLines pointed out you have to install a recent version, since they don't suffer this problem.

Most users set up Docker’s repositories and install from them, for ease of installation and upgrade tasks. This is the recommended approach, except for Raspbian. […] For Raspbian, installing using the repository is not yet supported. You must instead use the convenience script. – docs.docker.com

tl;dr

Get a recent docker version using the convenience script. You should check the link above though, there are some caveats.

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
-1
+50

Upgrading to docker version 19.03.12 has resolved this issue for me.

6
  • Thanks for the answer ! That is the version that I am currently running. From what version did you upgrade ? What is your build number from docker --version ?
    – TSpark
    Aug 5, 2020 at 21:47
  • It is running build 48a6621 Edit: Also this is running 20.04.1 however I have confirmed this is working with 20.04 as well.
    – NeonLines
    Aug 5, 2020 at 22:49
  • Also during the upgrade I followed the steps at here mainly the regrabbing of the key as well as removing all previous installed packages. I believe docker-ce has now moved to docker-ce-cli so this also could be playing a part if you still have the old version of docker-ce installed or other packages
    – NeonLines
    Aug 5, 2020 at 22:54
  • 1
    Reinstalling and fetching the key did not solve the problem. Are you really running on a raspberry pi ? And you are able to run apt update in a ubuntu focal docker container ? Also, if that is the case, how can you specify a 20.04.1 image ? It seems it does not exists for me
    – TSpark
    Aug 6, 2020 at 1:25
  • 1
    On a Raspberry Pi, I have docker-ce and docker-ce-cli installed in version 5:19.03.12~3-0~raspbian-buster, and I am still seeing the exact problem described in the question when trying to work with an ubuntu:20.04 image. Sorry, but this answer does not help. Aug 9, 2020 at 14:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.