A listing of random software, tips, tweaks, hacks, and tutorials I made for Ubuntu

purgeconfig – A safer way to reset configuration files

Many people try purging packages and reinstalling them to reset them, but it sometimes removes other packages with it, so it becomes a headache (especially when you are trying to reset the X11 configuration files, removing a few hundred packages with it).

To solve these problems, I made a script called purgeconfig that will artificially reset the configuration files (manually removing the configuration files, marking the packages as purged, then reinstalling the packages).

WARNING: Do NOT run Apt/Aptitude/DPKG/Synaptic/Software Center while running purgeconfig.

Download and install the script with this command:
wget && chmod +x && sudo cp /usr/bin/purgeconfig

Usage is simple:
sudo purgeconfig package1 package2 package3 etc...

You can specify the architecture:
sudo purgeconfig package1:i386 etc...


If you have any questions/comments, feel free to leave a comment.


4 responses to “purgeconfig – A safer way to reset configuration files

  1. Evan October 27, 2011 at 4:07 pm

    There’s an easier and substantially safer way to do this:

    apt-get install –reinstall -o DPkg::options::=–force-confask package:i386

    • Raphaël Hertzog October 30, 2011 at 2:18 pm

      Exactly, purgeconfig is an horrible hack. Marking a package purged without running its postrm and without removing any of the file is a sure way to loose track of some files. Furthermore /var/lib/dpkg/info/*.conffiles will not have the obsolete conffiles that you usually want to get rid of with the purge. They are only listed in the status database.

      That said you should also use –force-confnew together with –force-confask and you’ll properly reset all the conffiles that way.

      Otherwise you can always manually purge while using –force-depends. But I prefer the reinstallation approach.

  2. Luke October 27, 2011 at 5:42 pm

    Bad idea. Don’t put anything in /user/bin, let your package manager have that. Put personals in ~/bin and add it to $PATH. That way you also get to keep it after a reinstall/distro change(if you’re smart enough to keep /home on its own partition/drive…)

  3. Pingback: Purgeconfig – A safer way to reset configuration files | Ubuntu Geek

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: