Introduction
The error message “Sub-process /usr/bin/dpkg returned an error code (1)” indicates a problem with the package installer. This can happen in Ubuntu after a failed software installation, or if the installer becomes corrupted.
The key phrase in this error is /usr/bin/dpkg. This refers to the dpkg package installer for Linux. A package installer is an application that tracks software, updates, and dependencies. If it is damaged, any new software installation will cause this error message.
We cover several possible solutions, from easily-solved and straightforward solutions to more complex processes. This guide will help you resolve the dpkg returned an error code 1 on an Ubuntu operating system.
Prerequisites
- A user account with sudo privileges
- A terminal window/command-line (Ctrl–Alt–T)
Method 1: Reconfigure dpkg Database
If your package database has become corrupted, reconfiguring it can repair it.
Enter the following command:
sudo dpkg --configure -a
This command reconfigures packages that have been unpacked but not necessarily installed. An interruption at the wrong time can cause this database to become corrupt. This is especially helpful if you were running installation and the process was interrupted.
Method 2: Force-Install the Software
If Method 1 does not work, you can attempt to fix the dependencies in the package installer.
Enter the following:
sudo apt-get install -f
The -f
option means fix-broken. It repairs any broken dependencies in your package manager. Broken dependencies occur when a download is interrupted, or there is a problem with the cached download.
Note: Dependencies are other software packages that are required by the software you are installing. A package manager helps keep track of dependencies for you.
Method 3: Remove Bad Software Package
If you know which software caused the errors on your system, you can remove it.
Enter the command and package_name with the name of the software that is causing the problem:
sudo apt-get remove --purge package_name
The --purge
option directs the system to remove config files in addition to uninstalling. This helps get rid of all traces of the offending software.
Method 4: Clean Out Unused Software Packages
If an old, outdated, or unused package is causing the problem, you can solve the problem by removing unused software packages.
Enter the following command in the terminal:
sudo apt autoremove
Note: Avoid the next 2 options unless all other methods have failed.
Method 5: Remove Post Files
If you know the name of the package that is causing problems, you can delete the files manually. The installation files are usually located in the /var/lib/dpkg/info file.
Type in the following command and replace package_name with the name of the broken software.:
sudo ls -l /var/lib/dpkg/info | grep -i package_name
This will generate a list of all references to the software you installed.
You can then remove them by entering:
sudo mv /var/lib/dpkg/info/package_name.* /tmp
This command moves the files to the /tmp directory, where they cannot affect your package manager.
Next, update the package manager:
sudo apt-get update
After which you can re-install the broken software again.
Method 6: Overwrite Package File
If you know the name of the package that is causing a problem, you can force an overwrite.
Use the following command and replace full_name_of_package with the actual package name:
sudo dpkg -i --force-overwrite /var/cache/apt/archives/full_name_of_package
Note: If you do not know the actual name of the package, you can search for it with the following command:
ls /var/cache/apt/archies/*package_name*
Replace package_name
with the name of your software. This should return any instances of that package name. Note the exact filename, and type it into the previous command.
Conclusion
The dpkg error message indicates that there is a problem with the package installer, which is commonly caused by an interrupted installation process or a corrupted database.
By following these steps, you should now have several methods to fix the dpkg error message and attain a working package installer.
Если вы столкнулись с ошибкой с «sub process usr bin dpkg returned an error code 1» при установке программного обеспечения на Ubuntu Linux, вот как вы можете это исправить.
Одной из распространенных проблем в Ubuntu и других дистрибутивах на основе Debian являются ломанные пакеты.
Вы пытаетесь обновить систему или установить новый пакет, и столкиваеиесь с такой ошибкой, как «Sub-process /usr/bin/dpkg returned an error code 1.
Вот что случилось на днях.
Я пытался установить радио приложение на Ubuntu, и система вернула мне эту ошибку:
Unpacking python-gst-1.0 (1.6.2-1build1) ...
Selecting previously unselected package radiotray.
Preparing to unpack .../radiotray_0.7.3-5ubuntu1_all.deb ...
Unpacking radiotray (0.7.3-5ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.2) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up polar-bookshelf (1.0.0-beta56) ...
ln: failed to create symbolic link '/usr/local/bin/polar-bookshelf': No such file or directory
dpkg: error processing package polar-bookshelf (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-appindicator (12.10.1+16.04.20170215-0ubuntu1) ...
Setting up python-gst-1.0 (1.6.2-1build1) ...
Setting up radiotray (0.7.3-5ubuntu1) ...
Errors were encountered while processing:
polar-bookshelf
E: Sub-process /usr/bin/dpkg returned an error code (1)
Здесь важны последние три строки:
Errors were encountered while processing:
polar-bookshelf
E: Sub-process /usr/bin/dpkg returned an error code (1)
Это говорит мне, что пакет полярнаяpolar-bookshelf является причиной
. Это может иметь решающее значение для устранения этой ошибки.
Решение проблемы Sub-process /usr/bin/dpkg returned an error code (1)
Попробуем исправить этот сломанный пакет.
Я покажу вам несколько методов, которые вы можете попробовать по одному.
Они простые в использовании и просто без проблем осуществимы.
Вы должны попытаться запустить sudo apt update, а затем попытаться установить новый пакет или обновиться после каждого из описанных здесь методов.
Способ 1: переконфигурировать базу данных пакетов
Первый метод, который вы можете попробовать, – перенастроить базу данных пакетов.
Вероятно, база данных повреждена при установке пакета.
Реконфигурация часто устраняет проблему.
sudo dpkg --configure -a
Способ 2: Использовать принудительную установку
Если установка ранее прервалась, вы можете попробовать установить пакет принудительно:
sudo apt-get install -f
Способ 3. Попробуйте удалить проблемный пакет.
sudo apt remove
Способ 4. Удалите информационные файлы с информацией о проблемном пакете
Это должно быть вашим последним прибежищем.
Вы можете попробовать удалить файлы, связанные с пакетом, из /var/lib/dpkg/info.
Вам нужно немного узнать о базовых командах Linux, чтобы выяснить, что происходит, и как использовать их с вашей проблемой.
В моем случае у меня была проблема с polar-bookhelof.
Поэтому я искал файлы, связанные с ним:
ls -l /var/lib/dpkg/info | grep -i polar-bookshelf
-rw-r--r-- 1 root root 2324811 Aug 14 19:29 polar-bookshelf.list
-rw-r--r-- 1 root root 2822824 Aug 10 04:28 polar-bookshelf.md5sums
-rwxr-xr-x 1 root root 113 Aug 10 04:28 polar-bookshelf.postinst
-rwxr-xr-x 1 root root 84 Aug 10 04:28 polar-bookshelf.postrm
Теперь мне нужно удалить эти файлы:
sudo mv /var/lib/dpkg/info/polar-bookshelf.* /tmp
I have error in apt-get install
it is a error:
The following packages have unmet dependencies:
gcc-4.8-multilib : Depends: libc6-dev-i386 (>= 2.11) but it is not going to be installed
libc6-dev-x32 : Depends: libc6-dev-i386 (= 2.19-0ubuntu6.6) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
I try several command
like: apt-get -f install
apt-get clean
I try change my source list, and remake apt-get update
$ sudo apt-get install g++
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:
gcc-4.8-multilib : Depends: libc6-dev-i386 (>= 2.11) but it is not going to be installed
libc6-dev-x32 : Depends: libc6-dev-i386 (= 2.19-0ubuntu6.6) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
in apt-get -f install
$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
libc6-dev-i386
The following NEW packages will be installed:
libc6-dev-i386
0 upgraded, 1 newly installed, 0 to remove and 434 not upgraded.
3 not fully installed or removed.
Need to get 0 B/1.148 kB of archives.
After this operation, 6.333 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 194963 files and directories currently installed.)
Preparing to unpack .../libc6-dev-i386_2.19-0ubuntu6.6_amd64.deb ...
Unpacking libc6-dev-i386 (2.19-0ubuntu6.6) ...
dpkg: error processing archive /var/cache/apt/archives/libc6-dev-i386_2.19-0ubuntu6.6_amd64.deb (--unpack):
trying to overwrite '/usr/include/bits', which is also in package libc6-dev-amd64 2.19-0ubuntu6.6
Errors were encountered while processing:
/var/cache/apt/archives/libc6-dev-i386_2.19-0ubuntu6.6_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
asked Jun 5, 2015 at 23:56
2
The same dpkg error is also possible when uninstalling:
apt-get uninstall
and
apt-get purge
First, uninstall the package:
rm -f /var/lib/dpkg/info/<package-name>*
apt-get purge <package-name>
Afterwards you can re-install it:
apt-get install <package-name>
Massimo
3,0192 gold badges28 silver badges41 bronze badges
answered Apr 17, 2018 at 9:07
rapaelecrapaelec
1,23812 silver badges10 bronze badges
0
Try this. Open a new terminal and paste it
sudo dpkg -i --force-overwrite /var/cache/apt/archives/libc6-dev-i386_2.19-0ubuntu6.6_amd64.deb
After that type:
sudo apt-get autoremove
Lastly type
sudo apt-get update
hope your problem will be solved.
answered Jul 12, 2015 at 6:33
orviorvi
3,1021 gold badge22 silver badges36 bronze badges
none of the solutions i could find solved the problem for me…still broken packes, no matter the autoremove, -f install
… and so forth.
After playing around a little, the following solved it for me:
sudo apt-get --purge remove libc6-dev-i386 libc6-dev-x32 gcc-5-multilib gcc-multilib
sudo apt autoremove -f
sudo apt-get -f install
Alfred Huang
17.4k32 gold badges116 silver badges188 bronze badges
answered Oct 29, 2016 at 13:52
DavidDavid
3553 silver badges8 bronze badges
1
Try the following steps from the terminal :
sudo apt-get --purge remove libc6-dev-amd64
sudo apt-get -f install
sudo apt-get update
Hope this will fix your issues.
Jai Chauhan
3,9453 gold badges35 silver badges61 bronze badges
answered Aug 14, 2015 at 13:34
Basheer.OBasheer.O
4775 silver badges8 bronze badges
1
I found my solution, because the others quoted below did not work. Generally, it is a conflict with a dependency already installed.
I solved this problem with these command for recreate blank configuration (debian) :
sudo mv /var/lib/dpkg/info /var/lib/dpkg/info_silent
sudo mkdir /var/lib/dpkg/info
sudo apt-get update
sudo apt-get -f install <xxxx>
answered Aug 22, 2022 at 12:42
Sacha DurandSacha Durand
4051 gold badge4 silver badges10 bronze badges
Try is to reconfigure the package database. Probably the database got corrupted while installing a package.
sudo dpkg --configure -a
answered Dec 27, 2018 at 11:18
It looks like you have installed libc6-dev-amd64
and you are trying to install packages that depend on libc6-dev-i386
, and these two are in conflict (they both contain /usr/include/bits).
My guess is you don’t want both of these installed at the same time. I would use apt-get remove libc6-dev-amd64
to get yourself back to a good state, and then try again to install the packages that you want.
If those two packages are meant to work when they’re both installed at the same time, then file a bug with the package maintainer because they need to fix the packages to allow that.
Jai Chauhan
3,9453 gold badges35 silver badges61 bronze badges
answered Jun 6, 2015 at 0:17
Ewan MellorEwan Mellor
6,6981 gold badge23 silver badges39 bronze badges
1
When the upgrade command (sudo apt-get upgrade -y
) is run in Ubuntu 18.04.3 (With Linux kernel version 5.7.14) the following errors get reported (in red):
... bind /var/run/spice-vdagentd/spice-vdagent-sock: No such file or directory
... Fatal could not create server socket /var/run/spice-vdagentd/spice-vdagent-sock
...
... Failed to start Agent daemon for Spice guests.
The following steps fixed the issue:
- Make
spice-vdagentd
directory if it does not exist:
> sudo mkdir /var/run/spice-vdagentd (if it does not exist)
- Open a new file
spice-vdagent-sock
> sudo vi /var/run/spice-vdagentd/spice-vdagent-sock
- Save the file by running:
:wq
- Re-run the
upgrade
command to verify that the issue is fixed.
answered Dec 3, 2020 at 23:49
BR MBR M
917 bronze badges
Using below steps my problem resolve in “Oracle VM VirtualBox Manager”
-
apt autoremove
-
apt purge libreoffice-base libreoffice-core
-
dpkg -l “libreoffice” | grep “^ii”
-
sudo dpkg –configure -a
-
sudo apt-get install -f
now you can try to install – pip3 install jupyter etc.
answered Dec 14, 2020 at 12:33
VijayVijay
1417 bronze badges
You can fix this problem with this command:
sudo apt-get remove --purge libreoffice-core libreoffice-common
python3-uno libreoffice-*
NelsonGon
13k7 gold badges27 silver badges57 bronze badges
answered Jul 20, 2016 at 17:37
1
One of the common issue in Ubuntu and other Debian based distribution is the broken packages. You try to update the system or install a new package and you encounter an error like ‘Sub-process /usr/bin/dpkg returned an error code’.
That’s what happened to me the other day. I was trying to install a radio application in Ubuntu when it threw me this error:
Unpacking python-gst-1.0 (1.6.2-1build1) ...
Selecting previously unselected package radiotray.
Preparing to unpack .../radiotray_0.7.3-5ubuntu1_all.deb ...
Unpacking radiotray (0.7.3-5ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.2) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up polar-bookshelf (1.0.0-beta56) ...
ln: failed to create symbolic link '/usr/local/bin/polar-bookshelf': No such file or directory
dpkg: error processing package polar-bookshelf (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-appindicator (12.10.1+16.04.20170215-0ubuntu1) ...
Setting up python-gst-1.0 (1.6.2-1build1) ...
Setting up radiotray (0.7.3-5ubuntu1) ...
Errors were encountered while processing:
polar-bookshelf
E: Sub-process /usr/bin/dpkg returned an error code (1)
The last three lines are of the utmost importance here.
Errors were encountered while processing:
polar-bookshelf
E: Sub-process /usr/bin/dpkg returned an error code (1)
It tells me that the package polar-bookshelf is causing and issue. This might be crucial to how you fix this error here.
Let’s try to fix this broken error package. I’ll show several methods that you can try one by one. The initial ones are easy to use and simply no-brainers.
You should try to run sudo apt update and then try to install a new package or upgrade after trying each of the methods discussed here.
Method 1: Reconfigure Package Database
The first method you can try is to reconfigure the package database. Probably the database got corrupted while installing a package. Reconfiguring often fixes the problem.
sudo dpkg --configure -a
Method 2: Use force install
If a package installation was interrupted previously, you may try to do a force install.
sudo apt-get install -f
Method 3: Try removing the troublesome package
If it’s not an issue for you, you may try to remove the package manually. Please don’t do it for Linux Kernels (packages starting with linux-).
sudo apt remove package_name
Method 4: Remove post info files of the troublesome package
This should be your last resort. You can try removing the files associated to the package in question from /var/lib/dpkg/info.
You need to know a little about basic Linux commands to figure out what’s happening and how can you use the same with your problem.
In my case, I had an issue with polar-bookshelf. So I looked for the files associated with it:
ls -l /var/lib/dpkg/info | grep -i polar-bookshelf
-rw-r--r-- 1 root root 2324811 Aug 14 19:29 polar-bookshelf.list
-rw-r--r-- 1 root root 2822824 Aug 10 04:28 polar-bookshelf.md5sums
-rwxr-xr-x 1 root root 113 Aug 10 04:28 polar-bookshelf.postinst
-rwxr-xr-x 1 root root 84 Aug 10 04:28 polar-bookshelf.postrm
Now all I needed to do was to remove these files:
sudo mv /var/lib/dpkg/info/polar-bookshelf.* /tmp
Use the sudo apt update and then you should be able to install software as usual.
Which method worked for you (if it worked)?
I hope this quick article helps you in fixing the ‘E: Sub-process /usr/bin/dpkg returned an error code (1)’ error.
If it did work for you, which method was it? Did you manage to fix this error with some other method? If yes, please share that to help others with this issue.
In Linux, a Debian package is the compressed archive file that stores the essential files such as libraries, executable files, documentation belonging to the specific programs. Debian has the .deb extensions in the file name. In installing any dpkg in Linux, users may face the error “sub-process /usr/bin/dpkg”.
In this post, we will demonstrate the reason and solutions for the problem mentioned above. The write-up’s content is:
- Reason: Broken Packages
- Solution 1: Re-Configure the Database Package
- Solution 2: Remove the Causing Package
- Solution 3: Force Install the Package
- Solution 4: Trash the Post Files of Causing Package
Let’s start this guide.
Reason: Broken Packages
Sometimes, package installation is interrupted, which may lead to this error. The reason for this problem is because the packages are broken. This issue mostly occurs in Ubuntu and Debian-based distributions, which stops you from running the system update command. The solutions, for this reason, are discussed below.
Solution 1: Re-Configure the Database Package
In most cases, database files get corrupted due to the misconfiguration of any package. So configure the broken packages using the following command:
$ sudo dpkg --configure -a
If this will not resolve the problem, then go for solution 2.
Solution 2: Remove the Causing Package
Delete the package that is creating the problem. To remove that package, run the following command with your package name:
$ sudo apt remove [Package_Name]
After removing the packages, run the update command to update the packages:
Now, check if the problem is resolved or not. If not, then go for another solution 3.
Solution 3: Force Install the Package
Another possible solution to fix the error is to install the interrupted packages, if any, forcefully. As we mentioned, package installation interruption is the cause of this error. So, try to install the package if any forcefully:
After this, check if the error is resolved. If not, then solution 4 is also available.
Solution 4: Trash the Post Files of Causing Package
The fourth solution that you can perform is just to remove the package post files. Just look at the error and check the package creating the problem. (the package name would be mentioned in the last 3 lines of the error). Remove the post files of that package using the following command:
$ sudo mv /var/lib/dpkg/info/[Your Causing Package].* /tmp
After that, run the update command:
The error will be resolved.
That’s all from this guide.
Conclusion
The reason for the sub-process “/usr/bin/dpkg” returning an error code (1) is the broken packages. To resolve it, there are four solutions, reconfigure the database files using the “sudo dpkg –configure -a” command, remove the error-causing package using the “sudo apt remove <package-name>” command, install the Interrupted package forcibly by executing “sudo install -f” command or remove the post files of the causing package by running the “sudo mv /var/lib/dpkg/info/ .*/tmp” command. This post has demonstrated the reason and all the solutions for the error mentioned above.