Skip to main content
3 of 3
Fixed question title to fit the body of the question.
Jiri Klouda
  • 5.8k
  • 1
  • 21
  • 54

How to keep configuration files automatically during apt-get upgrade or install?

When performing and apt-get update; apt-get upgrade -y on a server I encountered the message:

Setting up sudo (1.8.16-0ubuntu1.5) ...

Configuration file '/etc/sudoers'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
The default action is to keep your current version.
*** sudoers (Y/I/N/O/D/Z) [default=N] ?
Setting up ubuntu-minimal (1.361.1) ...

I know that debconf can be used to configure packages, like MySQL, to answer questions to prompts.

Which Linux Program/Module/Function/etc should I use to prepare an answer to this prompt?

I would really like to know a solution that be performed via Ansilbe if one exists. In addition to a BASH script.

Please note: ALL my distributions are done via IaC and thus automation is critical.

Steven K7FAQ
  • 666
  • 1
  • 5
  • 13