# freebsd-update asks me to merge/diff 100+ files



## sintheaus (Oct 14, 2014)

I have an old FreeBSD 7.4 system that I want to update to FreeBSD 8.4-RELEASE. I think FreeBSD 7 was installed from a CD or DVD image. However, this same problem occurs when I update FreeBSD 8 -> 9, and has happened to us in the past on other hosts.

I need help figuring out why `freebsd-update` is asking me to merge over 100 files, most of which I have never ever touched before. Is this behavior normal? How can I prevent it?

I am following the directions at https://www.freebsd.org/releases/8.4R/installation.html . Step 1 looks simple at first:


```
freebsd7# freebsd-update upgrade -r 8.4-RELEASE
Looking up update.FreeBSD.org mirrors... none found.
Fetching metadata signature for 7.4-RELEASE from update.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.
Inspecting system... done.

The following components of FreeBSD seem to be installed:
kernel/generic src/base src/bin src/cddl src/contrib src/crypto src/etc
src/games src/gnu src/include src/krb5 src/lib src/libexec src/release
src/rescue src/sbin src/secure src/share src/sys src/tools src/ubin
src/usbin world/base world/dict world/doc world/info world/manpages
world/proflibs

The following components of FreeBSD do not seem to be installed:
world/catpages world/games world/lib32

Does this look reasonable (y/n)? y
Fetching metadata signature for 8.4-RELEASE from update.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.
Inspecting system... done.
/usr/sbin/freebsd-update: cannot open files/.gz: No such file or directory
Attempting to automatically merge changes in files... done.

The following file could not be merged automatically: /etc/amd.map
Press Enter to edit this file in vi and resolve the conflicts
manually...
```

According to the FreeBSD docs (and the handbook), 





> During this process, FreeBSD Update may ask the user to help by merging some configuration files or by confirming that the automatically performed merging was done correctly.


. 

But freebsd-update is not just asking me to merge "some" configuration files. `freebsd-update` is asking me to merge well over 100 files, 90% of which I have never touched and I know nothing about.

Note that `freebsd-update` uses the merge(1) command. It does not use `mergemaster`. For each file, `merge(1)` will dump me into a vi window and show a diff containing `<<<<<<<`, `=======` & `>>>>>>>`. If I fail to merge the file correctly, or fail to remove the `<<<<<<<`, `=======` & `>>>>>>>` strings, the file may be left in a corrupt state.

95% of the diffs simply told me about a diff in the RCS version string, like this diff for `/etc/amd.map`. Can I tell freebsd-update to simply accept the new version string? Why is it bothering me about this?


```
<<<<<<< current version
# $FreeBSD: src/etc/amd.map,v 1.10.8.1 2009/04/15 03:14:26 kensmith Exp $
=======
# $FreeBSD: release/8.4.0/etc/amd.map 164015 2006-11-06 01:42:11Z obrien $
>>>>>>> 8.4-RELEASE
#
/defaults       type:=host;fs:=${autodir}/${rhost}/host;rhost:=${key}
*               opts:=rw,grpid,resvport,vers=3,proto=tcp,nosuid,nodev
~
```

And this diff of `/etc/gss/mech`. Again, I have never touched this file, and I don't even know what it is. Why is it asking me?


```
<<<<<<< current version
# $FreeBSD: src/etc/gss/mech,v 1.1.2.1.4.1 2009/04/15 03:14:26 kensmith Exp $
=======
# $FreeBSD: release/8.4.0/etc/gss/mech 184588 2008-11-03 10:38:00Z dfr $
>>>>>>> 8.4-RELEASE
#
# Name          OID                     Library name                    Kernel module
kerberosv5      1.2.840.113554.1.2.2    /usr/lib/libgssapi_krb5.so.10   kgssapi_krb5
spnego          1.3.6.1.5.5.2           /usr/lib/libgssapi_spnego.so.10 -
#ntlm           1.3.6.1.4.1.311.2.2.10  /usr/lib/libgssapi_ntlm.so.10   -
```

freebsd-update then asks me to review the list of diffs again, for about 100 files:


```
The following changes, which occurred between FreeBSD 7.4-RELEASE and
FreeBSD 8.4-RELEASE have been merged into /etc/amd.map:
--- current version
+++ new version
@@ -1,4 +1,4 @@
-# $FreeBSD: src/etc/amd.map,v 1.10.8.1 2009/04/15 03:14:26 kensmith Exp $
+# $FreeBSD: release/8.4.0/etc/amd.map 164015 2006-11-06 01:42:11Z obrien $
 #
 /defaults       type:=host;fs:=${autodir}/${rhost}/host;rhost:=${key}
 *               opts:=rw,grpid,resvport,vers=3,proto=tcp,nosuid,nodev
Does this look reasonable (y/n)?
```

Can I tell freebsd-update to stop asking me about the the RCS version string? Or to simply accept the updated version of these obscure files? I can assure you that we never touched most of these. I never, ever touched `src/etc/pccard_ether` or `src/etc/pam.d/telnetd`.

This large number of diffs is prone to error and dangerous. Yesterday I corrupted one of my systems to the point that basic utilities like `portsnap` were failing. I see that other people have run into this same headache as well, like zytrax.com. I don't see a solution.


----------



## kpa (Oct 14, 2014)

What you're seeing is normal. There have been many changes in the format of the ID tags because the release process has changed over the years. I also think that the switch from CVS to Subversion also contributed to the change of the ID tags, it might have happened earlier than FreeBSD 7 though, I'm not sure.


----------



## sintheaus (Oct 14, 2014)

Can I automate `freebsd-update` to accept the new version strings?


----------



## junovitch@ (Oct 14, 2014)

It looks like in the most recent freebsd-update in stable/9 and stable/10 that the version string is changed to just "$FreeBSD$" for comparison by the samef () function before comparing the files.  So the issue you are seeing has been solved, it's just you'll have to play version catch up until you can use it.  Either that or grab just the freebsd-update shell script from a newer branch and see what happens.  Probably would want to test that out though before doing it on anything important.


----------



## sintheaus (Oct 15, 2014)

Thanks all.

Would there be any value in changing these settings in `/etc/freebsd-update.conf`?


```
# Paths which start with anything matching an entry in an UpdateIfUnmodified
# statement will only be updated if the contents of the file have not been
# modified by the user (unless changes are merged; see below).
UpdateIfUnmodified /etc/ /var/ /root/ /.cshrc /.profile

# When upgrading to a new FreeBSD release, files which match MergeChanges
# will have any local changes merged into the version from the new release.
MergeChanges /etc/ /var/named/etc/ /boot/device.hints
```


----------



## sintheaus (Oct 15, 2014)

Yeah, sorry folks. `freebsd-update` on FreeBSD 7 and 8 appears horribly broken. See https://lists.freebsd.org/pipermail/fre ... 51818.html . Usually, I'm only asked to merge < 25 files. But on this system, it wants me to merge 150+ files, 80% of which differ only due to the CVS/RCS version string, another 15% that look very delicate, like sendmail.cfand named files, all of which are arcane. Again, I never modified these files so `freebsd-update` should just proceed and upgrade the beasts. The last 5% consist of files like /etc/passwd and /etc/hosts, which of course differ from the original files.

https://lists.freebsd.org/pipermail/fre ... 51818.html has an interesting workaround, but I can't be certain it's doing the right thing.

Next step is to try to update from source, since it sounds like `mergemaster` is far more automated then the `freebsd-update`/`merge` hassle.


----------



## debguy (Oct 16, 2014)

*T*wo things.

*Y*es I'm sure the install has various ways to detour questions. Maybe you'd prefer it putting all new files as xxx.new beside your 100 files (because new authors no longer take care to avoid changes that cause old/new file incompatibility: problem, old options/choices will cause problems.  *A* shame.  I have 25 year old BSD files I haven't changed but have heavily edited that still work).

*) You might run install w/o interface and pump answers to it if you can't find the avoidance technique you need 

You likely don't want *Free*BSD to clobber files you've edited unless you have a plan for replacing them so you do need a strategy.


Clobber all with new, then you replace the few you have, no doubt, revisioned and saved (or pop out of rcs(1)), this sounds good in your scenario.
100? You have more software to manage than you can really handle.  *H*old down your frivolous installs to a minimum - everything from portage and more will be less hard on you and your sanity.
It may seem good to click on every last app and be able to run them "just in case you need them", but it may well end up more problematic for you having thousands of unknowns to deal with.

Make the system you need, be conservative of what you really will have time to thoroughly be involved with (ASM contributions? Firefox contributions? Just application use?), and not more.


----------



## wblock@ (Oct 16, 2014)

debguy, just checking, but you realize this is a FreeBSD forum, right?  All those files in /etc are for the operating system only.  We don't mix applications and the operating system, application config files go in /usr/local/etc/.

It is usually a mistake to overwrite files in /etc.  The password files in particular can be a problem.


----------



## DutchDaemon (Oct 17, 2014)

Also debguy, we have a Rules and Guidelines section. It is really time you started posting according to the forum rules. Make an effort, and such.


----------



## vask (Oct 24, 2014)

freebsd-update also asked me to merge 100+ files mostly different only in the comment with the version number.

This dramatically increases the probability of human error when merging.

With freebsd-update I am not sure why files that differ only in comments can't be automatically merged or ignored.


----------



## foo_daemon (Oct 24, 2014)

Unfortunately I can't give much useful advice as I haven't used `freebsd-update` for several years (since I started doing customization on kernels), but within mergemaster are these command options:


```
-i          Automatically install any files that do not exist in the des-
                 tination directory.
     -F          If the files differ only by VCS Id ($FreeBSD) install the new
                 file.
     -U          Attempt to auto upgrade files that have not been user modi-
                 fied.  This option can be dangerous when there are critical
                 changes in the new versions that affect your running system.
```

However, as you stated,


sintheaus said:


> Note that `freebsd-update` uses the merge(1) command. It does not use `mergemaster`.





sintheaus said:


> Next step is to try to update from source, since it sounds like `mergemaster` is far more automated then the `freebsd-update`/`merge` hassle.



It truly is.. and there's also a great article in the handbook.

The `-U` option doesn't really change anything the first time around: it builds a database (probably of checksums) of the config files as they are installed. If that config file's checksum has changed the next time you do a `mergemaster -U`, it knows that file has been _user modified_, and will make sure it asks you to merge changes to that file. Otherwise it auto-updates the file.. iirc this option existed before the `-F` did, so it may be somewhat antiquated, seems like `-F` will basically do the same.


----------



## wblock@ (Oct 25, 2014)

-U is a superset of -F.  So I use -Ui.


----------

