Ubuntu 安装package提示依赖: XXX 但是它将不会被安装 解决方法

Posted 从善若水

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu 安装package提示依赖: XXX 但是它将不会被安装 解决方法相关的知识,希望对你有一定的参考价值。

依赖: XXX 但是它将不会被安装 解决方法

       今天误删了libelf1库,导致虚拟机黑屏,在重安gnome时,apt提示“依赖: XXX 但是它将不会被安装”,在这里整理解决方法。

       首先打开apt自动更新功能

#修改第一个文件
sudo gedit /etc/apt/apt.conf.d/10periodic

#第一个文件按照下面的参数修改
APT::Periodic::Update-Package-Lists "2";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "0";
APT::Periodic::Unattended-Upgrade "1";

#修改第二个文件
sudo gedit /etc/apt/apt.conf.d/20auto-upgrades

#第二个文件按照下面的参数修改
APT::Periodic::Update-Package-Lists "2";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "0";
APT::Periodic::Unattended-Upgrade "1";

sudo reboot # 重启系统

方法一:aptitude

       没有安装aptitude,可以使用下面的命令安装:

sudo apt-get install aptitude

安装完成后使用下面的命令尝试继续安装你需要的库:

sudo aptitude install XXX

方法二:更换下载源

1.首先备份原始下载源文件:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bk

2.然后写入新的下载源地址:

vi /etc/apt/sources.list
#阿里云
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

或者

#网易163
deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse

3.更新源 && 更新软件 && :

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get upgrade
sudo reboot

4.重新安装你需要的package

sudo aptitude install XXX

如果仍然提示“依赖: XXX 但是它将不会被安装”,重新执行步骤3和步骤4,直到apt命令不再提示这个问题为止。

博主就是使用方法二解决的问题,重复操作了两次步骤3和步骤4,才将gnome重新安装,不一定适用所有人,但是你可以试一试,不喜勿喷!!!


在这里插入图片描述

以上是关于Ubuntu 安装package提示依赖: XXX 但是它将不会被安装 解决方法的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu中使用dpkg安装deb文件提示依赖关系问题,仍未被配置

rpm安装提示error: XXX: not an rpm package (or package manifest):

软件安装失败,导致ubuntu软件中心软件消失

yum安装时提示No package xxx available,解决办法

ubuntu中pycharm安装package提示Install packaging tools解决

Ubuntu12.04下pulseaudio的安装以及API使用