Skip to main content
2 of 2
added 1 character in body
Kusalananda
  • 356.1k
  • 42
  • 737
  • 1.1k

After upgrading my (old) system to the latest snapshot, a copy of the pristine /etc hierarchy (and also of other variable files under /root and /var) is available in /var/sysmerge/etc.tgz. There is also a separate archive called /var/sysmerge/xetc.tgz holding the base system's default X11 configuration. Note that etc.tgz does not contain files not intended to be modified, like /etc/services or /etc/daily, and that it does not contain configuration files for things that are installed without a default configuration file (but that may have one for local tweaking of the defaults), such as /etc/doas.conf.

To see what files I have modified on my old system, I may extract these archives to some directory and simply do a diff. The extraction has to be done as root as the /var/sysmerge directory is protected.

mkdir /tmp/tmpdir doas tar -xz -f /var/sysmerge/etc.tgz -C /tmp/tmpdir doas tar -xz -f /var/sysmerge/xetc.tgz -C /tmp/tmpdir 

Looking at the diff is made easier by first deleting old unused configuration files belonging to packages no longer installed. These may be found by using the sysclean tool from ports. This tool would also identify old and unused versions of libraries, and it may be a good idea to run it after any system upgrade or after upgrading ports.

Producing a diff for the /etc files:

doas diff -ru /tmp/tmpdir/etc /etc 

This produces a recursive unified diff of the files I'm likely to be interested in.

On my private system, this is enough to give me a hint of what I need to set up when I later get to configuring my new machine. For example, I had forgotten that I had disable root logins and password authentication in my /etc/ssh/sshd_config file, and that I at some point had set up an additional user for testing (!).

When done, I delete the unpacked archives:

doas rm -rf /tmp/tmpdir 
Kusalananda
  • 356.1k
  • 42
  • 737
  • 1.1k