If I want to reinstall the configs of some package x (i.e. files in /etc), how would I do that?

Does apt-get --reinstall install x always reinstalls the configs?

Other answers suggest to remove the configs first and then use apt-get -o Dpkg::Options::="--force-confmiss" x. However, I don't want to do that for all of /etc because I want to keep my system in a well-behaved state as far as possible. I basically just want that it overwrites existing config files.

I also read about --force-all, --force-confnew, --overwrite-conffiles and the UCF_FORCE_CONFFMISS, UCF_FORCE_CONFFNEW env vars. Some documentation is here and here, although I'm not sure if it does exactly what I want.

  • I disagree, because I don't see how the linked Q&A is specific to a specific file/package. I still believe it's the right duplicate question. The question includes an example of a package and a configuration file. The answer there is generic and holds for every package (step 3 in the accepted answer is a generic template). If that answer does not answer your use case, you should edit your question to include why it doesn't. – gertvdijk Dec 22 '14 at 10:00
  • That's all new information not present in your original question. Please edit your question rather than posting comments with further requirements for an answer. That's how this site works. – gertvdijk Dec 22 '14 at 10:05
  • It shouldn't be that difficult to use find -exec to automate @gertvdijk 's solution. – muru Dec 22 '14 at 10:10
  • So don't delete. Move them. – muru Dec 22 '14 at 10:12
  • And read the manpages before asking for documentation: manpages.ubuntu.com/manpages/trusty/en/man1/dpkg.1.html – muru Dec 22 '14 at 10:12

This is what you want to do:

sudo -s
cd /tmp
mkdir deb
cd deb
apt-get update
apt-get download package1 package2 package3
dpkg -i --force-confmiss *.deb

You can look here for some more ways.

  • -1. 1) No need to download and local-install packages. apt-get can download from the repository directly. 2) It will not work as indicated in the comments -- the configuration files should be removed in order for --force-confmiss to work. – gertvdijk Dec 22 '14 at 10:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.