执行下面命令,备份 apt 安装源:
$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
vim 编辑 sources.list :
$ sudo vim /etc/apt/sources.list `
将 sources.list 中的内容替换如下
注意:这里是Ubuntu 20.04 LTS的,
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
aptitude : Depends: libcwidget3 but it is not going to be installed Depends: libncursesw5 (>= 5.6+20070908) but it is not going to be
installed
Depends: libtinfo5 but it is not going to be installed
Recommends: apt-xapian-index but it is not going to be installed
Recommends: libparse-debianchangelog-perl but it is not going to be
installed
E: Unable to correct problems, you have held broken packages.
我是用源解决了这个问题的
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
$ sudo apt upgrade
$ sudo apt update
还尝试过这些下面命令, 但是不能解决问题
$ sudo apt update --fix-missing [package]
$ sudo apt install -f [package]