How To Overwrite Existing Files From A Removed Package in Ubuntu and Debian

Concept: Remove vs Purge

When you remove a package, some configuration files of the removed package remain in the package’s destination.
Purging a package, means removing a package and all it’s configuration files.

So, to overwrite the files an removed package left behind, you have to purge the package and reinstall the new one:

Purge the packages with dpkg:

$ sudo dpkg --purge package1 package2 package3
Or, if the previous command does not work, try this:
$ sudo dpkg --force-overwrite --purge package1 package2 package3

No, the configuration files belonging to package1, package2 and package3 are no longor on your hard drive.

Clean the local repo:
$ sudo apt-get clean
Install the needed packages, with apt:
$ sudo apt-get install package1 package2 package3

This article works on the dpkg based Linux distros: Debian, Ubuntu, Linux Mint, Knoppix etc.

Tagged with: , , , , , , , , , ,
Posted in The Linux and Unix Articles!

Leave a Reply

Your email address will not be published. Required fields are marked *




Subscribe to get the latest Linux news and how to guides directly on your e-mail!