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

来源:互联网 发布:域名备案查询 编辑:程序博客网 时间:2024/05/22 03:43

简介

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

问题描述

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

hadoop@hadoop-virtualbox:~$ sudo apt-get install openjdk-8-jdkReading package lists... DoneBuilding dependency treeReading state information... Doneopenjdk-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 installedE: 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 -r4.10.0-28-generic

解决方案

根据提示信息,运行apt-get -f install来修复问题,详细的-f选项的意义可以查看manual手册。这里列出了选项的具体含义:
-f, --fix-brokenFix; 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 installsudo apt-get updatesudo apt-get upgrade

阅读全文
0 0
原创粉丝点击