# mergemaster testmodus needed or something else



## HL1234 (Aug 29, 2017)

Hello,
it comes to a new upgrade to FreeBSD 11.1. I have to use after install world, some tools like mergemaster(8) to merge old against new system files.
With mergemaster(8)I had have every time much problems - may be I'm not so good in the editing of the files with the diffs-editors...

So I'm looking for a solution to run mergemaster(8) in a "testmodus" like `portupgrade -n`. It should do and show everything what it really would do (changed) but not real execute it.

I have not found a switch for that? Have anybody a idea how can I do that?

Or more better, I want that
a) it should copy all things what new
b) it should change all files I never had touched
and
c) it should give me list of files which what have to merged without doing that - also without changing /etc/passwd, /etc/group and /etc/master.passwd /root/* - it should just tell me what is new. 
The documentation is a bit confusing for me, which switches are the right one for that?
I.E. why should it be "_dangerous_" when I use -u "_Attempt to auto upgrade files that have not been user modified._" switch?

Thank you all.


----------



## SirDice (Aug 29, 2017)

HL1234 said:


> Or more better, I want that
> a) it should copy all things what new
> b) it should change all files I never had touched
> and




```
-U          Attempt to auto upgrade files that have not been user
                 modified.  This option can be dangerous when there are
                 critical changes in the new versions that affect your running
                 system.
```


```
-i          Automatically install any files that do not exist in the
                 destination directory.
```


```
-F          If the files differ only by VCS Id ($FreeBSD) install the new
                 file.
```



> c) it should give me list of files which what have to merged without doing that - also without changing /etc/passwd, /etc/group and /etc/master.passwd


You're supposed to run `mergemaster -p` before installworld which will take care of this.


```
-p          Pre-buildworld mode.  Compares only files known to be
                 essential to the success of {build|install}world, i.e.,
                 /etc/group and /etc/master.passwd.
```


----------



## HL1234 (Aug 29, 2017)

Hello SirDice
thanx a lot to give me again answers.

You suggest -U. But the documentation says  "This option can be dangerous"
Is this dangerous or not and why?

I think -p is not what I want to do - it has more then two times crashed my system. I just only like to know what would `mergemaster -p` do and then do it by myself. Is there a way to figure out what the difference with the old /etc and the new /etc?

There are commands like
`diff -r -q "dir1" "dir2"` that could do it, but I am not sure if this would get all aspects what has to be changed?


----------



## SirDice (Aug 29, 2017)

HL1234 said:


> You suggest -U. But the documentation says "This option can be dangerous"
> Is this dangerous or not and why?


It's dangerous in a sense that automatically updating a configuration file may turn on (or off) something you didn't expect, certain security settings for example. But I've never had that happen. The warning is probably more meant as "better safe than sorry".



HL1234 said:


> I just only like to know what would  mergemaster -p do and then do it by myself. Is there a way to figure out what the difference with the old /etc and the new /etc?


A `mergemaster -p` doesn't change anything by itself. You always have the option to back out of a merge (skip for later).


----------



## HL1234 (Aug 29, 2017)

ok, thank you !


----------



## HL1234 (Aug 30, 2017)

I'm trying `mergemaster -p` know but I do not understand that output:
First it complaint about the $PAGER env-variable I has set it to "most". Ok I do:
`setenv PAGER /usr/local/bin/most`
then
`mergemaster -p`
the output is:

```
*** You have /usr/local/bin/most defined as your pager so we will use that

*** Creating the temporary root environment in /var/tmp/temproot
*** /var/tmp/temproot ready for use
 *** Creating and populating directory structure in /var/tmp/temproot
 *** Press the [Enter] or [Return] key to continue

 *** The following files exist only in the installed version of
         /etc. 
     In the vast majority of cases, these files are necessary parts of the system
     and should not be deleted.
     However because these files are not updated by this process you
     might want to verify their status before rebooting your system.
```
then the list of these files

```
Only in /etc: aliases
Only in /etc: amd.map
Only in /etc: apmd.conf
Only in /etc: auto_master
Only in /etc: autofs
Only in /etc: blacklistd.conf
Only in /etc: casper
Only in /etc: COPYRIGHT
Only in /etc: crontab
Only in /etc: crontab.ori
Only in /etc: csh.cshrc
Only in /etc: csh.login
Only in /etc: csh.logout
Only in /etc: ddb.conf
Only in /etc: defaults
Only in /etc: devd
Only in /etc: devd.conf
Only in /etc: devfs.conf
Only in /etc: devfs.rules
Only in /etc: dhclient-enter-hooks
Only in /etc: dhclient.conf
Only in /etc: DIR_COLORS
Only in /etc: disktab
Only in /etc: dma
Only in /etc: dumpdates
Only in /etc: fbtab
Only in /etc: freebsd-update.conf
Only in /etc: fstab
Only in /etc: fstab,v
Only in /etc: ftpusers
Only in /etc: gettytab
Only in /etc: gss
Only in /etc: host.conf
Only in /etc: host.conf.dhcp
Only in /etc: host.conf.dns
Only in /etc: hostid
Only in /etc: hosts
Only in /etc: hosts.allow
Only in /etc: hosts.allow.ori
Only in /etc: hosts.equiv
Only in /etc: hosts.lpd
Only in /etc: inetd.conf
Only in /etc: ipfw.rules
Only in /etc: ipfw.rules.ori
Only in /etc: ld.so.conf
Only in /etc: libalias.conf
Only in /etc: libmap.conf
Only in /etc: libmap32.conf
Only in /etc: localtime
Only in /etc: localtime.old
Only in /etc: locate.rc
Only in /etc: login.access
Only in /etc: login.conf
Only in /etc: login.conf.db
Only in /etc: mac.conf
Only in /etc: mail
Only in /etc: mail.rc
Only in /etc: make.conf
Only in /etc: make.conf-2010
Only in /etc: make.conf.ori
Only in /etc: mergemaster.rc
Only in /etc: motd
Only in /etc: motd.ori
Only in /etc: mtree
Only in /etc: netconfig
Only in /etc: netstart
Only in /etc: network.subr
Only in /etc: networks
Only in /etc: newsyslog.conf
Only in /etc: newsyslog.conf.d
Only in /etc: nscd.conf
Only in /etc: nsmb.conf
Only in /etc: nsswitch.conf
Only in /etc: nsswitch.conf.ori
Only in /etc: ntp
Only in /etc: ntp.conf
Only in /etc: ntp.conf.ori
Only in /etc: opieaccess
Only in /etc: opiekeys
Only in /etc: pam.d
Only in /etc: passwd
Only in /etc: pccard_ether
Only in /etc: periodic
Only in /etc: periodic.conf
Only in /etc: pf.os
Only in /etc: phones
Only in /etc: pkg
Only in /etc: portsnap.conf
Only in /etc: ppp
Only in /etc: printcap
Only in /etc: profile
Only in /etc: protocols
Only in /etc: pwd.db
Only in /etc: rc
Only in /etc: rc.bsdextended
Only in /etc: rc.conf
Only in /etc: rc.conf,v
Only in /etc: rc.conf.d
Only in /etc: rc.conf.no-services
Only in /etc: rc.conf.ori
Only in /etc: rc.conf.sav
Only in /etc: rc.d
Only in /etc: rc.firewall
Only in /etc: rc.initdiskless
Only in /etc: rc.resume
Only in /etc: rc.sendmail
Only in /etc: rc.shutdown
Only in /etc: rc.subr
Only in /etc: rc.suspend
Only in /etc: remote
Only in /etc: resolv.conf
Only in /etc: resolv.conf.dhcp
Only in /etc: resolv.conf.dns
Only in /etc: resolv.conf.sav
Only in /etc: rmt
Only in /etc: rpc
Only in /etc: security
Only in /etc: services
Only in /etc: shells
Only in /etc: skel
Only in /etc: snmpd.config
Only in /etc: spwd.db
Only in /etc: src.conf
Only in /etc: ssh
Only in /etc: ssl
Only in /etc: sysctl.conf
Only in /etc: syslog.conf
Only in /etc: termcap
Only in /etc: termcap.small
Only in /etc: ttys
Only in /etc: unbound
Only in /etc: X11
Only in /etc: zfs
Press `Q' to quit, `H' for help, and SPACE to scroll.
Q
 *** Press the [Enter] or [Return] key to continue
*** Beginning comparison
*** Comparison complete
*** /var/tmp/temproot is empty, deleting
```
What does that mean? It looks like that these are all the files in /etc that "exist only in the installed version of /etc."
I can not believe that in the new FreeBSD userland this /etc-files do no more exist?
What is mergemaster telling me about that?

If mergemaster want to told me that these files are files that I have changed and should be merged, or should be visit the diffs by hand, why not told me so?

And at the end - no merging:

```
"*** Beginning comparison
*** Comparison complete
*** /var/tmp/temproot is empty, deleting
```

I am really confused about that result.
Please what to do with it?

in addition:
as example: the files in /etc/gss, /etc/dma I have never touched! Should I delete them know?


----------



## SirDice (Aug 31, 2017)

The -i in combination with -U shouldn't be needed. The -F is normally not needed either but is useful when upgrading major versions. Typically after a major update all the copyrights in the headers get changed but this rarely happens with minor updates.


----------



## HL1234 (Sep 1, 2017)

I believe my question is not understand.
What does the ouput of `mergemaster -p` mean? It looks like that these are all the files in /etc that "exist only in the installed version of /etc."
I can not believe that in the new FreeBSD userland this /etc-files do no more exist?
What is mergemaster telling me about that?

Do mergemaster want to told me that these files are files that I have changed and should be merged, or the diffs should be visit by hand?


----------



## SirDice (Sep 1, 2017)

The -p option only deals with files that would be essential for a installworld to work. Which usually means it only looks at /etc/passwd and associated files. One of the files mentioned is /etc/resolv.conf for example, this file is just not required for installworld to work correctly. 

Tyically you follow this order:

```
make installkernel
reboot to single user mode (I usually skip this step)
mergemaster -p 
make installworld
mergemaster -U
reboot
```


----------



## HL1234 (Sep 1, 2017)

Ok - but what to I do based on the output result (see above)
form `mergemaster -p` ?
Do it mean, because there was no merge suggestion:
	
	



```
...
Only in /etc: X11
Only in /etc: zfs
Press `Q' to quit, `H' for help, and SPACE to scroll.
Q
 *** Press the [Enter] or [Return] key to continue
*** Beginning comparison
*** Comparison complete
*** /var/tmp/temproot is empty, deleting
```
that there is nothing to do before `make installworld`?


----------



## jb_fvwm2 (Sep 1, 2017)

I ignore 'only exist in' where it lists the extra files.
  mergemaster[.sh] -vipPc  may work, YMMV...
  I try to remember l= left, merge the left part
                              r= right, merge the right part.
 It is somewhat a fearsome part of the upgrade...


----------



## HL1234 (Sep 2, 2017)

jb_fvwm2 said:


> I ignore 'only exist in' where it lists the extra files.


Ok I think I will also do it, _because there is no other answer to my question_


jb_fvwm2 said:


> mergemaster[.sh] -vipPc  may work, YMMV...


I think this is wrong. mergemaster has to call two times. One before `make installworld` and second after [see Absolute BSD - The Complete Guide to FreeBSD (2nd Edition) Page 390]. Before the install you call `mergemaster - p` because of  -p stands for " Pre-buildworld    mode.  Compares    only files known to be essential to the success of  {build|install}world..". The other switches you will take after installing.
So your command mix this things together.
`mergemaster -P` is good if you have not make a copy of /etc but what I every time do; i.e:
`cp -Rpv /etc /home/etc-JJMMDD` 


jb_fvwm2 said:


> It is somewhat a fearsome part of the upgrade...


Yes! that is my problem, too. More then 3-5 times since the last 12 years, with mergemaster, my files in
/etc, that I had edit, has been changed in such a way that I have a lot of work with examining most all of this files - and what have taken every time some days. As result of this experience I have set to ignore some files. To do so I set this in /etc/mergemaster.rc

```
IGNORE_FILES='/etc/fstab /etc/rc.conf /etc/ssh/sshd_conf /etc/pam.d/sshd /etc/ftpusers /etc/passwd /etc/group /etc/master.passwd /etc/motd /etc/mail/sendmail.cf /etc/aliases /etc/newsyslog.conf'
```
 It is easier to check them by myself then mergemaster will "kill them". The new /etc-files can be found in /usr/src/etc - but note: the directory and file structure are not exact the same.
In addition (as idea for others), in every file in /etc I make changes I write a commend in the very first line with my name abbreviation and date, so I will quick know if I have to give it my attention or not. If there stands nothing, then the config file is FreeBSD original.


----------



## ShelLuser (Sep 2, 2017)

I really think you should study mergemaster(8) a bit more. Because it has plenty of options which can counter any issues. For example -P which will preserve any replaced files (for example).

For what's it worth I always use `# mergemaster -iF` (definitely no automatic changes on my systems) and it has never failed me so far. May take a little more time, but I prefer to know keep close taps on what is going to change.


----------



## HL1234 (Sep 6, 2017)

I had study mergemaster a lot of. Now I have done

`mergemaster -iUv`

So I have expected that it do:
-U  Attempt to auto upgrade files that have not been user modified and
-i  Automatically install any files that do not exist in the destination directory.
and don't ask me anything about other files, and give verbose output what it has been done. 

The opposite has happen:
mergemaster has ask me all every 20 -30 files I had edit in /etc. And it do the other things in background. Without a script that has log this, I would not know what it has done. Also some new files was missed as I compare /etc/[subdirs] with /usr/src/etc/[subdirs] so I believe it works not perfect.

Is there really no alternative to mergemaster?


----------



## xtaz (Sep 8, 2017)

There is. It's called etcupdate(8). But I personally stick with mergemaster as I prefer the way it does diffs where you type l or r to select which side of config you want. etcupdate puts <<< or >>> signs into the file and you have to manually edit them. Might be worth a try though, you might prefer it.

As for mergemaster I don't use command line switches, I use /etc/mergemaster.rc and have this set in it:


```
FREEBSD_ID=yes
AUTO_INSTALL=yes
AUTO_UPGRADE=yes
RUN_UPDATES=always
IGNORE_FILES='/etc/motd'
DELETE_STALE_RC_FILES=yes
```
It could be the FREEBSD_ID option that you may be needing here. That is -F on the command line switches.


----------

