The following packages have unmet dependencies: libappstream3 ... 报错

记一次报错的经历

这仅是我的一次修复问题的经历,相同的报错不一样是同样的原因

在使用 ubuntu 的时候,输入命令 sudo apt upgrade 或者 sudo apt-get upgrade 报错如下,且 ubuntu 桌面右上角出现红圈白杠的提示。

noname@noname-MRC-WX0:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libappstream3 : Depends: libprotobuf-lite9v5 but it is not installable
                 Depends: libxapian22v5 but it is not installable
locales : Depends: libc-bin (> 2.31)
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

发生以上错误后,按照提示 apt --fix-broken install修改无效,依旧是关于 libappstream3 依赖缺失的错误,查阅网上大量文章,也都不起作用。

但是通过分析有一种可能,就是下载源出现了问题,因为所有解决方式,都提示 it is not installable即无法安装的意思。

无意中,使用lsb_release -a命令发现,我的系统为 ubuntu 18.04(bionic)。而我一直以为我的系统是 20.04(focal)。 我用的源也是 20.04 的源。

noname@noname-MRC-WX0:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.6 LTS
Release:	18.04
Codename:	bionic

而这两个版本的源是不一样的,于是更换正确的国内源,这里给一个 18.04 国内源的链接,然后 sudo apt updatesudo apt upgrade解决问题(如果中间依旧有问题,按照提示修复即可)。

下面看一下 18.04 源和 20.04 源的区别。
在这里插入图片描述
可以看到 18.04 中都是 bionic 的版本,而 20.04 中则是 focal 的版本。
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_34902437/article/details/121699281