TL;DR
To fix “sub-process /usr/bin/dpkg returned an error code (1)” in Linux, try these four solutions:
- Fix broken dependencies and conflicts using the commands
sudo apt-get update && sudo apt-get install -f
. - Reinstall problematic packages by running the
sudo apt-get install --reinstall <package-name>
command. - Check and fix permission issues using the
sudo apt-get update
command. - Repair the package database by running
sudo apt-get clean && sudo apt-get update
followed by thesudo apt-get upgrade
command.
To know more about how to fix “sub-process /usr/bin/dpkg returned an error code (1)”, read the article below now.
Seeing the error message “sub-process /usr/bin/dpkg returned an error code (1)” when you’re trying to install or update software on your Linux system can be really frustrating. But don’t worry, there are solutions. In this post, I’ll show you how to fix this error by repairing broken dependencies, reinstalling problem packages, checking permission issues, and repairing the package database. I’ll also share tips to prevent this error from happening again, so your Linux system runs smoothly and efficiently.
What is the ‘sub-process /usr/bin/dpkg returned an error code (1)’ Error?
When you install, update, or remove software on your Linux system, a tool called dpkg
(Debian Package Manager) handles the process. Sometimes, things can go wrong during these operations, and dpkg
can’t complete the task. When this happens, you might see the error message ‘sub-process /usr/bin/dpkg returned an error code (1)’.
Several things can cause this error:
- Corrupted Downloads: If a package download gets interrupted or corrupted,
dpkg
can’t install it properly. - Broken Dependencies: Software packages often rely on other packages to work. If these dependencies are missing or broken,
dpkg
can’t proceed. - File System Issues: Problems with your file system, such as bad sectors or permission issues, can prevent
dpkg
from working correctly. - Configuration Errors: Misconfigured system settings or repositories can lead to this error during package management operations.
How Does This Affect Your System?
When this error occurs, it can leave your system in an unstable state. You might not be able to install new software, update existing packages, or even remove unwanted ones. This can be frustrating and can disrupt your workflow.
How to Fix “sub-process /usr/bin/dpkg returned an error code (1)”
To fix “sub-process /usr/bin/dpkg returned an error code (1)”, start by updating your package list and fixing broken dependencies using the command sudo apt-get update && sudo apt-get install -f
. Next, reinstall any problematic packages. Check and fix any permission issues that might be causing the error. Finally, repair the package database by running sudo apt-get clean
followed by sudo apt-get update
.
Here’s a breakdown of each method you can try to fix the error:
1. Fix Broken Dependencies and Conflicts
apt-get is a powerful tool for managing packages on your Linux system. This package is usually pre-installed and can help you resolve the “sub-process /usr/bin/dpkg returned an error code (1)” error. Here’s how you can use it to fix broken dependencies and conflicts:
- In the Terminal window, run the command below:
sudo apt-get update && sudo apt-get install -f
- This command updates the package database and installs any missing dependencies or packages that are causing conflicts. It may take some time, depending on the size of the package database and the number of packages that need to be installed.

- Once the command is complete, try running the original apt-get command that caused the sub-process /usr/bin/dpkg returned an error code (1) error in the first place.
- If the “sub-process /usr/bin/dpkg returned an error code (1)” error no longer occurs, the issue has been resolved. You can now proceed with installing or upgrading the packages you need. But if the error persists, try the next solution in this guide to resolve this issue.
2. Reinstall Problematic Packages
If the “sub-process /usr/bin/dpkg returned an error code (1)” error is caused by a specific package, consider reinstalling that particular package to fix this error. Here’s how you can do it:
- Head to the Terminal app and run any apt-related command.
- Review the error message displayed after the apt command execution. The error message will typically indicate the name of the package that is causing the issue.
- For example, if the error message indicates that the problematic package is called zsh, use
sudo apt-get install --reinstall <package-name>
. Your command should look like this:
sudo apt-get install --reinstall zsh
- Wait for the command to complete. It will take a few minutes to reinstall the problematic package and fix any issues with its dependencies.

- Once the command is complete, try running the original apt-get command again. If the error is still there, move on to the next method.
3. Check and Fix Permission Issues
Another solution to fix the “sub-process /usr/bin/dpkg returned an error code (1)” message is to check and fix the permission issues. To do so, follow the steps below:
- Launch the Terminal window and execute the command below:
sudo apt-get update
- This command updates the package database and checks for any permission issues that may be causing the error.

- Once the process is complete, run the original apt-get command again to see if the “sub-process /usr/bin/dpkg returned an error code (1)” message is fixed.
4. Repair the Package Database
Sometimes, this error may occur when the package database becomes corrupted or outdated. If that’s the case, you need to repair the package database. Here’s how to do it:
- Type the following command in the Terminal window and press Enter:
sudo apt-get clean && sudo apt-get update
- This command will clear the local repository of retrieved package files that are no longer needed and update the package database.

- Once the process is complete, execute the following command:
sudo apt-get upgrade
- This command will upgrade all installed packages on your Linux system to their latest versions.

- Once the command is complete, execute any of the apt-get commands to check whether the error is resolved or not.
5. Cleaning Up Partial Packages
Cleaning up partial packages is an essential step in resolving the “sub-process /usr/bin/dpkg returned an error code (1)” issue. Partial packages are remnants of incomplete installations or updates, which can cause conflicts and errors in your package management system.
The autoclean command is used to remove partially downloaded package files. These files are stored in the /var/cache/apt/archives directory and can accumulate over time, potentially causing conflicts or consuming unnecessary disk space. Here’s how you can do it:
- Start by opening your terminal application.
- Execute the following command to remove the partial packages:
sudo apt-get autoclean
This command cleans up the local repository of retrieved package files, removing any files that can no longer be downloaded and are largely useless.

- You will be prompted to enter your user password to proceed with the operation. Type your password and press Enter.
The command will run, and you will see a list of packages being removed if there are any.

4 Best Practices to Avoid the “sub-process /usr/bin/dpkg returned an error code (1)”
To avoid encountering the “sub-process /usr/bin/dpkg returned an error code (1)” message in the future, here are some best practices to follow:
1. Keep Your System Updated Regularly
Regularly updating your system ensures that all packages and dependencies are current and compatible.
- Update Your Package List: Before installing or updating software, always refresh your package list to ensure you have the latest information.
- Upgrade Packages: Regularly upgrade your installed packages to their latest versions to avoid compatibility issues.
2. Use Reliable Repositories
Using official and reliable repositories minimizes the risk of installing corrupt or incompatible packages.
- Add Repositories Carefully: Only add trusted repositories to your system. Ensure they are well-known and reputable sources.
- Remove Unused Repositories: Periodically review and remove any repositories that you no longer need or trust. This helps prevent conflicts and potential errors.
3. Regularly Clean Up Your System
Cleaning up your system helps to remove unnecessary files and packages that can cause conflicts.
- Autoremove Unnecessary Packages: Remove packages that are no longer needed. This helps to keep your system clean and efficient.
- Autoclean Partial Packages: Clear out partially downloaded package files to free up space and prevent potential issues.
4. Backup Your System Before Major Changes
Backing up your system allows you to restore it to a working state if something goes wrong.
- Test Your Backups: Periodically test your backups to ensure they can be restored successfully. This gives you confidence that your data is safe and recoverable.
- Create a Backup: Use backup tools to regularly back up your important data and system configuration. This ensures you can recover from any major issues that may arise.
Wrap-Up
In this article, I explored methods to fix the “sub-process /usr/bin/dpkg returned an error code (1)” error. These methods include fixing broken dependencies, reinstalling problematic packages, checking and fixing permission issues, and repairing the package database.
If you found this article helpful, you might also be interested in:
- Solutions to the “You have held broken packages” error, helping you manage dependencies better and maintain system stability.
- Ways to fix critical sudo bugs like CVE-2021-3156, which will enhance your system’s security.
- Understanding why it’s crucial to install all available updates before upgrading your release, ensuring smoother transitions.
Frequently Asked Questions
What are the common causes of the “sub-process /usr/bin/dpkg returned an error code (1)” message?
How can I view the list of packages installed on my Linux machine?
apt list --installed command
to view the list of packages installed on your Linux machine. This command will display a list of all packages that are currently installed on your system, including their version numbers and other relevant details. This can be a useful way to get an overview of the packages installed on your system and ensure that you have the necessary dependencies for your applications.Can I use a graphical package manager to fix this error?
How can I search for a package using aptitude on my Linux machine?
aptitude
on your Linux machine, you can use the apt search
command followed by a keyword related to the package name. For example, if you want to search for a Python3
-related package, type apt search python3
in the Terminal. This will display a list of packages that match your search criteria, including their version numbers and other relevant details. How do I check for package dependency issues in Linux?
sudo apt-get check
. This command will check for any missing dependencies or conflicts with installed packages on your Linux system. Then, you can apply the solutions based on the root cause of the problem.How do I avoid permission issues when installing or upgrading packages in Linux?
sudo
command to elevate your privileges. It’s important to exercise caution when using elevated privileges to avoid accidentally modifying critical system files.