Fixing “Depends: package_name but it is not going to be installed” error in Ubuntu/Debian

Debian/Ubuntu users can get their software from many sources and formats. Out of the box, apt-get command allows you to install any from its thousands of default packages, which was thoroughly tested against your distro release. This default applications catalog can be extended by adding a PPA, which basically means a third-party repository. There are also other formats designed to replace or simplify software installation, namely snap, AppImage, Flatpak, etc.

If you’re regularly installing applications from external software repositories, you’ll certainly encounter “Unmet depencies” or “Depends: package_name but it is not going to be installed” error at east once. It’s been widely regarded as one of the most common error messages in Ubuntu. Below is a typical “Depends: package_name but it is not going to be installed” message:

$ sudo apt-get install curl 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: bsh : Depends: libjline-java but it is not going to be installed groovy : Depends: libjline-java but it is not going to be installed rhino : Depends: libjline-java but it is not going to be installed E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
Code language: JavaScript (javascript)

In other cases, the error may include package versions without suggestions on trying apt-get -f command:

Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: package1 : Depends: package2 (>= 1.8) but 1.7.5-1ubuntu1 is to be installed E: Unable to correct problems, you have held broken packages.

What does “Unmet depencies” really mean?

“Unmet depencies” simply indicates that the package you’re trying to install relies on a few specific version of other packages, which cannot be installed due to conflicts with the current Ubuntu/Debian release.

Most of the time, the “Unmet depencies” error should not be raised with packages that comes from Ubuntu or Debian default software repositories. Those default applications have been thoroughly tested and was built for the OS release to avoid common problems.

This is also the case for PPA repositories maintained by the original company/developer of the software you’re trying to install, since they should do their own tests on different setups before releasing the software.

However, for a small number of old software, there are times you have no choice but to add a community maintained PPA, which can be the root cause of “Depends: package_name but it is not going to be installed” error. Read on to find out how to fix it.

Fixing dependencies on its own with apt

apt-get has been equipped with its own mechanism to fix broken packages.

From apt-get documentation : --fix-broken attempts 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 dselect or dpkg --remove to eliminate some of the offending packages). Use of this option together with -m may produce an error in some situations.

Simply pass in the -f switch, which stands for --fix-broken to activate it.

sudo apt-get -f install sudo dpkg --configure -a
Code language: JavaScript (javascript)

In layman’s terms, the first command will automatically scan for missing dependencies and fix them from the repositories. The second command will reconfigure all packages to interlink with each other (after fixing)

Please do note that the commands above does not work in all cases. If the output states that nothing new was installed or upgraded, it has failed.

Remove unused PPAs

PPAs (Personal Package Archive) are repositories hosted on Launchpad. You can use PPAs to install or upgrade packages that are not available in the official Ubuntu repositories.

Once you’ve added too many PPAs, sometimes they clash with each other. In order to remove some of the PPAs you don’t use, follow the instructions below:

  1. Click Settings in the top menu
  2. Then Repositories
  3. Software and Updates window will be displayed.
  4. From this window you can remove the unused PPAs from the Other Software tab.

If you don’t know which PPAs to remove, consider using a third-party applications such as Y-PPA-Manager or a community-maintained script .

Clean APT Package Database

Sometimes, a corrupted package database can be the root cause of Unmet dependencies error. In order to quickly do a package database clean up, sequentially run the two commands below:

sudo apt-get clean sudo apt-get autoclean
Code language: JavaScript (javascript)

The first command cleans out local repositories, except lock files from directories such as /var/cache/apt/archives and /var/cache/apt/archives/partial/. The second one automatically remove the local repository of retrieved package files, but it only removes files that can no longer be downloaded and are virtually useless. Regularly running the two commands above also keep your cache from growing too large.

We hope that the information above helped you fix “Depends: package_name but it is not going to be installed” error message. You may be interested in our guide on other common apt errors such as Fix “apt-get : command not found”, apt-get: Could not resolve archive.ubuntu.com or apt-get in macOS .

Click to rate this post!
[Total: 0 Average: 0]

Leave a Comment