运行“apt update”时出错。W:没有 PUB_KEY 且 W:Target 包被多次配置

运行“apt update”时出错。W:没有 PUB_KEY 且 W:Target 包被多次配置

当我尝试使用 更新我的系统时sudo apt-get update,收到以下信息:

Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://pkg.scaleft.com/deb linux InRelease [4808 B]
Hit:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Err:3 http://pkg.scaleft.com/deb linux InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F716E939977FC428
Reading package lists... Done
W: GPG error: http://pkg.scaleft.com/deb linux InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F716E939977FC428
E: The repository 'http://pkg.scaleft.com/deb linux 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: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:51
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:51
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:51
W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:51
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:51

我该如何修复此问题并更新我的系统?

编辑

现在,我得到:

root@PYAMMANO-68J9Z:/# echo "deb http://pkg.scaleft.com/deb linux main" | sudo tee -a /etc/apt/sources.list
deb http://pkg.scaleft.com/deb linux main
root@PYAMMANO-68J9Z:/# curl -fsSL https://dist.scaleft.com/pki/scaleft_deb_key.asc | gpg --dearmor | sudo tee /usr/share/keyrings/scaleft-archive-keyring.gpg > /dev/null
root@PYAMMANO-68J9Z:/# apt -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 95 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up scaleft-server-tools (1.56.1) ...
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
dpkg: error processing package scaleft-server-tools (--configure):
 installed scaleft-server-tools package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 scaleft-server-tools
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:51
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:51
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:51
W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:51
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:51
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:52
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:52
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:52
W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:52
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list:52
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/scaleft.list:1
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/scaleft.list:1
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/scaleft.list:1
W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/scaleft.list:1
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:50 and /etc/apt/sources.list.d/scaleft.list:1
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

您的系统中有三个错误。

  • 首先,您的一个存储库未签名,需要 GPG 密钥。

  • 其次,您的sources.list来源有重复。

  • 第三,您的系统有一个损坏的包。

添加适当的签名。

  1. 在终端中运行以下命令:

    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F716E939977FC428
    
  2. 更新:

    sudo apt update
    

修复重复的条目。

  1. 安装Y-PPA-MANAGER

    sudo add-apt-repository ppa:webupd8team/y-ppa-manager
    sudo apt upgrade
    sudo apt install y-ppa-manager
    
  2. 打开Y-PPA-MANAGER

    sudo y-ppa-manager
    

    Y PPA 经理

  3. 导航高级 → 扫描并删除重复的 PPA

    高级选项。

  4. 让它完成并运行:

    sudo apt update 
    

修复损坏的包:

  1. 首先,更新存储库:

    sudo apt update
    
  2. 现在运行:

    sudo apt download runit-systemd && sudo dpkg -i --force-all ./*.deb
    
  3. 运行强制安装:

    sudo apt -f install
    

    这也将安装您想要安装的包,即scaleft-server-tools

如果需要,您可以清除并重新安装该软件包。通过运行:

sudo dpkg -P scaleft-server-tools --force-all && sudo apt install scaleft-server-tools

或者,您可以手动编辑软件包的安装后文件scaleft-server-tools,将命令替换systemctl为命令service并运行sudo apt -f install。重新启动以确认所有更改。

就这样!
祝你好运!

编辑

对于问题#3,即包裹损坏。

在文档中,我发现对于 Ubuntu 20.04 Focal 或更高版本,您需要明确允许证书颁发机构 (CA) 使用 ssh-rsa 算法来签署证书。

为此,您需要将以下行添加到您的 OpenSSH 守护程序文件(或/etc/ssh/sshd_config下的插入文件/etc/ssh/sshd_config.d/):

CASignatureAlgorithms +ssh-rsa

答案2

按照说明进行操作Okta.com(格式,我自己的):

2.信任存储库签名密钥:

curl -fsSL https://dist.scaleft.com/pki/scaleft_deb_key.asc | gpg --dearmor | sudo tee /usr/share/keyrings/scaleft-archive-keyring.gpg > /dev/null

安装证书后,您可能需要apt -f install修复您已经尝试过的任何安装,但希望其他一切都能顺利安装。

相关内容