Force apt-get to reinstall config files

apt-get -o DPkg::options::=--force-confmiss --reinstall install <package>

Update: apt-get only reinstalls missing config files. You can use dpkg --purge <package> to remove the config files before reinstalling the package.

12 thoughts on “Force apt-get to reinstall config files

  1. skanx Post author

    Thanks, I updated the “post”. You can still use dpkg --purge <package> to remove config files from a package, before reinstalling the package with --force-confmiss.

  2. anonymous

    apt-get -o DPkg::options::=–force-confmiss –reinstall install pulseaudio

    not work for me.
    /etc/pulse/default.pa still have my changes.
    Ubuntu 12.10

    Try yourself.

  3. skanx Post author

    Hello,

    /etc/pulse/default.pa still have my changes.

    Did you try uninstalling completely pulseaudio and all its files?
    dpkg --purge pulseaudio

    Is the file /etc/pulse/default.pa owned by the pulseaudio package?
    I don’t have an Ubuntu system atm to try this on, sorry.

  4. skanx Post author

    Sorry, I don’t know how to do that automatically.
    Maybe download the deb file and extract the configuration files manually?

  5. Ratchanan Srirattanamet

    Is it possible to just delete config file and reinstall package using above command?

  6. Skippy

    It appears some of the other solutions won’t work if the configuration files of the package are managed with ucf.

    In this case you can use :

    UCF_FORCE_CONFFMISS=1 apt-get –reinstall install [pkgname]

  7. Mike

    Hey thanks,

    Trying to reinstall bacula-server. I am not getting the configuration files. Everything from your page does not work. I will continue to seek a solution and will get back with you if/when I find the solution.

    Thanks again,

    Mike

  8. Mike

    # apt-get purge bacula-server

    # apt-get install aptitude

    # cd /var/cache/apt/archives/

    # ls
    …find your .deb

    # aptitude install -o Dpkg::Options::=–force-confmiss bacula-server_5.2.6+dfsg-9.1ubuntu3_all.deb

    # apt-get install bacula-server

    Whamo all config files are back! Royal pain. Next time I will make a .bak file before I start mad configs!

    regards,

    Mike

  9. Esteban

    UCF_FORCE_CONFFMISS=1 apt-get –reinstall install [pkgname]
    don’t work on Debian 9.

    apt-get -o DPkg::options::=–force-confmiss –reinstall install
    OK

Leave a Reply

Your email address will not be published.