Debian – What to do when upgrading packages and a config file has changes

aptconfigurationdebian

I'm new to system administration and I'm helping admin a server for a student group. I was wondering, what is the best practice for when you're upgrading packages and a config file has changes. I've been looking at the differences and then usually just leaving the old version unless it looks like there is something important to add, and otherwise merging the config files manually with kdiff3, but is there a better way to do it?

Also, do I have to backup the old file somewhere myself or does dpkg automatically make a backup? I sometimes I noticed .old files in some directories for old versions of config files.

This issue is complicated by the fact that since I'm new to this group, I don't know why some changes are the way they are, but if in doubt I've been deferring to the existing version.

By the way, I'd like some specificity. Eg, when dpkg prompts you with the whole Y/N/I/O/D/etc thing, what do you do? Do you back up the old file, install the new one, and then merge, or is there a better way to merge the files when you're in that ncurses prompt thing?

Best Answer

that seems like a reasonable way of doing it. similar to what i've been doing for about 15 years (been using debian since 1994). it's always worked for me :)

i start with the basic assumption that if i've modified a config file, then i had a good reason for it, and my changes are likely to be better/more important than anything in the new default config file.

i then examine both my config and the new packaged version and either:

  1. completely ignore any differences because they're either not important or not relevant to my setup.

  2. merge anything useful from the new config into my existing config.

  3. if there's a lot of new stuff and only a small amount of my changes that i want to keep, then i do the reverse and merge my changes into the new config file and then use that.

i don't use any specialised or GUI tools for this. i just use 'diff -u' and less and vi plus occasionally some of the standard text processing tools like sed or perl. colordiff is nice, too, when the diff output is more than a screenful or so.

Related Topic