Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to replace /etc configuration files from a package, overwriting my local changes? I've tried apt-get install --reinstall mypackage but it doesn't update the files.

How can I do this?

share|improve this question
    
up vote 10 down vote accepted

A related serverfault question describes how to restore package conffiles if you've removed them, and requires that you track down the actual .deb file.

All you need to do:

  • Find the list of conffiles provided by the package:

    dpkg --status <package>
    

    (look under the Conffiles: section).

  • Remove those conffiles yourself.

  • Reinstall the package. If you've found the .deb file,

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

    Alternatively, passing the dpkg option via apt should work:

    apt-get install --reinstall -o Dpkg::Options::="--force-confmiss" <package>
    
share|improve this answer
    
Nice, thanks. What if you don't know in particular which package provides a file? – Naftuli Tzvi Kay Dec 27 '11 at 19:33
5  
dpkg -S /file/to/search give you the package name – Dom Dec 27 '11 at 19:51

Besides remove apt-get also offers the purge command which cleans out your config customizations, which can then be followed by an apt-get install

share|improve this answer
    
purge certainly works for many packages but not the essential ones that you can't remove without seriously breaking things. – jw013 Dec 28 '11 at 1:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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