2

After installing a package with apt-get and then overwriting some package specific config files, whenever the system upgrades itself it tries to overwrite my custom configs with the package default ones.

Is there a better way to specific custom configs without being asked if I want to reset to the default ones whenever the package updates itself?

  • Any Debian package that follows the Debian policy will not overwrite files under /etc without prompting you to make the change, assuming you are updating interactively and haven't changed the default dpkg behavior. If you are changing files outside of the /etc/ directory then you might have problems, and there isn't a simple way to address this. Can you give some examples of specific packages/files that you have had problems with getting over-written? – Zoredache Dec 5 '13 at 22:37
  • @Zoredache: I'm being asked if I want to update my custom config files, but in a server where I don't login that often it can be easy to forget what/why was changed. Example packages include ngnix config files for instance. I wonder how Puppet or other devop utilities handle this. Ideally, I would want the config not to be overwritten unless there was a major change in the config file (new options, version or behavior) but I guess that is asking too much. – Alix Axel Dec 6 '13 at 8:51
3

You can pass options to dpkg from apt. Interesting for you would be the option --force-confold. The command looks like this:

apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade

Setting --force-confdef as well makes apt-get still update the config file if it hasn't been edited, while --force-confold will keep edited configuration files without asking.

To make this permanent, you can also set these options in your apt.conf file:

Dpkg::Options {
   "--force-confdef";
   "--force-confold";
}

Check e.g. http://debian-handbook.info/browse/wheezy/sect.package-meta-information.html#sidebar.questions-conffiles

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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