Docker - 在Ubuntu 20.04 arm的容器中,apt update引發籤名錯誤

分享于 

5分钟阅读

ubuntu

  简体

问题:

我尝试构建树莓派Docker镜像,但我总得到相同的错误。

apt update root在arm32v7/ubuntu:20.04 (或者只是ubuntu:latest )中运行命令时,得到以下输出:


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.



  • 如果我使用旧版本的ubuntu (ubuntu:18.0416.0414.04 )就不会发生错误

  • 答案1:

    
    $ sudo apt-get clean
    
    
    
    $ sudo mv /var/lib/apt/lists /tmp
    
    
    
    $ sudo mkdir -p /var/lib/apt/lists/partial
    
    
    
    $ sudo apt-get clean
    
    
    
    $ sudo apt-get update
    
    
    
    

    答案2:

    在终端中执行以下命令

    
    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <PUBKEY>
    
    
    
    

    存储库缺少的公钥,例如,8BAF9A6F。

    然后更新

    
    sudo apt-get update
    
    
    sudo apt-get install -f
    
    
    sudo dpkg --configure -a
    
    
    
    

    方法2:

    
    sudo gpg --keyserver pgpkeys.mit.edu --recv-key <PUBKEY>
    
    
    
    sudo gpg -a --export <PUBKEY> | sudo apt-key add -
    
    
    
    sudo apt-get update
    
    
    
    

    答案3

    问题的根本原因在libseccomp。新版本修复了这个问题,但在Debian的稳定repos中还不可用,有两种方法可以解决这个问题:

    方法1

    --privileged启动容器,这绕过Docker的安全措施,因此不推荐使用。

    方法2

    从不稳定的repos libseccomp手动升级版本(我测试了2.4.3 -1 ),在这里

    卸载当前版本:

    sudo dpkg --force-all -P libseccomp2

    安装新版本:

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



    DOC  Docker  DOCK  Ubuntu  Contain  ARM