Created Wed Jun, 12 2019 at 11:07AM

Recently came across a package install that was causing the Sub-process /usr/bin/dpkg returned an error code (1) error. Below are a few ways of dealing with it. In my case it was two packages that were trying to write different versions of the same file (a perl util library used by my application). It's actually super nice that this failed and alerted me to the issue.

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 

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.