ubuntu 22.04 修复 key is stored in legacy trusted.gpg keyring
·
ubuntu 22.04 中, 直接在 /etc/apt/trusted.gpg 中保存 keyring 的做法会提示 warning(sudo apt update
的末尾提示 warning)
$ sudo apt update
Hit:1 http://mirrors.aliyun.com/ubuntu jammy InRelease
Hit:2 http://packages.microsoft.com/repos/code stable InRelease
Get:3 https://typoraio.cn/linux ./ InRelease [793 B]
Hit:4 http://mirrors.aliyun.com/ubuntu jammy-updates InRelease
Hit:5 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:6 http://mirrors.aliyun.com/ubuntu jammy-backports InRelease
Hit:7 http://mirrors.aliyun.com/ubuntu jammy-security InRelease
Hit:8 https://www.charlesproxy.com/packages/apt charles-proxy InRelease
Hit:9 https://debrepo.freedownloadmanager.org bionic InRelease
Hit:10 https://deb.tableplus.com/debian/22 tableplus InRelease
Hit:11 https://download.sublimetext.com apt/stable/ InRelease
Fetched 793 B in 12s (66 B/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: https://www.charlesproxy.com/packages/apt/dists/charles-proxy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
对于已经提示 warning 的 keyring, 在本篇中提示 warning 的软件源为 charles-proxy
, 可以将其导出至 /etc/apt/trusted.gpg.d/ 目录中, 然后删除 /etc/apt/trusted.gpg 中的该 keyring
- 找出该 keyring 的 fingerprint
使用 apt-key list
命令列出所有 keyring 的信息, 然后找出该 keyring 的 fingerprint, 具体方法是找关键字, 本篇中的关键字为 charles-proxy
, 下面的命令输出中仅展示了 charles-proxy
的 keyring 信息
$ 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 2016-07-26 [SC]
4BA7 DB85 7B57 0089 7420 96E1 5F16 B97C 1AD2 8806
uid [ unknown] Charles Proxy <karl@charlesproxy.com>
sub rsa4096 2016-07-26 [E]
- 导出 keyring 至 etc/apt/trusted.gpg.d/xxx.gpg
导出命令中只需要 fingerprint 的末尾 8 位, /etc/apt/trusted.gpg.d/charlesproxy.gpg 中的 charlesproxy.gpg
可以自定义名称, 只要保存在 /etc/apt/trusted.gpg.d 这个路径下即可
$ sudo apt-key export 1AD28806 | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/charlesproxy.gpg
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
- 删除 /etc/apt/trusted.gpg 中的 keyring
$ sudo apt-key --keyring /etc/apt/trusted.gpg del 1AD28806
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
如果有多个 keyring 提示 warning, 需要对每一个 keyring 重复以上步骤
参考: https://askubuntu.com/questions/1407632/key-is-stored-in-legacy-trusted-gpg-keyring-etc-apt-trusted-gpg
更多推荐
已为社区贡献5条内容
所有评论(0)