在升级Ubuntu 22.04后更新源出现如下警告:
Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
需要将出现该提示的GPG key存储到/usr/share/keyrings
, 步骤如下:
$ sudo apt-key list
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
/etc/apt/trusted.gpg
--------------------
pub rsa4096 2017-05-08 [SCEA]
1EDD E2CD FC02 5D17 F6DA 9EC0 ADAE 6AD2 8A8F 901A
uid [ unknown] Sublime HQ Pty Ltd <support@sublimetext.com>
sub rsa4096 2017-05-08 [S]
pub rsa2048 2015-10-28 [SC]
BC52 8686 B50D 79E3 39D3 721C EB3E 94AD BE12 29CF
uid [ unknown] Microsoft (Release signing) <gpgsecurity@microsoft.com>
BE12 29CF
(是Microsoft pub的后8位), 导出这个Key:$ sudo apt-key export BE1229CF | sudo gpg --dearmour -o /usr/share/keyrings/microsoft.gpg
此时会出现如下提示:
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
注意: 有部分文章指出导出到
/etc/apt/trusted.gpg.d/microsoft.gpg
, 虽然也可行, 但安全原因, Ubuntu社区并不推荐这样做. 此外, 导出的Key可以自由命名, 但是需要与步骤3相对应, 这里命名为microsoft
.
/etc/apt/sources.list.d/
, 假设文件为microsoft.list
, 用Vim打开, 并如下添加signed-by
标签关联步骤2导出的Key文件:deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/edge/ stable main
sudo apt update
, 可以看到警告消失了, 此时可以移除原始key:$ sudo apt-key del BE1229CF
Stack Exchange: Key is stored in legacy trusted.gpg keyring
本文标题: Ubuntu 22.04更新源出现Key is stored in legacy trusted.gpg keyring解决方案
本文作者: 云中雨雾
本文链接: https://weiviming.github.io/16576879066429.html
本站文章采用 知识共享署名4.0 国际许可协议进行许可
除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
最后编辑时间: 2022-07-13T12:51:46+08:00