Apt исправить ошибки

Во время установки программ с помощью пакетного менеджера 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, интересуюсь всем, что связано с информационными технологиями и современной наукой.

  1. How do you fix apt — fix broken install?
  2. What does APT — fix broken install do?
  3. How do you fix try apt — fix broken install with no packages or specify a solution?
  4. How do I fix a broken Ubuntu update?
  5. Why sudo apt-get update is not working?
  6. How do I fix sudo apt-get update?
  7. How do you resolve a break in electricity?
  8. How can I fix Ubuntu OS without reinstalling it?
  9. What is sudo dpkg — configure?
  10. How do you fix a broken pop OS package?
  11. How do I fix broken packages dependencies?
  12. How do I fix broken packages in Kali Linux?

How do you fix apt — fix broken install?

Ubuntu fix broken package (best solution)

  1. sudo apt-get update –fix-missing.
  2. sudo dpkg –configure -a.
  3. sudo apt-get install -f.
  4. Unlock the dpkg – (message /var/lib/dpkg/lock)
  5. sudo fuser -vki /var/lib/dpkg/lock.
  6. sudo dpkg –configure -a.

What does APT — fix broken install do?

Apt-get is a Terminal based package management tool used for installing, upgrading, and removing packages. Along with these features, it also has flags that can be used for fixing missing dependencies and broken packages.

How do you fix try apt — fix broken install with no packages or specify a solution?

Try ‘apt —fix-broken install’ with no packages (or specify a solution) libreoffice. sudo apt-get upgrade Reading package lists… Done Building dependency tree Reading state information… Done You might want to run ‘apt —fix-broken install’ to correct these.

How do I fix a broken Ubuntu update?

1 Answer

  1. Force the installation of libprotobuf-lite9v5 sudo apt-get install libprotobuf-lite9v5.
  2. Repair the system with sudo apt-get install -f.
  3. Mark the package as being installed automatically sudo apt-mark auto libprotobuf-lite9v5.
  4. Install the needed packages sudo apt-get install gimp sudo apt-get install inkscape.

Why sudo apt-get update is not working?

This error happens when another program is using APT. … Check if some other program might be using apt. It could be a command running terminal, Software Center, Software Updater, Software & Updates or any other software that deals with installing and removing applications.

How do I fix sudo apt-get update?

Hash Sum Mismatch Error

This error can happen when fetching the latest repositories during » apt-get update » was interrupted, and a subsequent » apt-get update » is not able to resume the interrupted fetch. In this case, remove the content in /var/lib/apt/lists before retrying » apt-get update «.

How do you resolve a break in electricity?

6 Answers

  1. Open the /var/log/dist-upgrade/apt. log log file in a text editor.
  2. Locate any «broken» packages and remove them with sudo apt-get remove <package> .

How can I fix Ubuntu OS without reinstalling it?

First of all, try to login with live cd and backup your data in an external drive. Just in case, if this method didn’t work, you can still have your data and reinstall everything! At the login screen, press CTRL+ALT+F1 to switch to tty1.

What is sudo dpkg — configure?

dpkg-reconfigure is a powerful command line tool used to reconfigure an already installed package. It is one of the several tools offered under dpkg – the core package management system on Debian/Ubuntu Linux. It works in conjunction with debconf, the configuration system for Debian packages.

How do you fix a broken pop OS package?

Fix Package Manager Issues in Pop!_ OS Edit on GitHub

This command reinstalls the package. This can be convenient when the package has many reverse dependencies. If the Pop!_ Shop indicates that some remote repositories can’t be reached, open Repoman and look in the Extra Sources page for the broken repository.

How do I fix broken packages dependencies?

First, run an update to make sure there aren’t newer versions of the required packages. Next, you can try forcing Apt to look for and correct any missing dependencies or broken packages. This will actually install any missing packages and repair existing installs.

How do I fix broken packages in Kali Linux?

Manually remove a broken package.

  1. Find your package in /var/lib/dpkg/info ls -l /var/lib/dpkg/info | grep <package>
  2. Move the package folder to another location. …
  3. Run the following command: sudo dpkg —remove —force-remove-reinstreq <package>

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

Package managers in Linux are the most useful programs that are used to add additional capabilities in a system. They can be used for installing, removing, updating, and upgrading the packages, also featuring the dependency resolution capabilities. However, like any other program, things can also go wrong with these package managers. Sometimes, while updating or installing a third-party program, installation goes wrong and results in errors that require you to install the missing dependencies and broken packages. This error may also occur because of improper package management, incorrect installation of packages, and installation of unnecessary packages. Whatever the reason may be, the problem is that you receive an error and left with a condition where you cannot add a new package nor update or delete the existing packages until you fix the problem.

In this article, we will learn how to fix the missing dependencies and broken packages using the apt-get command. Note that, we have run the commands and procedure mentioned in this article on a Debian 10 system. The same procedure can be followed in Ubuntu and older Debian versions.

We will use the command-line Terminal for trying the solutions and fixing the problem. To open the Terminal application in Debian, hit the super key on the keyboard and search for it using the search bar that appears. When the search result appears, click on the Terminal icon to open it.

Using apt-get to fix missing and broken packages

Apt-get is a Terminal based package management tool used for installing, upgrading, and removing packages. Along with these features, it also has flags that can be used for fixing missing dependencies and broken packages.

Method 1

Use the “fix-missing” option with “apt-get update” to run the updates and ensure the packages are up to date and there is no new version available for the packages.

$ sudo apt-get update —fix-missing

Once you are done with the update, execute the below command in order to force the package manager to find any missing dependencies or broken packages and install them.

$ sudo apt-get install -f

Another approach to solving the broken package issue via apt-get is to edit the “/etc/apt/sources/list” file and adding sites with newer versions of packages available. Then running the “apt-get update” command to update the repository list.

If the above method does not fix the issue of broken dependencies and broken packages and still you are receiving the error, then try the following methods.

Other methods

Method 1:

In this method, we will use the “apt-get autoremove” and the “dpkg” in order to fix missing dependencies and broken packages.

1. Update the repository index by executing the below command in Terminal:

2. Next, execute the below command to clean out the local repository:

3. Execute the below command to remove all the unnecessary packages that are no longer needed:

$ sudo apt-get autoremove

The above command will display the unmet dependencies or broken package’s name.

4. Then try executing the below command in Terminal to force remove the broken package:

$ sudo dpkg —remove -force —force-remove-reinstreq Package_Name

Method 2:

In the following method, we will use the “dpkg—configure” command in order to fix missing dependencies and broken packages.

Dpkg is a package management tool that can be used to install, remove and manage packages. Similar to apt-get, it can also help to fix broken packages and missing dependencies. If you receive some errors while installing or updating the packages, try the following solution with dpkg:

1. Execute the below command in the Terminal to reconfigure all the partially installed packages.

$ sudo dpkg —configure -a

If the above command does not work, like in our case and you see similar results displaying the erroneous package, then try removing the package.

2. Execute the below command in Terminal in order to remove the erroneous package.

$ apt-get remove <package_name>

3. Then use the below command to clean out the local repository:

After trying any one of the above solutions, run the update command to ensure the dependencies are resolved and broken packages are fixed or removed.

Fixing the dependency and broken packages errors and then returning the system to the normal state may take hours. Sometimes it gets so complicated that when you finally fix it, you feel so lucky. We have presented some solutions regarding this error, so please give them a try. If you know some of the possible solutions we did not mention, please let us know in the comments.

About the author

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.

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 get исправление ошибок
  • Aqsd 129 ошибка f01
  • Apt get update ошибка сегментирования
  • Apu контур 3 неисправен мерседес актрос ошибка
  • Aptdaemon программная ошибка