How to Fix the dpkg interrupted error in Linux?

If you are a person who uses Linux or its distros as their primary OS, there is a high probability that you have come across the annoying error message “dpkg was interrupted, you must manually run ‘dpkg –configure -a’ to correct the problem”.

You get this error when you are using the $apt-get command to install some packages or update your existing software packages, and the process gets killed.

Imagine you are required to update your favorite application, and you proceed to update it using the Command Terminal and the $apt-get command. The process is going along fine, but it stops suddenly, and you are presented with this error. It is very frustrating as you don’t know what went wrong and how to correct it.

The error can be caused by multiple reasons. You might have lost your internet connection, the package being installed was corrupted, or another issue you can’t point out. The problem with not knowing why the error occurred is that you can’t solve the issue straight away. You try out different things in the hope that the error is resolved.

For the users who are continuously experiencing this problem without any resolution, we will be taking a look at which commands you can execute on the Command Terminal to get rid of this error. So hang on tight, and let’s start the troubleshooting.

Commands You Should Run

When you get the dpkg error, the system advises you to configure the dpkg using this command.

$ dpkg –configure -a

Now, the majority of times you run this command, the dpkg tool is reset, and you can successfully return to reinstalling the package or whatever you were doing. However, there are instances where configuring dpkg doesn’t work, and you get the same error again and again. In such a case, you should execute the following commands.

$ sudo rm /var/lib/apt/lists/lock

$ sudo rm /var/cache/apt/archives/lock

$ cd /var/lib/dpkg/updates

$ sudo rm *

$ sudo apt-get update

These commands are a permanent fix whenever you are getting the dpkg error. Running these commands work most of the time, so you should try out these commands when you feel like you have hit a brick wall.

The $apt-get Command

The $apt-get command is a tool with which you can access the “Advanced Packaging Tool,” which is a library of all the software packages present in Linux. Through $apt-get you can download and install important software from authentic sources. $apt-get can also help get rid of and remove unwanted software and its dependencies from your Linux system.

Now, you can use multiple operators with $apt-get to perform multiple tasks respectively. We will be describing a few of them.

$apt-get install

As the name suggests, $apt-get install is used for installing software packages. By mentioning the name of the software, all its relative packages and dependencies will be downloaded and installed in your system. The syntax is very simple.

$ apt-get install <package name>

To install multiple packages, you can use this command.

$ apt-get install <package name1> <package name2>……..

You can also use $apt-get install in different ways. For example, if you want to install a specific software package version, you can use the following command.

$ apt-get install=version number

$apt-get update

This command is used for updating existing software packages in the “Advanced Packaging Tool” library to their latest versions. $apt-get update first checks for the latest version from the source and then downloads the latest version of all the packages.

$ apt-get update

$apt-get upgrade

$apt-get upgrade performs a similar job to $apt-get update, with the difference being that the software packages being updated are the ones present on your system. The command checks for the latest packages from the library, and if there is an update available for the desired software package, it downloads it and installs it.

$ apt-get upgrade package name

You can use it to also update multiple packages at a time.

$ apt-get upgrade package name1 package name2….

$apt-get remove

Again, as the name suggests, $apt-get remove is used for removing software packages from your Linux system. It performs the opposite job to $apt-get install.

$ apt-get remove <package name>

And for multiple packages,

$ apt-get remove package name1 package name 2….

$apt-get autoremove

Sometimes, the installed packages on your system require some important dependencies. These dependencies are installed automatically in your system, and when you uninstall that package, these dependencies remain there. To remove them, we use the $apt-get autoremove command.

$apt-get purge

This command performs a similar task to $apt-get remove. It uninstalls packages. The difference is that when you use “remove”, the configuration files are not removed for future use. If you want to get rid of the configuration files as well, use the $apt-get purge command.

$ apt-get purge package name

Conclusion

In this article, we discussed the “dpkg was interrupted; you must manually run ‘dpkg –configure -a’ to correct the problem” error received by users working on Linux and its distros. Users who have experienced it know that it is extremely difficult to deal with, so we discussed the commands you can use to get rid of this problem. We also described the $apt-get command and its different functions as a bonus. We hope that this article was able to help you out and if it did, please let us know in the comments.



from https://ift.tt/3qVVBRo

Post a Comment

0 Comments