7

This morning I installed some updates that asked me if I wanted to replace configuration files:

Configuration file '/etc/apache2/envvars'
 ==> 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.
*** envvars (Y/I/N/O/D/Z) [default=N] ? N

I kept my current configuration, but after that, I started wondering:

Is there a way to see what the new config file would have looked like, after the fact?

3
5

I haven't tested this but logic dictates that you could review the file contained in the package that was updating. I'm assuming the apache2 package for your current distribution selectable from this page (you can confirm by checking your dpkg.log)

DEB files are archives, which always contain the three files — debian-binary, control.tar.gz, and data.tar.gz. We can use dpkg-deb and tar command to extract and view the files from the deb package, as shown below.

Simply extract the files from the package to a temporary location. As an example: dpkg-deb -x packagename.deb /tmp Adjusting the package name and target location as necessary.

Having extracted the content of the package, next extract the content of the included data.tar.gz component with tar -xvzf data.tar.gz

Locate the included envvars file (you could use find ./ -name envvars from the location you extracted the data.tar.gz file.

Having located the file navigate to that directory and use diff envvars /etc/apache2/envvars to display the differences between your current configuration file and the suggested one. Sources:

http://www.thegeekstuff.com/2010/04/view-and-extract-packages/

man dpkg

man dpkg-deb

man diff

3

I'm accepting Elder Geek's answer because it works and seems to be the most generally applicable without being too labor intensive. Waltinator's answer seems to me that it would work but I am leery of reinstalling.

However, I did come up with 2 additional ways to address this problem.

  1. I have a clone of my server running in a Virtualbox VM. I took a snapshot, applied the update (choosing the package maintainer's versions), copied those versions off to a shared drive, then deleted the snapshot, and did the update for reals.

    Downside: normally I do the update in the virtual machine first before the real machine, so I would have to know to take the snapshot first. Maybe this is good practice before applying any apache2 update? I will have to think about that.

  2. This is the easiest answer of all, but I do not know if it is generally applicable. I was using aptitude and updating apache2, and in the /etc/apache2/ folder, I found copies of the package maintainer's config files that I had rejected! They were named apache2.conf.dkpg-dist and envvars.dpkg-dist! How cool is that?

Downside: I don't know if this only happens with aptitude and\or apache2, this may not be generally applicable.

2
  • 3
    Your findings from section 2 apply in general. The program that shows dialogues during package installation like in your question also creates "back-ups" of the old and the new configuration file variants (depending on which one you chose to use). Dec 21 '16 at 18:08
  • Frankly, point 2 should be the accepted answer, because of the reason David gives.
    – muru
    Dec 26 '16 at 16:22
1

You could recreate the condition, and choose differently.

First, copy /etc/apache2/envvars somewhere safe, so, in the worst case, you can restore it.

dpkg -S /etc/apache2/envvars tells us that /etc/apache2/envvars is part of the apache2 package, so you can reinstall it via:

sudo apt-get install --reinstall apache2

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.