Линукс как исправить ошибки в пакетах

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

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

Как исправить у вас зафиксированы сломанные пакеты?

1. Обновите списки пакетов

Возможно вам не удалось установить нужные пакеты потому что списки репозиториев устарели, и там ещё не было нужных пакетов. Для обновления списка пакетов выполните:

sudo apt update --fix-missing

2. Установите битые пакеты

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

sudo apt install -f

3. Очистите лишние пакеты

Установке могут мешать лишние пакеты, которые больше не нужны в системе. Для их удаления выполните:

sudo apt clean

Затем:

sudo apt autoremove

Утилита отобразит список всех битых пакетов, которые не установлены, вы можете попытаться их удалить с помощью команды:

sudo dpkg --remove -force --force-remove-reinstreq имя_пакета

4. Используйте dpkg

Вместо apt вы можете использовать команду dpkg чтобы посмотреть какие пакеты вызывают проблему. Просто выполните:

sudo dpkg --configure -a

Команда покажет проблемные пакеты, а потом вы сможете их удалить той же командой:

sudo dpkg --remove -force --force-remove-reinstreq имя_пакета

5. Разрешите зависимости

Битые пакеты чаще всего появляются из-за того, что пакетный менеджер не может найти для них нужные зависимости. Если вам всё же очень нужно установить такой пакет, просто разрешите эти зависимости. Для этого можно скачать и установить их вручную или если вы уверенны, что зависимости в пакете указаны неверно, можно скачать его распаковать и удалить мешающие зависимости. Подробнее об этом читайте в этой статье.

Выводы

В этой небольшой статье мы рассмотрели что делать если в вашей системе появились битые пакеты и как их исправить. Здесь решение проблемы очень сильно зависит от вашей ситуации, но здесь приведены основные варианты решения, которые должны помочь вернуть пакетный менеджер к работе. Иногда рекомендуют удалить пакет вручную из базы данных dpkg /var/lib/dpkg/status, однако лучше этого не делать и найти путь решить проблему по другому, ручное редактирование подобных файлов может создать ещё больше проблем.

Обнаружили ошибку в тексте? Сообщите мне об этом. Выделите текст с ошибкой и нажмите Ctrl+Enter.

Creative Commons License

Статья распространяется под лицензией Creative Commons ShareAlike 4.0 при копировании материала ссылка на источник обязательна .

Об авторе

Основатель и администратор сайта losst.ru, увлекаюсь открытым программным обеспечением и операционной системой Linux. В качестве основной ОС сейчас использую Ubuntu. Кроме Linux, интересуюсь всем, что связано с информационными технологиями и современной наукой.

Introduction

Linux packages are compressed archives containing programs and files necessary to run them. The package distribution system is designed to be robust and simplify the application installation process.

However, a bad internet connection or misconfigured third-party installers can corrupt packages and cause problems on your system.

This article will show you how to troubleshoot and fix broken packages on Ubuntu using the available APT and DPKG tools.

How to fix broken packages in Ubuntu

Prerequisites

  • An account with sudo privileges
  • An Ubuntu system

Check for Updates

Start troubleshooting by rebuilding the list of dependencies. The --fix-missing option tells APT to ignore missing packages. The option ensures the update process is performed without APT returning an error.

sudo apt update --fix-missing
The --fix-missing option tells APT to ignore the missing packages

Force APT to Correct Missing Dependencies or Broken Packages

Missing package dependencies are a common reason for package-related errors.

1. Use apt install with the -f flag to tell APT to locate the missing packages and install them.

sudo apt install -f

APT lists the missing packages on your system.

The apt install tells APT to locate the missing packages and install them

2. Press ENTER to start the installation.

Note: If troubleshooting has led to Ubuntu needing to be reinstalled, please refer to our reinstallation guide How to Reinstall Ubuntu.

Force Reconfigure or Remove Broken Packages with DPKG

Broken packages may cause package manager configuration problems.

1. Reconfigure DPKG, the base package management system, with the following command:

sudo dpkg --configure -a

2. Check if DPKG marked some packages as needing a reinstall.

sudo dpkg -l | grep ^..R

3. If the command above returns a list of one or more packages, try removing the packages by typing:

sudo dpkg --purge --force-all [package-name]

The example below shows how to remove the corrupted vlc-plugin-base package.

Remove the corrupted vlc-plugin-base package

Warning: The dpkg --purge --force-all command removes a package even if the removal causes further dependency issues. Use the command with care.

4. After you finish troubleshooting, run the following command to clean up the system:

sudo apt clean

5. Then update the repositories again:

sudo apt update

Resolve DPKG Lock Issue

The DPKG lock error appears when trying to install a package while another process is using DPKG.

The DPKG lock error appears when trying to install a package while another process is using DPKG

However, sometimes the error occurs even if no other processes are using the package management system.

1. To fix the problem, remove the lock file manually:

sudo rm /var/lib/apt/lists/lock

2. Also, remove the lock in cache:

sudo rm /var/cache/apt/archives/lock

Deleting the lock enables you to use APT and DPKG again.

Conclusion

The article provided common ways of resolving problems caused by broken packages on Ubuntu.

For more information related to package management on Ubuntu, read:

  • How to List Installed Packages on Ubuntu
  • A Comprehensive Guide to Using Snap Packages on Ubuntu
  • How to Install Deb Files (Packages) on Ubuntu

Linux package managers, like Apt and DNF, are extremely powerful and intuitive, but that doesn’t mean things can’t go wrong. Occasionally, a package install goes wrong, and you’re left to pick up the pieces. Package managers have the ability to fix broken packages and skip broken updates to get your system working again and avoid troubles in the future.

This article covers how to fix broken packages in Linux. These fixes should help you get unstuck in most instances.

Content

  • Fixing Broken Packages in Ubuntu/Mint/Debian
  • Fixing Broken Packages in Fedora/CentOS/RHEL
  • Fixing Broken Packages in Arch
  • Frequently Asked Questions

Fixing Broken Packages in Ubuntu/Mint/Debian

Apt has a couple of flags to fix missing dependencies or packages that broke for one reason or another during install. A common use here would be installing a third-party .deb and finding that it had dependencies you didn’t know about. Those dependencies probably won’t be pulled in on their own, and dpkg will complain that it can’t resolve dependencies. In any case, you can try the following steps:

Note: learn how Apt works before attempting any of the fixes below.

Linuxpackages Fixmissing
  1. Run an update to make sure there aren’t newer versions of the required packages:
 sudo apt --fix-missing update
  1. Force Apt to look for and correct any missing dependencies or broken packages when you attempt to install the offending package again. This will install any missing dependencies and repair existing installs:

Fixing DPKG Configuration Issues

Another place where an error can pop up in package installations is the configuration process. Behind the scenes, dpkg takes care of this part, so when a package fails during configuration, dpkg is the tool to fix it.

Linuxpackages Configuredpkg
  1. Start by trying to force dpkg to reconfigure any broken or partially configured packages:
  1. If that doesn’t solve the problem, take a more forceful approach. Start by listing any packages that dpkg marked as requiring a reinstall:

The above command will show you the packages that cause problems. For this next step, check and make sure that the packages marked for reinstall are really broken. Do a sudo apt reinstall and pay attention to which packages fail to reinstall.

  1. For each package that fails to reinstall, get the name and forcibly remove the broken package:
sudo dpkg --remove --force-remove-reinstreq [package name]
  1. Dpkg should now be clean. Do a cleanup with Apt:
sudo apt clean && sudo apt update

With any luck, that’ll get you back to where you started. It won’t get you the broken packages that you tried to install, but at least Apt will be functional again, and you can go back to using it to attempt to install the package you were originally trying to install and its dependencies.

Permanent DPKG Lock

There’s a less common issue with dpkg locks preventing you from doing anything. Every time you try to use Apt or dpkg, you get an error saying another application is already using it … when it isn’t.

It’s easy to delete the lock file preventing you from using Apt and getting back to doing what you need to. Sometimes these lock files remain in place after an install error or power outage, derailing the process and preventing the file from being removed automatically. In this case, you’ll need to do it yourself.

sudo rm /var/lib/apt/lists/lock

For good measure, delete the lock in the cache.

sudo rm /var/cache/apt/archives/lock

Warning: Before removing this lock, make sure that it’s not being used. In Ubuntu, there’s an updater that starts up together with the system that locks DPKG/APT when it’s searching for updates. If you’re unsure whether the updater is running, press your Win key to bring up the Activity Center and type “Software Updater,” then press Enter to open it.

Linuxpackages Ubuntuupdater

If the updater says that it can’t run, and you have no terminals open with package managers running in the background, go ahead with the above instructions.

If instead of the broken packages issue you are facing an issue with the Software Center not working, we have the fixes.

Fixing Broken Packages in Fedora/CentOS/RHEL

Fixing broken packages in Fedora/CentOS/RHEL is a less common affair. dnf does really great work making sure packages are installed correctly. That said, it’s still not perfect, and things will sometimes get mixed up in package management.

Note: learn the differences between Fedora, CentOS and RHEL.

1. List Troublesome Packages

The command to sort this out on RHEL-based systems like Fedora is:

Linuxpackages Rpmverify

The -V option is to verify, meaning it will go through and compare information on the installed files with the information stored in the rpm database. Attaching -a to this just verifies all core packages. This is slightly unhelpful, as it will usually give you a long list of files, but it can give you somewhere to start if you’re having issues with a particular application.

For example, seeing something marked as “missing” in your terminal will tell you that there are missing files in that particular package.

2. Attempt a Reinstall

Run a dnf reinstall on any packages you see in that list that might be giving you trouble.

sudo dnf --refresh reinstall [package name]

That will set all metadata as expired, so it will crawl through every repository you have enabled and look for a new version of that package. If you find that there are broken dependencies with that package, DNF will probably complain and tell you to use the --skip-broken flag. This will just skip that package entirely and let you update your system normally.

3. The Last Resort – Remove Packages

If you’ve reached the point where you have to use --skip-broken to complete your updates, it’s more hygienic for your system to remove it entirely.

Remembering the name of the package you failed to properly reinstall, uninstall it:

sudo dnf remove [package name]

The worst that could happen here is that you end up removing a core part of your daily flow, such as your browser, forcing you to find an alternative.

Tip: learn how to use flatpak in Fedora to better manage your packages.

Fixing Broken Packages in Arch

Although Arch’s package manager has some similarities to the others listed here (i.e, it has a database lock file and pulls dependencies in a similar way), it’s an entirely different beast of its own when it comes to how its logic is structured. The first step in diagnosing your issue is to make sure that the repositories are up to date and attempt a full upgrade:

If your attempts to install your package or do a system upgrade are still ending in failure, we have to isolate the cause according to what the terminal told you:

Note: learn how pacman works before you attempt to fix it.

“Invalid or Corrupted Package”

Making changes to “pacman.conf” in any manner can cause issues that cause pacman to incorrectly label packages as corrupt. The most likely culprit here is a partial (“.part”) file in the package manager cache, and your solution is to remove it:

sudo find /var/cache/pacman/pkg/ -iname "*.part" -delete

There’s always a chance that the package you’re trying to install is indeed corrupt and doesn’t provide valid metadata to Arch’s package manager. In that case, you’ll have to wait for the package maintainer to update it. If the package is installed on your system and causing problems during an upgrade, remove it with:

sudo pacman -Rns [package name]

“Unable to Lock Database”

Like Debian’s apt, Arch’s package manager makes a lock file during operations. If you experienced a power outage or pacman experienced a hard interrupt and couldn’t remove the lock, it’s very likely to leave behind a lock file.

First, find out if some process on your computer is still using the file:

sudo fuser /var/lib/pacman/db.lck
Linuxpackages Lockpid

In the image above, a process with ID 121497 is using the file lock. If you’re curious about the process and want more information, use ps:

Linuxpackages Pspid

In my case, another pacman instance owns the lock file. The safest way to remove the lock is to first kill that process:

Now that the process is dead, remove the lock file:

sudo rm /var/lib/pacman/db.lck

You’re good to go now!

“Conflicting Files/File Exists in Filesystem”

This happens during upgrades where pacman detects a conflict of ownership. Before fixing anything, pay attention to the path to the file that the package manager is complaining about.

To find out who owns the file:

pacman -Qo [path to the file]

If it’s owned by a user and not another package, just remove it:

sudo rm [path to the file]

If it’s owned by another package, the safest thing to do is wait for the package’s maintainer to fix this conflict themselves. Sometimes that’s not an option, though, and you want to get things done now.

The simplest way to accomplish this is using the --overwrite flag in pacman. Just know that this is generally unsafe and could lead to some applications not working correctly in your system. I suggest making a backup prior to running this.

The --overwrite flag allows Arch’s package manager to ignore ownership rules for a particular file and just steamroll through the update. Example:

sudo pacman -Syu --overwrite [file name]

If the above command doesn’t work, replace the file name with its absolute path. Some users have reported that removing the leading slash (“/”) in front of the path makes the command work when it’s being stubborn.

Alternatively, you could also just tell pacman to overwrite everything it needs to:

sudo pacman -Syu --overwrite='*'

“Invalid or Corrupted Package (PGP Signature)”

Linuxpackages Pgp

In some packages that are poorly maintained, the developer may not have the time or willingness to properly update the digital signature that certifies their package. This will eventually result in a message in your terminal while trying to install it, such as, “signature from [someone] is marginal trust,” followed by the package manager asking if you’d like to delete the file.

Because signature updates depend entirely on the maintainer, there’s nothing you can realistically do to fix the situation from your terminal. If you’re doing an update and want to keep the package, use the --ignore flag for that package in particular:

sudo pacman -Syu --ignore [package name]

If you get this for many packages, your keyring might be out of date. Update it with:

sudo pacman -S archlinux-keyring

Frequently Asked Questions

Can I apply the Arch Fixes with an AUR helper?

Generally, yes. Replace “pacman” with your AUR helper in the commands in this guide. Example: yay -Qo /path/to/file

What should I do if I interrupt an update?

Breaking an update process either by pressing Ctrl + C , killing the package manager’s process, or closing the terminal prematurely will result in some level of corruption in your package database that could complicate things when you try to install something else. To fix this, clear the cache and repeat the update.

Image credit: Flickr. All screenshots by Miguel Leiva-Gomez.

Miguel Leiva-Gomez

Miguel Leiva-Gomez

Miguel has been a business growth and technology expert for more than a decade and has written software for even longer. From his little castle in Romania, he presents cold and analytical perspectives to things that affect the tech world.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

One of the best things about Linux is the apt command which lets you install applications and software effortlessly. Using apt, you don’t have to go through downloading the software, then going through the installer and clicking ‘Next’ a dozen times. It makes sure that every software is installed with just one terminal command.

But, just like any other program, things can go wrong. The error that we will be talking about in this write-up looks something like the following:

E: Unable to correct problems, you have held broken packages.

This error may occur when you are trying to install something via the apt utility. Let us look into the error in detail and try to solve the problem.

What causes this error?

Some of the software (mostly third-party ones) do not come with compatible dependencies and apt expects that your system already has those components. In case the required components aren’t found on your system, apt throws an error related to broken packages which means that the package you are trying to install is incomplete.

Outdated repositories, problems with the ‘sources.list‘ file, or an old/unsupported version of Linux might be the cause of this problem.

Methods to fix this problem

Before moving to the advanced methods, let us try a few quick tricks that can potentially help:

Method 1: Update the repositories

The apt update is a well-known command which instantly updates the list of packages and their dependencies. As the problem we are facing is due to missing dependencies, there is a good chance that this command will fix the error.

If the problem persists, try this command:

This will update the existing packages on your system to the latest version.

Method 2: Use aptitude instead of apt

Aptitude is also a package manager like apt and it surprisingly works in some situations where apt doesn’t! all you need to do is use aptitude instead of apt.

For example, suppose you want to install BIND9 using aptitude, you will have to enter the following command:

sudo aptitude install bind9

If you don’t have aptitude installed, run the following commands:

sudo apt-get update
sudo apt-get install aptitude

Method 3: Use autoremove to get rid of unnecessary packages

Sometimes, unnecessary packages stay behind even after uninstalling their parent application. These residual packages might interfere with installation of new applications or libraries. To get rid of these unnecessary residual packages, just enter the following command into the terminal:

There’s no need to worry as autoremove will only handle the leftover packages and dependencies.

Now with the basics out of the way, we will look at some more advanced methods to solve this problem.

Method 4: Look for held packages and unhold them

As the error message suggests, the problem is caused by packages on hold. The term ‘held package’ means that it can’t be upgraded, removed, or modified in any way.

To get a list of held packages, you need to enter the following command:

To unhold a specific package, enter:

sudo apt-mark unhold <package-name>

To unhold all held packages, enter:

sudo apt-mark unhold $(sudo apt-mark showhold)

Method 5: Use the synaptic package manager to fix broken packages

Originally, Linux doesn’t have an inbuilt graphical package manager like Windows. This is why the synaptic package manager became immensely popular on Debian-based distributions made for personal computers as it provided a lightweight and robust GUI package manager.

One of the key features of this utility is that you can fix broken packages very easily. Follow the steps below:

1. First, install the synaptic package manager:

sudo apt update
sudo apt install synaptic

2. Run synaptic with superuser privileges:

3. Go to Edit > Fix Broken Packages

Fix Broken Packages In Synaptic

Fix Broken Packages In Synaptic

It will take some time if there are broken packages present. Check if the problem is resolved.

References

  • Ask Ubuntu – Unhold a package
  • Ask Ubuntu thread on the same problem

Summary

In this article, we saw five different methods to fix the error “Unable to correct problems, you have held broken packages.” All the methods discussed were easy to execute and I hope you were able to fix the problem on your system. If you are still facing the same issue even after trying all the above methods, it can be because of using an unsupported Linux distribution, in which case, you will have to consider upgrading to a newer version of it.

APT is one of the most popular program in Ubuntu/Debian. Most of the time, the application works flawlessly without any issues. But sometimes, you may see “Unable to correct problems, you have held broken packages” error message pops up. This error, along with “apt-get : command not found” are two of the most popular error message when it comes to apt or apt-get in Linux.

This short article is going to show you what cause the “Unable to correct problems, you have held broken packages” error and what you can do to fix it.

The error message may look something like this :

Reading package lists... Done
Building dependency tree       
Reading state information... Done
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:
 ffmpeg : Depends: libavcodec58 (= 7:4.1.6-1~deb10u1)
          Depends: libavdevice58 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
          Depends: libavfilter7 (= 7:4.1.6-1~deb10u1)
          Depends: libavformat58 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
          Depends: libavresample4 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
          Depends: libavutil56 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
          Depends: libpostproc55 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
          Depends: libswresample3 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
          Depends: libswscale5 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
E: Unable to correct problems, you have held broken packages.

Linux systems follow Unix design philosophy : Make each program do one thing well. That means a complex program has to rely on smaller ones to do its many small jobs.

For example, the VLC media player needs libavcodec, libavutil, libgles2 and a whole bunch of other packages to be able to work properly. Those small libraries and software components are called dependencies. These dependencies may not be part of the application package itself, but they are expected to either be installed on your system already or installed during the installation of the application.

“Unable to correct problems, you have held broken packages” error simply means that the software you attempted to install requires certain other packages (dependencies) in order to function properly. However, those dependent packages are themselves broken or unavailable,.

The “Unable to correct problems, you have held broken packages” error usually comes with other information about which libraries/programs needs to be installed but the system is unable to install them. In the message above, it is python-pip-whl.

The situation may get more complicated when two programs, let’s say VLC and Gnome Video Player need different versions of the same library. APT, in that case, cannot figure out how to install both version and raise “Unable to correct problems, you have held broken packages” error.

"Unable to correct problems, you have held broken packages"**

Make sure local package index is up-to-date

If you’re installing a well-known software, it is very likely that it was tested thoroughly by the original developers as well as Ubuntu/Debian team before adding to the package directory.

In other words, maintainers made sure the software works flawlessly with the system, so updating your local package index is a easiest way to get rid of the “broken packages” error.

You can resynchronize the package index files from their sources on Ubuntu via the Internet by running the following command.

sudo apt update

Once the update process is done, try reinstalling the troublesome package again to verify that the error has gone.

Install the dependency

If trying to install the troublesome package again results in the same dependency error, the dependency may not be available for your distribution version.

Use the apt search command to search for the dependency package or alternative names:

sudo apt search package_name

If the package is found, is it the same version required by the package you want to install?

Try installing the dependency package and see what happens:

sudo apt install dependency_package

You may encounter a dependency chain, where dependency A requires B, which requires C, and so on.

It’s also possible that package C is already installed but not the required version. Check C’s version. If it’s the same version needed by package B, try uninstalling and reinstalling C.

Remove left-over packages from your system

Aside from updating package index, removing unused packages from your system usually helps in case you keep encounter “Unable to correct problems, you have held broken packages” error.

Every time you install a program, its dependencies get installed, too. But after you remove the program, some of the dependencies are left over. Those left-over dependencies rely on other programs, and APT needs to keep track of that information, too. APT has an autoremove command that helps clean your system from residual packages.

sudo apt-get autoremoveCode language: JavaScript (javascript)

Try to search and install the dependency again

If you have tried the two solution above but the error message still persist, the dependency may not be available for the distribution version you’re running.

You can use apt search to look up the package index for the troublesome dependency.

sudo apt search package_name

If the package is available, inspect it to see whether it’s the same version that the system is searching for (specified in the error message). Then, try to install the dependency package and see what happens next.

sudo apt install dependency_package

At this point, you may encounter a dependency chain. Basically, the software A depends on B, then B rely on C, but C is not available for your distribution version.

It may also happen that when you try to install package C, it is already installed. In that case, check the version of package C. Is it the same version as required by package B? If yes, then removing C and installing it again could help.

Directly install the package from DEB file

If the missing dependency cannot be found by apt search, you may try to install either the package or its dependency directly from a DEB file.

For example, in the apt-get output, you can see that one of the many packages FFMPEG needed is libavcodec58 version 4.1.6-1~deb10u1.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
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:
 ffmpeg : Depends: libavcodec58 (= 7:4.1.6-1~deb10u1)
          Depends: libavdevice58 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
          Depends: libavfilter7 (= 7:4.1.6-1~deb10u1)
          Depends: libavformat58 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
          Depends: libavresample4 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
          Depends: libavutil56 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
          Depends: libpostproc55 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
          Depends: libswresample3 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
          Depends: libswscale5 (= 7:4.1.6-1~deb10u1) but 7:4.3.1-6~bpo10+1 is to be installed
E: Unable to correct problems, you have held broken packages.

With this information, you can do a quick Google search or a web-based tool like PKGS.org to find the corresponding DEB file. Once you’ve downloaded the DEB, install it by running the following command :

sudo dpkg -i libavcodec58_4.1.6-1~deb10u1_amd64.debCode language: CSS (css)

After that, just re-install the troublesome package.

Find the package somewhere else

If you’re trying to install legacy packages, the “Unable to correct problems, you have held broken packages” error wold be raised a lot. In this case, installing individual dependencies can quickly become inconvenient. Your best bet in this situation is to find another installation source, usually a PPA.

Suppose you’re trying to install FFMPEG 4, doing a quick search, you would easily find Jonathon F’s PPA. You can simply add his PPA to your system before actually re-run apt-get install ffmpeg to install the software.

sudo add-apt-repository ppa:jonathonf/ffmpeg-4
sudo apt-get update
sudo apt-get install ffmpegCode language: JavaScript (javascript)

Alternatively, you can try to look for the same software packaged in other formats, such as Snap/Flatpak or AppImage.

If you see the held broken package error during update try this

Most of the solutions above assumed that you see this error while installing a new application. That may not always be the case.

If you see this error when you try updating your system with sudo apt update , you may have to take a slightly different approach.

First, check which package is being held with this command:

dpkg --get-selections | grep holdCode language: JavaScript (javascript)

If you see any package held back from updating, you can either remove it (sudo apt-get remove) using or unhold it with the following command

sudo apt-mark unhold package_name

The package would be unheld and a confirmation message would be returned : Canceled hold on package_name..

Try apt instead of apt-get

Aptitude is an alternative package manager for Debian-based Linux distributions like Ubuntu. It functions similarly to apt, allowing you to install, update, and remove software packages. However, aptitude can sometimes handle package management tasks that apt fails to accomplish.

To use aptitude in place of apt, you simply substitute ‘aptitude‘ for ‘apt‘ in your package management commands.

For example, to install the vlc package using aptitude, run:

sudo aptitude install vlc

If you do not already have aptitude installed, you can obtain it by running:

sudo apt-get update<br>sudo apt-get install aptitudeCode language: JavaScript (javascript)

Fix dependencies error with Synaptic Package Manager

Unlike Windows, Linux distributions originally lacked a graphical user interface for managing software packages. The Synaptic Package Manager helped address this, providing a simple yet effective GUI package manager, especially useful for novice Linux users.

One of the key benefits of Synaptic is its ability to easily repair broken or damaged package dependencies. To fix broken packages with Synaptic, follow these steps:

First, install Synaptic package manager on your system using the commands:

sudo apt update<br>sudo apt install synapticCode language: HTML, XML (xml)

Open Synaptic by running the command: sudo synaptic as an administrator (using sudo). This will launch the Synaptic Package Manager interface.

In Synaptic window, go to the Edit menu and select “Fix Broken Packages“.

This may take some time if there are a significant number of broken packages to repair.

Once the repair process completes, check if the package installation issues you were encountering have been resolved.

Synaptic provides an intuitive graphical interface for managing packages on Debian/Ubuntu. Its “Fix Broken Packages” feature is particularly useful for troubleshooting dependency conflicts or other problems that may be preventing software from installing properly via the command line.

Conclusion

There is no straightforward fix for this problem. You’ll have to investigate the problem on your own and see if the error can be fixed or not. If you find this article helpful, consider checking out our other guide on fixing “apt-get : command not found” – another popular apt-get error message that caused confusion among our readers.

Please share in the comments if your problem gets fixed or not, you will receive the help from us and the community.

Понравилась статья? Поделить с друзьями:
  • Как составить опрос граждан
  • Как найти пару в турции
  • Оторвались обои как исправить
  • Как найти варианты данного измерения
  • Как найти произведение разницы чисел