apt 更新在 arm 上的 Ubuntu 20.04 容器中引发签名错误

TSp*_*ark 33 arm gnupg raspberrypi docker 20.04

我正在尝试构建 Raspberry Pi docker 映像,但我总是遇到相同的错误,类似于this onethis onethis one

apt update在 a arm32v7/ubuntu:20.04(或仅ubuntu:latest)中以 root 身份运行命令时,我得到以下输出:

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.
Run Code Online (Sandbox Code Playgroud)

我已经尝试了清理 apt、清理 docker 和删除/重新创建的建议解决方案,/var/lib/apt/lists但没有成功。SD 卡为 32G,操作系统为全新安装。df显示26G免费。

更多信息:

  • 这是在树莓派 4 B 上全新安装 2020-05-27-raspios-buster-lite-armhf 时发生的
  • 同样的错误发生在另一个运行 HypriotOS 的 Raspberry Pi 4 B 上
  • 同一图像中的相同命令在安装了 Arch linux 的 raspberry pi 3 B 上运行良好
  • 如果我使用旧版本的 ubuntu ( ubuntu:18.04, 16.04, 14.04) ,则不会发生该错误

TSp*_*ark 36

问题的根本原因在于 libseccomp。较新的版本修复了这个问题,但它在 Debian 的稳定存储库中尚不可用。有两种方法可以解决这个问题:

方法一

用 启动容器--privileged。这绕过了docker的安全措施,所以不推荐。或者--security-opt seccomp:unconfined更安全一点。 docker run -it --security-opt seccomp:unconfined ubuntu:latest

方法二

在主机系统上手动升级 libseccomp。从不稳定的存储库下载版本(我用 2.4.3-1 测试过)here

安装新版本:

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

注:以上方法解决了基于 Raspbian 的系统的问题。该错误也发生在 Ubuntu 20.04 aarch64 系统上,@NeonLines 的回答能够提供帮助。

  • 太棒了,只需在主机 rpi 上运行此命令,而无需重新启动容器 `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` (4认同)
  • 此答案中的“方法 2”描述很有帮助,尽管我并不清楚我是否需​​要在 Raspberry Pi 主机系统或 docker 映像中执行 libseccomp2 升级:它需要在 RaspiOS 主机系统中升级。不需要强制清除旧版本,dpkg -i 升级成功,无需先卸载旧版本。 (3认同)
  • 很高兴知道 !我更新了答案以反映这一点。 (2认同)
  • 谢谢,方法 2 在 rpi3 上对我有用。 (2认同)
  • 刚刚升级到 2.4.4-1~bpo10+1 就可以了。我在 Raspberry Pi OS (debian) Buster 上。谢谢你的回答。https://packages.debian.org/buster-backports/libseccomp2 (2认同)