如何解决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:
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).

根据问题提示信息,是由于所依赖的包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 

你可能感兴趣的:(自然语言)