The following packages have unmet dependencies ubuntu как исправить

Обновлено: 02.07.2024

Occasionally, when I'm installing stuff, I get an error like the following:

How can I resolve this?

52k 41 41 gold badges 141 141 silver badges 193 193 bronze badges 57.7k 51 51 gold badges 167 167 silver badges 245 245 bronze badges

14 Answers 14

APT is a package management system for Debian and other Linux distributions based on it, such as Ubuntu. For the most part, APT is easy to use for installing, removing, and updating packages. In rare instances, often when you are mixing in third-party dependencies, there is a chance that apt-get may end up giving you an error telling you that a package installation could not be completed.

Solutions:

It is always a good idea to back up configuration files like /etc/apt/sources.list , so you can revert the changes if needed.

If the error shows something like this:

<some-package>: Depends: <other-package> (= version) but this-version is to be installed

Then make sure that the restricted and universe repositories are enabled. Hit Alt + F2 , type software-properties-gtk and hit Enter .

Under Ubuntu Software tab, enable all the repositories.


One possible cause of unmet dependencies could be corrupted package database, and/or some packages weren’t installed properly. To fix this problem, hit Alt + Ctrl + T to open terminal and try to run one of the following commands:

apt-get clean clears out the local repository of retrieved package files (the .deb files). It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. apt-get autoclean clears out the local repository of retrieved package files, but unlike apt-get clean , it only removes package files that can no longer be downloaded, and are largely useless.

One of the most basic fixes to resolve dependencies problems is to run:

The -f here stands for “fix broken”. Apt will attempt to correct broken dependencies. If you manually installed a package that had unmet dependencies, apt-get will install those dependencies, if possible, otherwise it may simply remove the package that you installed in order to resolve the problem.

Then run this again:

If the output is:

0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

That means it failed.

Next solution is to run:

If it shows any held packages, it is best to eliminate them. Packages are held because of dependency conflicts that apt cannot resolve. Try this command to find and repair the conflicts:

If it cannot fix the conflicts, it will exit with:

0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

Delete the held packages one by one, running dist-upgrade each time, until there are no more held packages. Then reinstall any needed packages. Be sure to use the --dry-run option, so that you are fully informed of consequences:

Since removing the package you are trying to install may not be ideal, you might also try finding a repository that has the packages you need to satisfy the dependencies.

Finally, if all else fails, you can attempt to satisfy the dependencies yourself, either by finding and installing the necessary packages, or by installing them from source and then creating “deb” packages for them.

Disable/Remove/Purge 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.

One of the most common causes of unmet dependencies are PPAs, especially when used to upgrade the existing package in Ubuntu repositories. To solve the problem you have three options: disable, purge (revert back to original package in Ubuntu repositories) or remove PPA.

Disable:

Disabling a PPA means no more updates for the packages installed from that PPA. To disable a PPA: Open Software Center > Edit > Software Sources Or,

Hit Alt + F2 and run software-properties-gtk .

Click on Other Software tab, you'll see that each PPA have two lines here, one for the compiled packages and one for the source, Uncheck both lines to disable a PPA. Here you can also add and remove PPAs.


Purge:

Purging a PPA means, downgrading the packages in the selected PPA to the version in the official Ubuntu repositories and disabling that PPA. PPA Purge does exactly that. To install PPA Purge run the following command:

But, considering the question apt is broken, the above command will fail. So use this command

To use PPA Purge:

If 'ppa-purge' command fails for some reason, you can't run 'ppa-purge' again unless you re-enable the PPA (To enable the PPA follow the same steps as disabling a PPA and Check the both lines of a particular PPA to enable it).

Note: PPA Purge doesn't remove PPAs (may be in future), So you'll have to manually remove the PPA.

Remove:

If the package installed from a PPA doesn't exist in official Ubuntu repositories then using PPA Purge is not recommended, because there's nothing to be downgraded and PPA Purge wouldn't delete it either. To remove a PPA and installed packages run the following commands: (Ignore the first command if you don't want to remove the installed packages)

Alternatively you can use Y PPA Manager to disable/remove/purge PPA's (Details at the end of answer).

Preventive Measures:

So how can we avoid this from happening in the first place?

Keep Ubuntu Up to date. Ubuntu automatically notifies when updates are available, you can also check for available updates by clicking on Session Indicator in Unity panel:


Or, Hit Alt + Ctrl + T to open terminal and run following commands:

Update: Synchronizes your list of available packages with the servers in source repositories. Upgrade: Downloads & installs any newer versions of your installed packages.

Remove duplicate PPAs. Y PPA Manager (installation guide at the end of answer) can easily scan and remove duplicate PPAs.

  • Hit Alt + F2 and run y-ppa-manager to open Y PPA Manager.
  • Once open, double click or hit Enter on Advanced .
  • In resulting window select Scan and remove duplicate PPAs and click OK.

enter image description here

Getting Help:

When asking for help on Askubuntu or any other help forum, you should include the output of the following commands in your question:

Output of actual error:

This will show your sources.list:

This will show the list of PPAs (If any):

Additional Sources:

Y PPA Manager: Y PPA Manager is an one stop shop for all of your PPA needs.

y ppa manager

Here are some of its features:

  • search packages in all Launchpad PPAs
  • list and download packages in a PPA
  • add / remove / purge a PPA
  • backup and restore PPA sources
  • remove duplicate PPA sources

To install Y PPA Manager , open terminal by hitting Alt + Ctrl + T and run following commands:

Considering the question, apt is broken, so use these commands instead

18.5k 55 55 gold badges 72 72 silver badges 78 78 bronze badges 23k 8 8 gold badges 59 59 silver badges 81 81 bronze badges How to install unmet depandancies if apt is broken? Noone actually answered how to install those packages with unmet dependencies versions. God! I just want to force install older versions of packages.

Note: All commands asked to be run must be run in the terminal, which can be opened by either Ctrl + Alt + T or searching for terminal in the dash.

Try running the following command and try to reinstall the software you were trying to install

Backing up

Back up the following files:

To do so, use these commands

Clearing your apt-cache

apt keeps a cache of recently downloaded packages to save bandwidth when it is required to be installed. This can be counter-productive in some cases

Now, to clean it, you have two options

This will remove all cached packages belonging to the folder /var/cache/apt/archives/ and /var/cache/apt/archives/partial except the .lock files. This is recommended

This scans the folders /var/cache/apt/archives/ and /var/cache/apt/archives/partial and checks if the package is still in the repositories and removes the ones that aren't

Using apt's fix-broken mode

This will cause apt to scan for missing dependencies and fix them from the repositories

If the output states that nothing new was installed or upgraded, it has failed.

Type gksu software-properties-gtk and you'll get this window


Make sure all sources are enabled.

next, go to the Other software tab and check if the required PPAs for the software to be installed are there and are enabled. Also, try disabling some PPAs which might be having broken packages


now, run sudo apt-get update

Try installing the software now

Type gksu software-properties-gtk and you'll get this window


Click the Download from the Dropdown box and select other


Click Select Best Server


Run sudo apt-get update

Try installing the software

also, try using sudo apt-get install -f

This is a tool used to purge broken/unwanted ppa's and their applications along with it

To install it, run

But, Considering the question apt is broken so the above command will fail. So use this command

Now use ppa purge

Y-PPA Manager is a gui app that helps you manage PPA's and various problems assosiated with it

Considering the question, apt is broken so, use these command instead

Now type in y-ppa-manager

You'll be presented with this window


Double click on advanced, and you'll get this window


Do the following Tasks outlined in black


It is better to prevent than to search for this question on AskUbuntu :D

So, here are the guidelines to keep you safe

Keep your system up-to-date

always run the following command regularly

or, you can always use Update Manager with this command

Using only trusted PPA's

Only use PPA's meant to be used on Ubuntu also, only use PPA's with trusted sources. Infact, the package might already be in the ubuntu repositories

Backing up when things are good and restoring it later

For this you need Y-PPA-Manager. The steps to install it are given above.

Run this command to open Y-PPA-Manager

You'll be presented with this window


Double click on advanced, and you'll get this window



You'll be asked to save a tar.gz file with a dialog similar to the one below. Save it in another partition or a safe place


Later, when you need to restore it again, follow similar steps and when you get to the advanced dialog,Click on this:


You'll be asked to restore from the previous backup which you saved before with a dialog similar to the one below


Package dependency errors are not always generic and depends on the package to be installed.

If following all the steps given to fix the error does not work for you, you can always ask on Ask Ubuntu

Here are some commands which you need to post the output of

There are also other files/commands that you need the output of that might be error specific, and users will probably prompt you in the comments to post the file/command.


12.9k 13 13 gold badges 62 62 silver badges 120 120 bronze badges I thought that the -f flag stands for force and always avoided to use it

These answers so far are focused on how to help the system automagically resolve such an issue, mostly hoping that it resolves itself, but not focused on understanding how to investigate dependencies. It's important to try making sure your package lists are up to date first; always make sure a simple update or clearing of the cache doesn't resolve the issue before digging deeper. If everything behind the scenes is working as it should, however, it's paramount to understand dependencies. Sometimes the layers of dependencies can seem overwhelming, but the concept is simple and key to understanding how software is installed/uninstalled in an Ubuntu system.

I highly recommend aptitude to anyone using a .deb based system, such as Debian, Kali, Ubuntu or any of its derivatives. It provides an interface to browse through layers of dependencies, including recommended and suggested packages. It is an invaluable tool for when apt-get doesn't offer a solution to a conflict and for visualizing dependencies in general. (Synaptic is also available in Ubuntu.)

Aptitude's conflict resolver will walk you through the possible combinations of installed/removed/upgraded/etc packages that satisfy your requested actions without conflict. This can often be successful even when apt is unable to find a solution. As an Ubuntu user, situations don't normally arise that require you to investigate why a particular package is being installed or causing a conflict, but it's almost inevitable as you use the system more.

Voted up for mention of Aptitude conflict resolver. There are times when it is essential to use advanced tools like this to determine what the possibilities are and to pinpoint the core conflict. +1 aptitude just saved my bacon in the face of a GTK3 conflict. apt-get was no help at all. What I like is sudo aptitude --full-resolver my_package . That usually gives The following packages have unmet dependencies and a list among which 7) <my_package> [Not Installed] (7 is just an example). At each step aptitude offers new choices. What worked for me was to choose first 7 , then r 7 (which corresponds to the description Rejecting the removal of my_package ), and then n (for NO) as the choices before that were not what I wanted: but after that new choices offered downgrading some packages along with installing my_package; so, last, Y (for YES)

package1 : Depends: package2 (>= 1.8) but 1.7.5-1ubuntu1 is to be installed

Explanation of the message:

  1. In order for your installation to be completed, package1 needs package2.
  2. package2 has to be available in version >= 1.8
  3. The package manager checked all repositories and only found version 1.7.5-1ubuntu1 that could be installed, which it won't do because it is < 1.8

There is NO single right answer for this question and there is NO simple answer.

There are many scenarios why this can happen and one has to investigate all options and try to solve the preconditions that lead to this error.

Scenario A:

All the repositories that you have access to don't have package2 in version >= 1.8, so you will have to find a repository that does. If you are not able to find a repository with versions >=1.8 then you might have to build and install package2 from source. And then try to install package1.

If you want to know how to build a package from source, check other questions/answers or post a new one.

Scenario B:

The repositories do include package2 in a version >= 1.8 but the package manager still wants to install an older version (1.7.5).

The reason for this may be that the later versions of package2 where built by some newer technology that is not supported by other packages that you already have installed.

This might not be possible to fix at all. You can try to use apt or synaptic and look for all versions of the package2 that are available in the repositories, and try to install a specific version >= 1.8

If you have other incompatible packages and you do this, you will get a list of similar error messages for all the other packages that prevent the installation of package2>=1.8.

In this case, you have a bigger problem. You wanted to install package1, which needs package2 to be >= 1.8, but package2 in version >=1.8 requires package3 to be in version >= 6.7 and you have package3 version 6.3

The thing is that the package manager (APT) tries to solve all these dependencies automatically if it is possible. When it says that it is not possible (and issues a message like in the question), then you should trust it.

If you decide not to trust the package manager and if you are sure that you will not have problems, then you can try to force install the specific needed versions of all packages, one by one, and hope to be OK.

Beware, doing this for system packages can create serious problems. You can lock yourself out of the system, block critical services etc.

Scenario C:

No matter the reasons for the problem, you can always setup for manual compilation and build the needed package and all of it's dependencies in the exact needed versions from source. With this option you can keep what you built in a separate directory and out of the system path so that it will not create conflicts with the system. This is probably the cleanest solution, and sometimes can be faster to do.

Scenario D:

Package manager has access to out-dated information about packages and therefor cannot find a solution. Look in the other answers.

Scenario E:

Package manager has a bug in the dependency resolution code.

You have to investigate that this is really the case, and then issue a bug request.

Scenario Z:

There might be other scenarios.

For example package maintainers could have been wrong and did not check that package1 would work even with version of package2 < 1.8 and in the specification they set wrong dependencies.


If sudo apt-get install -f <package-name> doesn't work, try aptitude:

Aptitude will try to resolve the problem.

As an example, in my case, I still receive some error when try to install libcurl4-openssl-dev :

So i try aptitude, it turns out I have to downgrade some packages.

1,451 2 2 gold badges 7 7 silver badges 4 4 bronze badges aptitude did the trick for me. Had to try a couple solutions down from the initial one, but it eventually got there. Great tip!! aptitude may corrupt the whole system, using apt and aptitude together might remove all the packages if you are not using carefully enough! I had a really messy dependency problem. Tried many commands with apt-get including -f install with no avail. The simple "sudo aptitude install" completely resolved the issue. I had the same problem installing a lot of packages. This solution works. For all "Keep the following packages at their current version?", say "No". For all "Downgrade the following packages", say "Yes"

First of all try this

If error still persists then do this

Afterwards try this again:

But if it still couldn't resolve issues check for the dependencies using sudo dpkg --configure -a and remove them one-by-one . Let's say dependencies are on npm then go for this ,

Then go to /etc/apt/sources.list.d and remove any node list if you have. Then do a

Then check for the dependencies problem again using sudo dpkg --configure -a and if it's all clear then you are done . Later on install npm again using this

Then install the Node.js package.

The answer above will work for general cases also(for dependencies on other packages like django ,etc) just after first two processes use the same process for the package you are facing dependency with.

The command to have Ubuntu fix unmet dependencies and broken packages is

from the man page:

-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 dselect(1) or dpkg --remove to eliminate some of the offending packages)

Ubuntu will try to fix itself when you run the command. When it completes, you can test if it worked by running the command again, and you should receive output similar to:

Reading package lists. Done Building dependency tree Reading state information. Done 0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

Это происходит, когда вы пытаетесь установить что-то в системе apt через терминал, и установка завершается неудачно без каких-либо явных проблем. Эта проблема не ограничивается какой-либо одной конкретной программой, но может случиться и с некоторыми из них. Это связано с тем, что проблема заключается в системе apt, а не в программе, которую вы устанавливаете.

К счастью, для этого есть довольно много решений, некоторые из которых проще сделать, а другие сложнее, но если вы будете следовать инструкциям, описанным ниже, вы сразу же избавитесь от ошибки.


Примечание. Перед выполнением любого из методов рекомендуется создать резервную копию файлов конфигурации, таких как так что вы можете отменить любые изменения в случае, если что-то пойдет не так. Это делается с помощью следующих шагов:


  1. Нажмите одновременно Alt, Ctrl и T на клавиатуре, чтобы открыть терминал.
  2. Введите и нажмите Enter.
  3. Когда предыдущая команда завершит работу, введите sudo cp / var / lib / dpkg / status /var/lib/dpkg/status.original и снова нажмите Enter.

Способ 1: использовать параметр -f

  1. Открыть Терминал нажав Ctrl, Alt а также T одновременно на клавиатуре.
  2. Введите sudo apt-get install -f и нажмите Войти выполнить это.
  3. Как только это будет сделано, введите sudo dpkg –configure -a, Нажмите Войти запустить его и запустить команда из шага 2 еще раз.

Метод 2: Используйте Aptitude

уместность является альтернативой APT-получить который вы можете использовать в качестве менеджера пакетов более высокого уровня. Вы можете использовать его, чтобы попробовать установить пакет вместе с ним, вместо apt-get, но сначала вам нужно установить уместность.

Способ 3: убедитесь, что репозитории с ограничениями и юниверсами включены, и попробуйте лучший сервер

Способ 4: очистить базу данных пакетов

  1. sudo apt-get clean очистит локальный репозиторий от всех извлеченных файлов пакетов (.deb). Он удалит все, кроме файлов блокировки, из / var / cache / apt / archives и / var / cache / apt / archives /partal /.
  2. sudo apt-get autoclean также очистит извлеченные файлы, но в отличие от предыдущей команды, эта команда удаляет только те пакеты, которые вы больше не можете загружать и которые практически бесполезны.

Метод 5: Удалите все удержанные пакеты

Удерживаемые пакеты на самом деле удерживаются, потому что существуют проблемы с зависимостями и конфликты, которые склонный не могу решить. Исключение таких пакетов означает, что таких конфликтов не будет, и, следовательно, может решить вашу проблему.

  1. Открыть Терминал нажав Ctrl, Alt а также T
  2. Введите sudo apt-get -u dist-upgrade и нажмите «Если есть какие-либо удерживаемые пакеты», он покажет их, и вы можете их устранить.
  3. Сначала попробуйте запустить

sudo apt-get -o Debug :: pkgProblemResolver = да dist-upgrade

Способ 6: очистить / удалить / отключить PPA

Личные архивы посылок являются репозиториями, которые размещены на Launchpad и используются для обновления или установки пакетов, которые обычно не доступны в официальных репозиториях Ubuntu. Они чаще всего являются причиной неудовлетворенных зависимостей, особенно когда они используются для обновления существующего пакета из репозитория Ubuntu. Вы можете отключить, удалить или удалить их.

запрещать означает, что пакеты, установленные из этого PPA, больше не будут получать обновления.

  1. Нажмите одновременно Alt а также F2, и беги ПО-свойства-GTK.
  2. От Другое программное обеспечение На вкладке вы найдете две строки для каждого PPA, где одна для исходного кода, а другая для скомпилированного пакета. Чтобы отключить PPA, вы должны снимите обе строки

чистка означает, что все пакеты в выбранном PPA будут понижены до версии в официальных репозиториях, а также отключат PPA. Чтобы установить PPA Purge, вы можете использовать sudo apt-get установить ppa-purge, но учитывая, что склонный сломан, вы должны использовать эту команду в Терминале (Alt, Ctrl а также T одновременно Войти бежать):

Далее беги sudo ppa-purge ppa: someppa / ppa для очистки выбранного PPA. Однако, поскольку PPA Purge по-прежнему не удаляет PPA, вы можете использовать приведенные ниже команды для удаления PPA. Не обращайте внимания на первое, если ваши намерения не включают удаление установленного пакета.

После этого вы сможете установить необходимый пакет.

Несмотря на то, что выше приведено довольно много методов, вы также должны знать, что всегда лучше предотвращать такие проблемы. Вы должны поддерживать свою систему в актуальном состоянии, использовать только надежные PPA и выполнять резервное копирование, когда все работает правильно, чтобы вы могли восстановить позже. Однако, если вы забыли заняться этими вещами, используйте описанные выше методы, чтобы решить вашу проблему, и используйте методы предотвращения, чтобы убедиться, что вы не

I am writing this because I am very confused about installing PostgreSQL 9.3 on my Ubuntu 14.04. First I need it for my Python/Django development, and I ran into the problem when I tried to install it. Now I have this error and it is driving me crazy:

I have found some solutions online (How do I resolve unmet dependencies after adding a PPA?), and I did everything to the Preventive Measures part, because I have had some broken packages problem, and again after I had this error show to me again.


1,056 2 2 gold badges 11 11 silver badges 23 23 bronze badges


1,026 3 3 gold badges 11 11 silver badges 20 20 bronze badges

6 Answers 6

You can install the package using.

make sure the repo sources are up to date

To Install the package.

Once the package determines that you have some missing dependencies, run the following command to fix broken or missing dependencies.

Above command will only download the missing dependencies if you have already installed the package.

29.8k 22 22 gold badges 110 110 silver badges 170 170 bronze badges


Thank you, I thought it meant use sudo apt-get install -f packagename and was getting the same error.

I know I'm a bit late, but none of the above solutions worked for me. What really solved my problem was to use aptitude instead of apt-get. aptitude will suggest resolutions to the problem.

Simply run these:

aptitude will suggest dependencies resolution for you e.g:

as discussed in this post.


1,056 2 2 gold badges 11 11 silver badges 23 23 bronze badges The crucial thing for me was that aptitude was willing to suggest downgrading packages whereas apt was not. This offered me the solution of removing a third-party package from a PPA and resetting it to the stock Ubuntu version which fixed all my dependency issues.

Sometimes the dependencies that need fixing are unrelated to the program you are trying to install. In my case it was giving off this error:

The following have unmet dependecies

shashlik : Depends: libc6-i386 but it is not going to be installed

Depends: lib32gcc1 but it is not going to be installed

Depends: lib32z1 but it is not going to be installed

It turned out that I had tried to install a program called "Shashlik" and the installation had failed. So I ran the code:

This seemed to fix the error as my program then installed. I am not sure how much the second command helped but I put it there in case it was necessary for the solution to work.


At the risk of replying late, the error was given to me when I tried to install the package, I just had to read the error message.

Let me share with other people my experience with installing postgresql-9.3 . First of all I have been struggling with this for about 4/5 days, and I finally manage to do it.

All went wrong with these nasty errors I have shared in my first post, as I have tried to google it and discover that people have more less the same error, or struggling to solve a similar one.

Long story short, you have a very nice answer here how to resolve unmet packages:

My mistake was that I have made duplicated repository, and the answer in this link solved that, this command sudo apt-get install -f just made another error, you must do this manually, at least I did it (read to the section Preventive Measures, but you could read to the end, it is an imba post).

Читайте также: