sub-process /usr/bin/dpkg returned an error code (1) mysql code example

Example 1: E: Sub-process /usr/bin/dpkg returned an error code (1)

sudo dpkg --configure -a

Example 2: E: Sub-process /usr/bin/dpkg returned an error code (1)

sudo dpkg –i ––force–overwrite /var/cache/apt/archives/full_name_of_package

Example 3: Sub-process /usr/bin/dpkg returned an error code

sudo apt-get remove --purge package_name

Example 4: E: Sub-process /usr/bin/dpkg returned an error code (1)

sudo dpkg -i --force-all /var/cache/apt/archives/full_name_of_package