ubuntu20.04 apt安装软件报错:E: Unable to correct problems, you have held broken packages.(已解决)(需要换源)

文章讲述了在Ubuntu20.04系统中尝试安装openssh-server时遇到的问题及解决方案。首先,尝试通过更换镜像源(包括阿里云、中科大、163和清华源)来解决,但未成功。随后发现错误在于使用了Ubuntu16.04的源,而非适用于Ubuntu20.04的源。正确解决方法是确定系统的LSB发布代号并更换相应的Ubuntu20.04源。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

背景

执行命令报错:

apt install openssh-server

在这里插入图片描述

解决方法1:换源再安装(没成功)

原因

老镜像源有问题,需要更换新的镜像源

解决办法

需要换源:

vi /etc/apt/sources.list

或者

gedit /etc/apt/sources.list

然后把其他的镜像源放进去,放在原来的文件的最下面:

#添加阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

#中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
 
#163源
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
 
#清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

参考文章:解决E: Unable to correct problems, you have held broken packages.(亲测有效)


没成功啊,还这样!

在这里插入图片描述

解决方法2:我™搞错了,我拿着ubuntu16.04的源到ubuntu20.04山去换,肯定不行啊!要换ubuntu20.04的源!(已解决)

参考文章:ubuntu不同版本的源(换源)(镜像源)(lsb_release -c命令,显示当前系统的发行版代号(Codename))

换完源后可以了

注意:ubuntu界面自带的那个切换源貌似不靠谱,需要自己手动更换源!

在这里插入图片描述

在这里插入图片描述

具体换源方法参考文章:ubuntu 16.04 更换国内源(下载源)(阿里源)(换源)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Dontla

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值