Richard in Linux 1 minutes

Restore Debian Package Config Files

This has happened to me many times, making numerous changes to config files until it’s so broken I don’t know where to start fixing :) Luckily there is a way out of this mess at least with debian packages like this.

$ dpkg -S /etc/vernemq/vernemq.conf
vernemq: /etc/vernemq/vernemq.conf

We have now established Verne is the package name.

Let’s be safe and take a backup of the mangled file.

$ sudo mv vernemq.conf vernemq.conf.old

Now recover config

$ sudo apt-get -o Dpkg::Options::="--force-confmiss" install --reinstall vernemq
Configuration file `/etc/verne/vernemq.conf', does not exist on system. 
Installing new config file as you requested.

But stop for a second, let’s assume you didn’t install from the package manager and instead used a .deb file.. not a problem!

dpkg -i --force-confmiss <package_deb>.deb