[Solved] Error: sub-process usr/bin/dpkg returned an error code (1)

This error: E: Sub-process /usr/bin/dpkg returned an error code (1) may come due to broken packages, corrupt software installer, or maybe due to some interruptions during installation. You may get this error while updating the system, installing or uninstalling a package. This error is common in Ubuntu and there are several ways to solve it. We will be discussing them below:

Solution 1: Reconfiguring the dpkg database

While installing a package, if it’s interrupted in between, the dpkg database may get corrupted and you will get this error. But it can be solved by reconfiguring the dpkg database. To reconfigure the database, execute the following command in a terminal window:

sudo dpkg --configure -a
dpkg-error-1

This command reconfigures the unpacked packages that have not been installed. If this method doesn’t work out, you can try the subsequent methods.

Solution 2: Force-install the package

This method is used to fix the broken dependencies that may occur due to interruption during downloading or installing. Execute the following command to force install or fix the broken packages.

sudo apt install -f

or

sudo apt install --fix-broken

Solution 3: Remove the corrupted packages

If both the methods didn’t work out, It’s better to remove the corrupted packages and re-install them. To remove the package, execute the following command:

sudo apt remove --purge package_name

Replace the package_name with the name of the package you want to remove.

sudo apt remove --purge brave-browser
dpkg-error-4

Here, I have removed the brave-browser package using the above command. Using purge command uninstalls the software package along with its configuration file.

Now, Execute the following commands to remove the unused and unnecessary packages:

sudo apt clean
sudo apt autoremove
dpkg-error-5

Solution 4: Overwriting the corrupted package

If any of the above methods don’t work, execute the following command to overwrite the existing package:

sudo dpkg -i --force-overwrite /var/cache/apt/archives/package_name

Replace the package_name with the actual package name you want to overwrite.

Conclusion

So, we discussed several methods to solve the error. This error is common and mostly due to interruption in the installation package. Try any of the above methods. I hope it works out for you.

What does the error message “dpkg: error: requested operation requires superuser privilege” mean?

This error indicates that the operation you are trying to run requires elevated permissions that are only granted to a superuser or root user. It typically occurs when you try to install or remove packages without using sudo is a program that allows users to run commands with elevated privileges.

How can I fix the “dpkg: error: requested operation requires superuser privilege” error?

To fix this error, prepend your command with ‘sudo’. For example, instead of running ‘dpkg install package_name’, use ‘sudo dpkg install package_name’. This grants the necessary permissions to execute the operation and help in the installation process.

Is it possible to resolve this error without superuser access?

No, you cannot resolve this specific error without superuser access. You will need to have the appropriate permissions to perform actions like installing or removing packages using the dpkg package installer for building software.

How can I learn more about using dpkg on Ubuntu?

You can learn more about the dpkg package installer by consulting the official Ubuntu documentation or running ‘man dpkg’ in the terminal. This will provide you with a straightforward list of commands and options available for package management.

What should I do if the dpkg package installer becomes corrupted?

If the dpkg package installer becomes corrupted, you may encounter various errors that indicate a problem with the installation. To fix this issue, you can try running ‘sudo You can run ‘dpkg –configure -a’ to help resolve issues with package installation.’ to reconfigure any broken packages, or ‘sudo apt-get install Using ‘-f’ can help fix broken dependencies in your program.’ to fix dependency issues.

Can I run dpkg commands without sudo if I am the owner of the package?

No, even if you are the owner of the package, you cannot run dpkg commands without sudo. The package management system in Ubuntu and other Debian-based systems requires superuser privileges for operations that modify the package database.

How do I specify the exact package I want to install using dpkg?

To specify the exact package you want to install using dpkg, you can use the command ‘sudo dpkg -i package_name.deb’ to ensure it is properly associated. Make sure to include the ‘.deb’ extension and provide the path to the package if it’s not in the current directory, as this indicates a problem with the installation process.

What steps should I follow if I continue to see the same error after using sudo?

If you continue to see the error after using sudo, check that you are using the correct command syntax. You may also want to look for any other underlying issues, such as locked dpkg processes, by running ‘sudo fuser -v /var/lib/dpkg/lock’ to identify and resolve them.