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.

The crucial phrase in this error is /usr/bin/dpkg, which points to the dpkg package installer used in Linux. A package installer manages software, updates, and dependencies. If it becomes corrupted, any attempt to install new software can trigger this error message.

For example, a while back, I tried to upgrade to Ubuntu 22.04 and I bumped into the dpkg error as shown below.

Errors were encountered while processing:
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.

Fixing Sub-process /usr/bin/dpkg returned an error code (1)

Let’s address the issue with this broken package error. I’ll walk you through several methods, starting with the simpler ones. These initial steps are straightforward and don’t require much effort.

Method 1: Reconfiguring dpkg Package Database

One of the triggers of this error is a corrupted dpkg package 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:

sudo dpkg --configure -a

This reconfigures the unpacked packages that were not installed during the installation process.

Method 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
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.

Method 3: Remove or 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

Method 4: Remove all the Files Associated with the Package

Lastly, you can manually remove all the files 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:

$ sudo apt update

You can thereafter give it another shot by reinstalling the software package.


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 we hope that the issue has been successfully resolved and that you were able to reinstall your software package.

If any of the methods worked for you, please specify which one resolved the issue. If you managed to fix this error using a different method, kindly share it to help others who might be experiencing the same issue.

James Kiarie
This is James, a certified Linux administrator and a tech enthusiast who loves keeping in touch with emerging trends in the tech world. When I'm not running commands on the terminal, I'm taking listening to some cool music. taking a casual stroll or watching a nice movie.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

24 thoughts on “How to Solve “Sub-process /usr/bin/dpkg returned an error code (1)” In Ubuntu”

  1. I am using a dockerfile to install Google Chrome in Debian. I tried several answers and yours doesn’t work.

    Do you have any ideas? highly appreciated.


    RUN wget -q -O - | apt-key add - \
        && sh -c 'echo "deb [arch=amd64] stable main" >> /etc/apt/sources.list.d/google-chrome.list'
    # Install Google Chrome
    RUN DEBIAN_FRONTEND=noninteractive
    RUN apt-get -f install
    RUN apt-get update && apt-get install -y google-chrome-stable


    dpkg-deb: error:  subprocess was killed by signal (Killed)
    dpkg: error processing archive /tmp/apt-dpkg-install-Fwjhp9/087-google-chrome-stable_120.0.6099.109-1_amd64.deb (--unpack):
     cannot copy extracted data for './opt/google/chrome/chrome' to '/opt/google/chrome/chrome.dpkg-new': unexpected end of file or stream
    Errors were encountered while processing:
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    The command '/bin/sh -c apt-get update && apt-get install -y google-chrome-stable' returned a non-zero code: 100
    • @James,

      The error you provided indicates a problem with unpacking the Chrome package, resulting in a non-zero exit code.

      To fix this, you can try the following modifications to your Dockerfile:

      # Import Google Chrome signing key
      RUN wget -q -O - | apt-key add -
      # Add Google Chrome repository
      RUN sh -c 'echo "deb [arch=amd64] stable main" >> /etc/apt/sources.list.d/google-chrome.list'
      # Update package list and install dependencies
      RUN apt-get update && apt-get install -y --no-install-recommends \
          google-chrome-stable \
          && apt-get clean \
          && rm -rf /var/lib/apt/lists/*
      # Finish the rest of your Dockerfile...
  2. Thanks a ton!

    I could not clean a package entry for which I had deleted the folders and hence it was not being deleted or reinstalled. I couldn’t upgrade to the latest OS versions as well. Tried many solutions from many sources. But today I got your 4th solution and it worked and it also showed me the real cause of the issue.

    Thanks once again for the detailed post!

  3. I have tried several times to install koha in ubuntu 20.04 but keeps giving this error

    Processing triggers for man-db (2.9.1-1) …
    Errors were encountered while processing:
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    Can any one help.

  4. Hi everyone. gentlemen professionals help, please.

    I have tried a lot of what is written on the Internet, but it keeps getting an error.

    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-5.15.0-50-generic
    Found initrd image: /boot/initrd.img-5.15.0-50-generic
    Found linux image: /boot/vmlinuz-5.15.0-48-generic
    Found initrd image: /boot/initrd.img-5.15.0-48-generic
    Found linux image: /boot/vmlinuz-5.15.0-46-generic
    Found initrd image: /boot/initrd.img-5.15.0-46-generic
    Found linux image: /boot/vmlinuz-5.15.0-43-generic
    Found initrd image: /boot/initrd.img-5.15.0-43-generic
    /etc/grub.d/bin/grubcfg_proxy: error while loading shared libraries: cannot open shared object file: 
    No such file or directory
    run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
    dpkg: Fehler beim Bearbeiten des Paketes linux-image-unsigned-5.15.0-47-generic (--remove):
    »installiertes linux-image-unsigned-5.15.0-47-generic-Skript des Paketes post-removal«-Unterprozess gab den Fehlerwert 1 zurück
    dpkg: Zu viele Fehler, Abbruch
    Fehler traten auf beim Bearbeiten von:
    Bearbeitung wurde angehalten, da zu viele Fehler auftraten.
    E: Sub-process /usr/bin/dpkg returned an error code (1)
      • Thank you, Tell me how to install it, and where to get it. I don’t understand programs very well.

        Even installing any package or deleting a package also shows an error. that the package Errors occurred while editing:


        Can you tell me how to do it? Thanks.

        • Yup, I ran into this same exact situation. Going back and looking for missing libraries I was able to find their package names and do an apt-get install on each of them. So, after googling for hours, I finally came to this and got it finally fixed. Yay!

    • I’m having the same problem and I can’t turn it around dpkg: error when processing the linux-image-amd64 package (–configure):

      dependency issues – left unconfigured
      Errors found when processing:
      Scanning application launchers
      Removing duplicate launchers or broken launchers
      Launchers are updated
      E: Sub-process /usr/bin/dpkg returned an error code (1)

      • @John,

        It seems that there are dependency issues with the linux-image-amd64 package, resulting in an error during the dpkg configuration process.

        Here’s a suggestion on how to fix it:

        sudo dpkg --configure -a
        sudo apt install -f

        The dpkg command attempts to configure all pending packages, and the apt command tries to fix any broken dependencies.

        If the issue persists, you may need to remove or purge the problematic packages and then reinstall them.

        sudo apt purge linux-image-amd64
        sudo apt install linux-image-amd64
  5. A warning, if python3 shows up, DO NOT REMOVE/PURGE IT otherwise you’ll have a broken package system/dependencies.

  6. I typed: sudo apt-get install -f

    I got:

    dpkg: error processing package libx11-doc (--configure):
     package is in a very bad inconsistent state; you should
     reinstall it before attempting configuration
    Errors were encountered while processing:
    E: Sub-process /usr/bin/dpkg returned an error code (1)


  7. Hello,

    After typing the 1st command line I got this

    $ sudo dpkg --configure -a
    dpkg: error processing package python3-pip (--configure):
     package is in a very bad inconsistent state; you should
     reinstall it before attempting configuration
    Errors were encountered while processing:

    How to solve this?

  8. Hi, many thanks for all your hard work. I’m not an IT expert by any means, so am grateful to you nerds for all your expertise. However, in solution 2, the second suggestion, a ‘space’ has been omitted after ‘install‘…

    $ sudo apt install --fix-broken

    Maybe handy for those who ‘copy’n’paste’. Not trying to be clever, but if I’m wrong, I apologise.

    Thanks, DC.

  9. calcurse-caldav
    E: Sub-process /data/data/com.termux/files/usr/bin/dpkg returned an error code (1)

    ~ sudo dpkg --configure

    su executable not found
    sudo requires su.
    Help, please

  10. I did make all processes to deinstall, in my case, VirtualBox.

    But, to a total surprise, the program yet is in my Linux Mint system.

    I have a Linux Mint 20.2 Uma

    I tried to eliminate the software because I had the error “sub-process /usr/bin/dpkg returned an error code (1)“.

    I don’t know what happened.

  11. Hello,

    I have Ubuntu release 21.04 (Hirsute Hippo) 64-bit with Kernel Linux 5.11.0-18-generic x86_64 and MATE 1.24.1.

    My Software Updater failed.

    I tried:

    <sudo apt autoremove && sudo apt clean && sudo apt update && sudo apt 

    and got

    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
    2 not fully installed or removed.
    After this operation, 0 B of additional disk space will be used.
    Setting up usrmerge (24ubuntu3) ...
    Both /bin/usb_printerid and /usr/bin/usb_printerid exist.
    You can try correcting the errors reported and running again
    /usr/lib/usrmerge/convert-usrmerge until it will complete without errors.
    Do not install or update other Debian packages until the program
    has been run successfully.
    dpkg: error processing package usrmerge (--configure):
     installed usrmerge package post-installation script subprocess 
    returned error exit status 1
    Setting up postfix (3.5.6-1) ...
    Postfix ( configuration was not changed.  If you need to make changes,
    edit /etc/postfix/ (and others) as needed.  To view Postfix 
    configuration values, see postconf(1).
    After modifying, be sure to run 'systemctl reload postfix'.
    Running newaliases
    newaliases: warning: valid_hostname: misplaced delimiter: igor-System-Product-
    newaliases: fatal: file /etc/postfix/ parameter myhostname: bad parame
    ter value: igor-System-Product-Name..
    dpkg: error processing package postfix (--configure):
     installed postfix package post-installation script subprocess returned error 
    exit status 75
    Processing triggers for libc-bin (2.33-0ubuntu5) ...
    Errors were encountered while processing:
    E: Sub-process /usr/bin/dpkg returned an error code (1)

    Please advise.
    Thank you.


Got something to say? Join the discussion.

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.