How to resolve unmet dependencies? Cannot install or remove packages
Solution 1
Try to install manual openjdk-6-jre (sudo apt-get install openjdk-6-jre) - when it is not possible run "apt-cache policy openjdk-6-jre" to see if you have a source for it. When you don’t have a source you miss universe and/or security sources in your /etc/apt/sources.list. Possible you miss also a "sudo apt-get update"?
or try to remove the packages with:
sudo dpkg --purge bleachbit ca-certificates-java icedtea-6-plugin icedtea-netx
Then try again to install what you want to install or just install oracle java:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
Solution 2
I think you are confusing apt
and dpkg
. You get the message
Try 'apt-get -f install' with no packages (or specify a solution)
but instead of apt-get -f install
you execute sudo dpkg --configure -a
"to get the all dependencies". That is not what dpkg
does.
From the manpage of dpkg
:
--configure package...|-a|--pending
Configure a package which has been unpacked but not yet config‐
ured. If -a or --pending is given instead of package, all
unpacked but unconfigured packages are configured.
That is not the matter here. Apparently dpkg
is not able to configure some packages succesfully due to unmet dependencies---not because unpacking of packages had been interrupted for any reason. Resolving dependencies by installing missing packages lays in the realm of apt. From the apt-get manpage:
-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.
Therefore the command that comes at hand and which was advertised by the error message is:
sudo apt-get install -f
From the actual broken dependencies that are presented in your copy&paste I take that this simple command should do the trick. If not, refer to this question or post exact error messages from above command.
The cause of this might be that you did not do an apt-get update
beforehand. The packages list that apt holds point to individual packages in the repository. When one or more packages are upgrade in the repository for any reasons then older packages will be purged. The dependent packages then point to packages that are not provided anymore.
You do not have to run apt-get update
every time you do an install, but you may end up with a situation like this. However that's easily fixed by sudo apt-get update && sudo apt-get install -f
.
Related videos on Youtube
Gaurav Sharma
Having 9+ hands-on development experience with Team Lead skills. Worked as a Sr. Software Engineer / Architect / Module Lead position on various projects.
Updated on September 18, 2022Comments
-
Gaurav Sharma over 1 year
$sudo apt-get -f install google-chrome-stable
I tried to install java in ubuntu but it's not successfully installed, but after that when I am trying to install/remove any other packages, I'm getting these errors:
Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt-get -f install' to correct these: The following packages have unmet dependencies: bleachbit : Depends: menu but it is not going to be installed ca-certificates-java : Depends: openjdk-6-jre-headless (>= 6b16-1.6.1-2) or java6-runtime-headless icedtea-6-plugin : Depends: openjdk-6-jre icedtea-netx : Depends: openjdk-6-jre (>= 6b23~pre10~) or openjdk-7-jre **E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).**
When i run the
sudo dpkg --configure -a
to get the all dependencies, i found:dpkg: dependency problems prevent configuration of icedtea-netx: icedtea-netx depends on openjdk-6-jre (>= 6b23~pre10~) | openjdk-7-jre; however: Package openjdk-6-jre is not installed. Package openjdk-7-jre is not installed. dpkg: error processing icedtea-netx (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of bleachbit: bleachbit depends on python-central (>= 0.6.7); however: Package python-central is not installed. bleachbit depends on menu; however: Package menu is not installed. dpkg: error processing bleachbit (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of ca-certificates-java: ca-certificates-java depends on openjdk-6-jre-headless (>= 6b16-1.6.1-2) | java6-runtime-headless; however: Package openjdk-6-jre-headless is not installed. Package java6-runtime-headless is not installed. dpkg: error processing ca-certificates-java (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of icedtea-6-plugin: icedtea-6-plugin depends on openjdk-6-jre; however: Package openjdk-6-jre is not installed. icedtea-6-plugin depends on icedtea-netx (= 1.2-2ubuntu1); however: Package icedtea-netx is not configured yet. dpkg: error processing icedtea-6-plugin (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: icedtea-netx bleachbit ca-certificates-java icedtea-6-plugin
When I open ubuntu soft. center to install/remove any packages I also get this error:
Package dependencies cannot be resolved The following packages have unmet dependencies: bleachbit: Depends: python (>= 2.4) but 2.7.3-0ubuntu2 is installed Depends: python-gtk2 (>= 2.6) but 2.24.0-3 is installed Depends: python-central (>= 0.6.7) but it is not installed Depends: menu but it is not installed ca-certificates-java: Depends: java6-runtime-headless but it is a virtual package icedtea-6-plugin: Depends: openjdk-6-jre but it is not installed Depends: icedtea-netx (= 1.2-2ubuntu1) but 1.2-2ubuntu1 is installed Depends: libc6 (>= 2.4) but 2.15-0ubuntu10.3 is installed Depends: libgcc1 (>= 1:4.1.1) but 1:4.6.3-1ubuntu5 is installed Depends: libglib2.0-0 (>= 2.31.8) but 2.32.3-0ubuntu1 is installed Depends: libgtk2.0-0 (>= 2.8.0) but 2.24.10-0ubuntu6 is installed Depends: libstdc++6 (>= 4.6) but 4.6.3-1ubuntu5 is installed icedtea-netx: Depends: icedtea-netx-common (>= 1.2-2ubuntu1) but 1.2-2ubuntu1 is installed Depends: openjdk-7-jre but it is not installed
-
Alvar over 10 yearspossible duplicate of How do I resolve unmet dependencies?
-
totti over 10 yearstry
sudo apt-get -f install
-
Gaurav Sharma over 10 yearsI already search to solve unmet dependencies but all Q. have different kind of package that meet other dependency and also tried -f option when installing and removing.
-
Alex R over 10 yearstry sudo apt-get clean && sudo apt-get update && sudo apt-get install -f
-
Johannes Kohnen over 10 yearsBTW, the 'default way' to install Java is by installing the package
default-jre
and/ordefault-jdk
. In most use cases that is painless.
-
-
Johannes Kohnen over 10 yearsI have up voted this answer. Firstly I'd try the solution from my answer and then explicitly remove 'offending' packages / install missing dependencies as @TCr suggests. Another way would be to spawn
aptitude
in a terminal a let it work out a resolution. (It will display red rows at the bottom; then presse
to examine suggestions, press.
or,
until a suggestions seems ok and then execute that with!
andg
.