解决 apt 更新时的问题

由于手头使用的 Ubuntu 是数次升级、克隆延续而来,因此有些东西就渐渐显出了疲态。apt update 时总有那么几个小问题,昨天集中解决了一下。解决之后想到应该把问题做个小结的,可惜现场已经不在,大部分原始错误/警告信息无存,只好在网络上寻找类似的来展示。

1. NO PUBKEY 问题。出现的错误信息类似如下:

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://dl.winehq.org trusty InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F

解决方法:执行 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 76F1A20FF987672F 将 key 获取到即可。wine 有出这问题的可能。

2. KEYEXPIRED 问题。出现的错误信息类似如下:

W: GPG error: http://archive.debian.org lenny/updates Release: The following signatures were invalid: KEYEXPIRED 1356982504

解决办法:通常要到对应的软件站点,按照其说明重新添加最新的 key(有人说可以和 1 用相同的方法解决,但我测试无效)。比如解决 Double Commander 的问题时的操作命令: curl https://download.opensuse.org/repositories/home:Alexx2000/xUbuntu_18.04/Release.key | sudo apt-key add -

3. i386 架构不再被支的问题。出现的错误信息类似如下:

N: Skipping acquire of configured file ‘main/binary-i386/Packages’ as repository ‘http://dl.google.com/linux/chrome/deb stable InRelease’ doesn’t support architecture ‘i386’

解决办法:到 apt 使用的对应的 source.list 文件中,将 [arch=amd64] 补充填入即可。例如这样: deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main。目前,vscode、nginx、docker 都有这个需求。

4. Typora 特有的源的路径问题。
解决办法:到 apt 使用的对应的 source.list 文件中,将 deb https://typora.io/ ./linux/ 改为 deb https://typora.io/linux/ ./ 即可。

Bonus:如果你和我一样,机器里没有 curl 只有 wget,则可以用 wget -q -O- 来获得等价于 curl 裸命令的效果。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注