摘要
正在生成中……
升级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” 这个警告,解决方法如下:
首先查看key list,找到警告相关源的key
$ 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 rsa2048 2016-09-25 [SC] [expired: 2021-04-18]
1B07 204C D71B 690D 409F 57D2 4ABE 1AC7 557B EFF9
uid [ expired] isv:ownCloud OBS Project <isv:ownCloud@build.opensuse.org>
pub rsa2048 2015-10-28 [SC]
BC52 8686 B50D 79E3 39D3 721C EB3E 94AD BE12 29CF
uid [ unknown] Microsoft (Release signing) <gpgsecurity@microsoft.com>
pub rsa4096 2017-04-05 [SC]
DBA3 6B51 81D0 C816 F630 E889 D980 A174 57F6 FB06
uid [ unknown] Open Whisper Systems <support@whispersystems.org>
sub rsa4096 2017-04-05 [E]
/etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg
------------------------------------------------------
pub rsa4096 2012-05-11 [SC]
8439 38DF 228D 22F7 B374 2BC0 D94A A3F0 EFE2 1092
uid [ unknown] Ubuntu CD Image Automatic Signing Key (2012) <cdimage@ubuntu.com>
/etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg
------------------------------------------------------
pub rsa4096 2018-09-17 [SC]
F6EC B376 2474 EDA9 D21B 7022 8719 20D1 991B C93C
uid [ unknown] Ubuntu Archive Automatic Signing Key (2018) <ftpmaster@ubuntu.com>
导出相应key到单独文件,这里假设有警告的key是55AFCFAE (注:只需要对应后8位就可以)
$ apt-key export BE1229CF|sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/microsoft.gpg
修改有问题源的配置文件,关联key文件位置. 源配置文件在/etc/apt/sources.list.d目录下
deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/microsoft.gpg] https://packages.microsoft.com/repos/ms-teams stable main
至此key到处到单独文件,并与源配置文件关联成功,可以删除trusted.gpg中的key了.
另外如果发现列表中某些key的状态是 [expired] 也可以用以下命令删除
$ sudo apt-key del 557BEFF9