Linux运维|使用aptitude代替apt-get解决安装包依赖问题

问题描述

在使用apt-get安装libffi-dev时出现如下报错:

The following packages have unmet dependencies:
 libffi-dev : Depends: libffi6 (= 3.1~rc1+r3.0.013-12ubuntu0.2) but 3.2.1-4 is to be installed
E: Unable to correct problems, you have held broken packages.

在这里插入图片描述

试了太多办法都不行,最后采用aptitude代替apt-get进行安装

aptitude安装过程

sudo apt-get install aptitude

在这里插入图片描述
出现如上报错

解决方法:

sudo apt-get install libsigc++-2.0-0c2a
sudo apt-get install libxapian22 
sudo apt-get install aptitude

在这里插入图片描述
被坑惨了,sudo apt-get install libsigc++-2.0-0c2a安装这个包的时候会把一些重要的包remove掉,比如vmware-tools,一定要提前拍摄快照!!!


上述问题解决办法:
ubuntu使用的是14.04的源,在/etc/apt/sources.list中改变源
将trusty换成bionic

 deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiv    erse
 deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted univer    se multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted univers    e multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe mu    ltiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted un    iverse multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted uni    verse multiverse

trusty是14.04序号,xenial是16.04序号,bionic是18.04序号

可以根据需要自行修改序号

发布了85 篇原创文章 · 获赞 42 · 访问量 4324

猜你喜欢

转载自blog.csdn.net/weixin_43092232/article/details/104866480