如何解决apt-get中Unmet dependencies问题

简介

新安装的Ubuntu 16.04 TLS系统,由于apt-get upgrade过程中断,导致依赖损坏;安装新的包时,提示Unmet dependencies问题。本文记录了问题的排查方法及解决方案
问题描述

系统由于未知原因,在系统重启后,发现安装包时提示了Unmet dependencies提示,无法正常安装。

hadoop@hadoop-virtualbox:~$ sudo apt-get install openjdk-8-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
openjdk-8-jdk is already the newest version (8u131-b11-2ubuntu1.16.04.3).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
<span style="color:#ff0000;"> linux-image-extra-4.10.0-35-generic : Depends: linux-image-4.10.0-35-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).</span>
根据问题提示信息,是由于所依赖的包linux-image-4.10.0-35-generic并没有被正确安装导致。linux-image-x.x.x是内核文件,从提示信息上看,应该是升级过程中断导致的问题。查看内核当前版本信息发现当前运行的版本为4.10.0-28-generic。确实与提示的内核信息不一致,确认了问题所在。
hadoop@hadoop-virtualbox:~$ uname -r
4.10.0-28-generic
解决方案

根据提示信息,运行apt-get -f install来修复问题,详细的-f选项的意义可以查看manual手册。这里列出了选项的具体含义:
-f, --fix-broken
Fix; attempt to correct a system with broken dependencies in place. This option, when used with install/remove, 
can omit any packages to permit APT to deduce a likely solution. If packages are specified, these have to 
completely correct the problem. The option is sometimes necessary when running APT for the first time; 
APT itself does not allow broken package dependencies to exist on a system. It is possible that a system's 
dependency structure can be so corrupt as to require manual intervention (which usually means using dpkg --remove 
to eliminate some of the offending packages). Use of this option together with -m may produce an error in some 
situations. Configuration Item: APT::Get::Fix-Broken.
接下来我们执行修复命令,并重新执行更新和升级,确保完整修复问题。
sudo apt --fix-broken install
sudo apt-get update
sudo apt-get upgrade

 


原文:https://blog.csdn.net/jinguangliu/article/details/78145423 

  • 10
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值