Recently I tried to upgrade software packages on Linux Mint, at the end, it displayed an error that says “Sub-process /usr/bin/dpkg returned an error code (1)”. You can see this in the image below.
In this article, I will discuss the reasons why this error is caused and how to fix it in Linux Mint. You can also follow this guide if you are getting this error in Ubuntu or its derivatives.
Why you are getting this error?
The possible reasons that cause this error are –
- Due to failed software installation
- dpkg package installer becomes corrupted
- Package installer is interrupted while installing a package
Methods to Fix “Sub-process /usr/bin/dpkg returned an error code (1)”
You can fix this issue by using one of the given methods. You can try these methods one by one and see if the issue is fixed or not.
Method 1: Reconfigure the dpkg database
One of the reasons for causing this error is the interruption of installation of a package this can corrupt the dpkg database. So reconfiguring the dpkg database can solve this issue.
Use the given command to reconfigure the dpkg database.
sudo dpkg --configure -a
Method 2: Force install the package
You can try this method if method 1 is not working you can attempt to fix the dependencies in the package installer.
Use the given command in your terminal –
sudo apt install -f
-f will try to correct the broken dependencies on your system. Instead of option
-f you can use
Method 3: Remove the bad software package
The third option is to remove or purge the software package that causes problems. I will suggest you take the backup of your system so that in case something goes wrong you can restore it.
To purge a package use the given command –
sudo apt remove --purge package_name
Replace the package_name with the actual one.
For example –
sudo apt remove --purge libpam-systemd:amd64
Later you can reinstall the package if required.
Method 4: Remove unused software packages
By removing unused old software packages from your system can also help to fix this issue.
Use the given command to remove the unused package.
sudo apt autoremove
Now, this should fix the issue of “Sub-process /usr/bin/dpkg returned an error code (1)” in a Linux system. If you have a query then write us in the comments below.