How To Fix “Sub-process /usr/bin/dpkg returned an error code (1)” Error In Ubuntu

How To Fix “Sub-process /usr/bin/dpkg returned an error code (1)” Error In Ubuntu

You might come across the “Sub-process /usr/bin/dpkg returned an error code (1)” Error In Ubuntu while trying to install software or upgrade the Ubuntu. This happens because of corrupt or broken packages. Sometimes a broken package might interrupt your Ubuntu upgrading process.

Errors were encountered while processing:
firefox
E: Sub-process /usr/bin/dpkg returned an error code (1)

This indicates that the firefox package is either broken or corrupt.

Let’s have a look into the solution for this.

How To Fix “Sub-process /usr/bin/dpkg returned an error code (1)” Error In Ubuntu

Method 1:

Purge the Bad or Corrupted Software Package

Run the following command to remove or purge the software package that is creating an issue.

sudo apt remove --purge package_name
sudo apt remove --purge firefox

Now, run the following command to remove all the old, unused, and unnecessary packages.

sudo apt clean
sudo apt autoremove

Method 2:

Reconfiguring the dpkg Package

Run the following command to reconfigure the packages.

sudo dpkg --configure -a

Method 3:

Remove all the Files Associated with the Package

Run the following command to remove all the files associated with the troublesome package.

Run the following command 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

Move them to the /tmp directory with the following command:

 sudo mv /var/lib/dpkg/info/package-name.* /tmp

Or run the following command to manually remove the files.

sudo rm -r /var/lib/dpkg/info/package-name.*

Method 4:

Force Install the Troublesome Package

Run the following command to force install the package using the -f option as shown.

sudo apt install -f

OR

sudo apt install --fix-broken
READ More Relevant Stuff:  How To Check Your Ubuntu Version

Leave a Reply

Your email address will not be published. Required fields are marked *