无法在 Ubuntu 22.10 上将 Oracle 的虚拟盒 gpg 密钥安装到 apt

无法在 Ubuntu 22.10 上将 Oracle 的虚拟盒 gpg 密钥安装到 apt

这是我尝试过的。

  1. 将他们的 apt 行(带有发行版“jammy”)添加到/etc/apt/sources.list.d目录中。
  2. 从他们的下载页面

此时,我尝试了几种方法,但似乎都没有用。我尝试了以下方法:

  • apt-key add oracle_vbox_2016.asc。我收到弃用警告和“OK”消息。当我运行“apt-key list”时出现密钥。apt update报告缺少具有相同签名的密钥。
  • (从 中删除密钥apt-key),用 创建密钥环文件gpg --no-default-keyring --keyring gnupg-ring:./oracle_vbox.gpg --import oracle_vbox_2016.asc,将该文件复制到/etc/apt/trusted.gpg.dapt-key list显示密钥。apt update无法识别它。

以下是相关输出:

$ apt-key list
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
/etc/apt/trusted.gpg
--------------------
...

/etc/apt/trusted.gpg.d/oracle_vbox.gpg
--------------------------------------
pub   rsa4096 2016-04-22 [SC]
      B9F8 D658 297A F3EF C18D  5CDF A2F6 83C5 2980 AECF
uid           [ unknown] Oracle Corporation (VirtualBox archive signing key) <[email protected]>
sub   rsa4096 2016-04-22 [E]

$ sudo apt update
...
Get:8 https://download.virtualbox.org/virtualbox/debian jammy InRelease [4,428 B]           
Err:8 https://download.virtualbox.org/virtualbox/debian jammy InRelease            
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A2F683C52980AECF
...
Reading package lists... Done
W: GPG error: https://download.virtualbox.org/virtualbox/debian jammy InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A2F683C52980AECF
E: The repository 'https://download.virtualbox.org/virtualbox/debian jammy InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.

答案1

确保 source.list 正确(应该如您所说,但谁也不知道):

文件:/etc/apt/sources.list.d/oracle-virtualbox-jammy.list

deb https://download.virtualbox.org/virtualbox/debian jammy contrib

添加您从中下载的密钥Oracle/virtualbox看看它是否存在:

sudo gpg --no-default-keyring --keyring /etc/apt/trusted.gpg --import oracle_vbox_2016.asc
gpg --no-default-keyring --keyring /etc/apt/trusted.gpg --list-sigs


  [...]
  pub   rsa4096 2016-04-22 [SC]
        B9F8D658297AF3EFC18D5CDFA2F683C52980AECF
  uid           [ unknown] Oracle Corporation (VirtualBox archive signing key) <[email protected]>
  sig 3        A2F683C52980AECF 2016-04-22  Oracle Corporation (VirtualBox archive signing key) <[email protected]>
  sub   rsa4096 2016-04-22 [E]
  sig          A2F683C52980AECF 2016-04-22  Oracle Corporation (VirtualBox archive signing key) <[email protected]>

更新 apt 存储库列表:

sudo apt update

  [...]
  N: Skipping acquire of configured file 'contrib/binary-i386/Packages' as repository 'https://download.virtualbox.org/virtualbox/debian jammy InRelease' doesn't support architecture 'i386'

这个“通知”消息是可以的,他们只提供 x86-64 位版本。

查看 Oracle 的 VirtualBox 是否可供安装:

apt search virtualbox

  [...]
  p   virtualbox-7.0                                                              - Oracle VM VirtualBox                                                                 
  [...]


apt show virtualbox-7.0

  Package: virtualbox-7.0
  [...]
  APT-Sources: https://download.virtualbox.org/virtualbox/debian jammy/contrib amd64 Packages
  Description: Oracle VM VirtualBox
  [...]

答案2

我找到了答案,但很尴尬。

建议添加的恰当行是:

deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian <mydist> contrib

我忘记设置特定的签名密钥,并带有显式路径。这消除了通用 gpg 密钥环的使用,导致我将密钥添加到密钥环的操作无效。

相关内容