ubuntu20.04 apt 安装报 E: Unable to correct problems, you have held broken packages.

编程入门 行业动态 更新时间:2024-10-25 04:24:06

在安装软件的时候报错:

root@root:-$sudo apt-get install vim
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.
 vim : Depends: vim-common (= 2:8.0.1453-1ubuntu1) but 2:8.0.1453-1ubuntu1.1 is to be installed
E: Unable to correct problems, you have held broken packages.

网上查询了很多资料,都无法解决,

      设置--软件更新不行

     sudo apt-get install aptitude 也不可以

最后发现是我的apt源的问题,切换的国内源不可用,你可以先执行 lsb_release -a 查看到是Codename: focal类型的源,所以需要切换的国内源是这样的:

sudo gedit /etc/apt/sources.list

#清华源
deb https://mirrors.tuna.tsinghua.edu/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu/ubuntu/ focal-security main restricted universe multiverse

原来报错的源是:

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu/ubuntu/ bionic-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu/ubuntu/ bionic-proposed main restricted universe multiverse

看看是不是不一样,切换focal的源在更新就没问题了。

ubuntu各个版本的源如下:

Ubuntu 12.04 (LTS)代号为precise。

Ubuntu 14.04 (LTS)代号为trusty。

Ubuntu 15.04 代号为vivid。

Ubuntu 15.10 代号为wily。

Ubuntu 16.04 (LTS)代号为xenial。

Ubuntu 18.04 (LTS)代号为bionic。

Ubuntu 20.04 (LTS)代号为focal。

如果还是不行 进入 software&updates---other software 取消选中不能使用的源。

更多推荐

ubuntu20.04 apt 安装报 E: Unable to correct problems, you have held broken packages

本文发布于:2023-06-14 09:44:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1462378.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:apt   Unable   correct   broken   packages

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!