至少遇到一个无效签名

Atleast one invalid signature was encountered

我正在尝试使用 minikube 在我的开发机器上构建和部署微服务映像到单节点 Kubernetes 集群 运行。我正在使用 Google 的云原生微服务演示应用程序 Online Boutique 来了解 Kubernetes、Istio 等技术的使用。

Link 到 github 回购:microservices-demo

在按照安装过程执行 运行 命令 skaffold run 构建和部署我的应用程序时,我遇到了一些错误:

Step 10/11 : RUN apt-get -qq update     && apt-get install -y --no-install-recommends         curl
 ---> Running in 43d61232617c
W: GPG error: http://deb.debian.org/debian buster InRelease: At least one invalid signature was encountered.
E: The repository 'http://deb.debian.org/debian buster InRelease' is not signed.
W: GPG error: http://deb.debian.org/debian buster-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://deb.debian.org/debian buster-updates InRelease' is not signed.
W: GPG error: http://security.debian.org/debian-security buster/updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://security.debian.org/debian-security buster/updates InRelease' is not signed.
failed to build: couldn't build "loadgenerator": unable to stream build output: The command '/bin/sh -c apt-get -qq update     && apt-get install -y --no-install-recommends         curl' returned a non-zero code: 100

我在尝试构建 loadgenerator 时收到这些错误。 我该如何解决这个问题?

您遇到这些错误的原因有以下几个:

  1. 现有缓存 and/or 光盘 space 可能存在问题。为了修复它,您需要通过执行以下操作来清除 APT 缓存:sudo apt-get cleansudo apt-get update.

  2. 现有 docker 图像也是如此。执行:docker image prune -fdocker container prune -f 以删除未使用的数据并释放磁盘 space。

  3. 如果您不关心安全风险,可以尝试运行 apt-get 命令与--allow-unauthenticated--allow-insecure-repositories旗帜。根据 docs:

Ignore if packages can't be authenticated and don't prompt about it. This can be useful while working with local repositories, but is a huge security risk if data authenticity isn't ensured in another way by the user itself.

如果有帮助,请告诉我。

我认为这与 docker 官方映像(在本例中为 armhf)的某些 LSM 组件和 exec/capabilities 权限有关。在这种简单的情况下,sid 风味无法正确处理时间。而这与证书检查有关,是无效签名的原因。它也发生在 ubuntu focal.

# docker run -it debian:buster /bin/date
Sun Nov 15 11:30:44 UTC 2020
# docker run -it debian:sid /bin/date 
Thu Jan  1 00:00:00 UTC 1970

我通常看到这种情况的原因是因为 docker 运行 磁盘 space 不足,这令人沮丧,因为错误几乎没有表明这是问题所在。首先尝试使用 prune 命令 https://docs.docker.com/config/pruning/.

清理不需要的镜像和容器
$ docker image prune 
$ docker container prune 

如果您累积了很多图像并想删除所有与现有容器无关的图像,请尝试:

$ docker image prune -a 

或者您可以只删除旧图像:

$ docker image prune -a --filter "until=24h"

最后,在 MacOS 上,Docker 运行s 在专用 VM 中,您可能需要从 Docker 桌面应用程序增加 Docker 可用的磁盘(设置 -> 资源 -> 高级 -> 磁盘映像大小)。

我遇到了同样的问题,none 之前的回复说修剪图像或容器有效。原因是我的 Docker 构建缓存占用了大部分 space。 运行 以下命令修复了问题:

docker system prune

然后您可以通过 运行:

检查它是否有效
docker system df

更新:

以上命令将清除整个Docker系统。如果您只想清除构建缓存,可以使用以下命令来完成(归功于 saraf.gahl):

docker builder prune

在 x64 中制作您自己的 sid 图像

# variables
$WORKPLACE=/space_change_me
$BASEIMG=debian:buster
$TAG=my/debian
$RELEASE=sid
$PLATFORM=arm

# multiarch preparation
apt-get update
apt-get -y install apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get -y install qemu binfmt-support qemu-user-static docker-ce byobu make
export DOCKER_CLI_EXPERIMENTAL=enabled

#build image
docker run  -i --rm -v $WORKPLACE:/data $BASEIMG /bin/bash  << EOF
export DEBIAN_FRONTEND="noninteractive" 
apt-get -y update
apt-get -y install debootstrap
debootstrap --verbose --include=iputils-ping --arch $PLATFORM $RELEASE /data/$RELEASE-$PLATFORM $REPO
chroot /data/$RELEASE-$PLATFORM/ /bin/bash << SEOF 
export DEBIAN_FRONTEND="noninteractive"
apt-get -y update
apt-get -y upgrade
apt-get -y clean
SEOF
rm -R /data/$RELEASE-$PLATFORM/debootstrap
EOF

cd $WORKPLACE/$RELEASE-$PLATFORM
tar cpf - . | docker import - $TAG:$RELEASE-$PLATFORM --platform $PLATFORM
docker save $TAG:$RELEASE-$PLATFORM  > debian-$RELEASE-$PLATFORM.tar

您可以稍后在 arm 主机中加载

cat debian-$RELEASE-$PLATFORM.tar |docker load

At least one invalid signature was encountered

该错误表明 /var/lib/apt/lists 中的文件之一包含至少一个 invalid/corrupted 签名(可能是 apt-key 误用或其他原因造成的)。

尝试 运行 使用调试消息进行 Apt 更新:

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

这应该会指向损坏的文件,例如

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

编辑文件,查找并删除损坏的部分,或删除整个文件,以便重新创建。

None 其中对我有用。不过这个命令起到了作用:

docker volume prune

实际上有 249GB 的卷可供我回收。

@Jack Kawell 做对了。

docker builder prune

这个命令可以解决问题。 当心命令“docker system prune”,因为这会删除您的所有图像(非常具有破坏性)。 构建器修剪仅删除构建缓存,这是您之前所有(缓存的)构建步骤所在的位置。

我尝试了上面的一些答案,none 对我有用。真正的触发是当我使用 @Wytrzymały Wiktor's 中的 --allow-unauthenticated--allow-insecure-repositories 时,我收到一条显示

的通知
tar: ./conffiles: Cannot utime: Operation not permitted
tar: ./control: Cannot utime: Operation not permitted
tar: ./md5sums: Cannot utime: Operation not permitted
tar: ./postinst: Cannot utime: Operation not permitted
tar: .: Cannot utime: Operation not permitted
tar: Exiting with failure status due to previous errors

这让我走上了一条路线,我发现 this post 这表明问题可能出在 libseccomp2 过时的地方。

要解决的问题:

# Get signing keys to verify the new packages, otherwise they will not install
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 04EE7237B7D453EC 648ACFD622F3D138

# Add the Buster backport repository to apt sources.list
echo 'deb http://httpredir.debian.org/debian buster-backports main contrib non-free' | sudo tee -a /etc/apt/sources.list.d/debian-backports.list

sudo apt update ; sudo apt install libseccomp2 -t buster-backports

请注意,这假设您使用的是 Raspbian 和 19.04

之后的 docker 版本

我遇到了同样的问题。看起来是缺少 space。我删除了旧图像,它开始工作了。

$ docker images

Select你不再关心的(删除)。

$ docker rmi <image_id>