- How to Solve “Sub-process /usr/bin/dpkg returned an error code (1)” In Ubuntu
- Solution 1: Reconfiguring the dpkg Package
- Solution 2: Force Install the Troublesome Package
- Solution 3: Purge the Bad or Corrupted Software Package
- Solution 4: Remove all the Files Associated with the Package
- How To Solve «sub process usr bin dpkg returned an error code 1″ Error in Ubuntu
- Fixing Sub-process /usr/bin/dpkg returned an error code (1)
- Method 1: Reconfigure Package Database
- Method 2: Use force install
- Method 3: Try removing the troublesome package
- Method 4: Remove post info files of the troublesome package
- Which method worked for you (if it worked)?
- How to Fix sub-process /usr/bin/dpkg returned an error code (1) in Ubuntu
- Options to Fix sub-process /usr/bin/dpkg returned an error code (1)
- Method 1: Reconfigure dpkg Database
- Method 2: Force-Install the Software
- Method 3: Remove Bad Software Package
- Method 4: Clean Out Unused Software Packages
- Method 5: Remove Post Files
- Method 6: Overwrite Package File
How to Solve “Sub-process /usr/bin/dpkg returned an error code (1)” In Ubuntu
It’s not uncommon to run into an issue of broken packages in Ubuntu and other Debian-based distributions. Sometimes, when you upgrade the system or install a software package, you may encounter the ‘Sub-process /usr/bin/dpkg returned an error code’ error.
For example, a while back, I tried to upgrade Ubuntu 18.04 and I bumped into the dpkg error as shown below.
Errors were encountered while processing: google-chrome-stable E: Sub-process /usr/bin/dpkg returned an error code (1)
This indicates that the google-chrome-stable package is either broken or corrupt. There are a few workarounds to this problem, so don’t throw in the towel yet or discard your system.
Solution 1: Reconfiguring the dpkg Package
One of the triggers of this error is a corrupted dpkg database. This can be caused by the sudden interruption of the installation of a software package. Reconfiguring the database is one way to resolve this issue.
To do this, simply execute the command:
This reconfigures the unpacked packages that were not installed during the installation process.
Solution 2: Force Install the Troublesome Package
Sometimes, errors can occur during the installation of software packages. When such happens, you can force install the package using the -f option as shown.
$ sudo apt install -f OR $ sudo apt install --fix-broken
The -f option & —fix-broken can be interchangeably used to fix broken dependencies resulting from an interrupted package or cached package download.
Solution 3: Purge the Bad or Corrupted Software Package
If the first two solutions did not fix the problem, you can remove or purge the problematic software package as shown.
$ sudo apt remove --purge package_name
For example, in my case, purging the Google chrome package fixed the issue.
$ sudo apt remove --purge google-chrome-stable
Then invoke the commands below to remove all the old, unused, and unnecessary packages which also frees up space on your hard drive.
$ sudo apt clean $ sudo apt autoremove
Solution 4: Remove all the Files Associated with the Package
Lastly, you can manually remove all the associated with the troublesome package. First, you need to find these files which are located in the /var/lib/dpkg/info directory as shown.
$ sudo ls -l /var/lib/dpkg/info | grep -i package_name
After listing the files, you can move them to the /tmp directory as shown
$ sudo mv /var/lib/dpkg/info/package-name.* /tmp
Alternatively, you can use the rm command to manually remove the files.
$ sudo rm -r /var/lib/dpkg/info/package-name.*
Finally, update the package lists as shown:
You can thereafter give it another shot in reinstalling the software package.
Conclusion
This type of dpkg error points to an issue with the package installer usually caused by the interruption of an installation process or a corrupt dpkg database.
Any of the above-mentioned solutions should fix this error. If you have come this far, then it’s our hope that the issue has been successfully resolved and that you were able to reinstall your software package.
How To Solve «sub process usr bin dpkg returned an error code 1″ Error in Ubuntu
If you are encountering “sub process usr bin dpkg returned an error code 1” while installing software on Ubuntu Linux, here is how you can fix it.
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)
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.
Fixing Sub-process /usr/bin/dpkg returned an error code (1)
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.
Method 2: Use force install
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
sudo mv /var/lib/dpkg/info/polar-bookshelf.* /tmp
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.
How to Fix sub-process /usr/bin/dpkg returned an error code (1) in Ubuntu
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.
Options to Fix sub-process /usr/bin/dpkg returned an error code (1)
Method 1: Reconfigure dpkg Database
If your package database has become corrupted, reconfiguring it can repair it.
Enter the following command:
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.
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:
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:
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.
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.
Dejan is the Head of Content at phoenixNAP with over 8 years of experience in Web publishing and technical writing. Prior to joining PNAP, he was Chief Editor of several websites striving to advocate for emerging technologies. He is dedicated to simplifying complex notions and providing meaningful insight into data center and cloud technology.
This tutorial lists the steps that will help you fix the E: Could not get lock /var/lib/dpkg/lock error you.
If the software you want to install comes in a form of a deb package, you may be wondering how to extract it.
RPM is a package format used by Red Hat based derivatives like CentOS, RHEL or Fedora. It gets its name from.
Node.js is an open-source cross-platform JavaScript (JS) runtime environment. It is used for building fast.