Upgrading FreeBSD jail 8.3-RELEASE to 11.2 or 11.3-RELEASE gives merge errors. How to manually handle them?

Hello, I'm relatively new to FreeBSD, because I only use it in FreeNAS warden or iocage jails or plugins.
While trying to upgrade some migrated warden jails to iocage jails after upgrading FreeNAS 11.2 to 11.3-RELEASE I tried to get the migrated iocage jails working.

Two were corrupt, due to lacking /bin/freebsd-version. I tried to get the pluginjail with 8.3-RELEASE working by copying over the freebsd-version binary into the jail, and it worked so far. But I'm getting strange version missmatches of freebsd-version after trying to upgrade that jail to 11.2-RELEASE, whether I'm using iocage, uname -a or freebsd-version.

When trying to upgrade the 11.2-RELEASE jail (according to freebsd-version) to 11.3-Release with iocage, I'm getting a couple of diff merging errors, and the upgrade didn't succeed.

I got these diff merging errors. Due to my lack of FreeBSD experience I'm not able to solve them manually and need some hints how to edit these merging files to get the current configuration format picked up by the upgraded jail.

Please, someone advice me or point me to the needed editing for the merge, because I'm unfamiliar with this merge format.

Maybe there is a handout, howto or tutorial about editing the merged diffs manually.

The affected files
Code:
root@floogy:~ # iocage console pluginjail
Last login: Wed Aug 26 11:10:12 on pts/4
FreeBSD 11.3-RELEASE-p11 (FreeNAS.amd64) #0 r325575+fb17f3e15b8(HEAD): Tue Jul 28 11:09:10 EDT 2020

Welcome to FreeBSD!

Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories:   https://www.FreeBSD.org/security/
FreeBSD Handbook:      https://www.FreeBSD.org/handbook/
FreeBSD FAQ:           https://www.FreeBSD.org/faq/
Questions List: https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/
FreeBSD Forums:        https://forums.FreeBSD.org/

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with:  pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed:  freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages:  man man
FreeBSD directory layout:      man hier

Edit /etc/motd to change this login announcement.
pluginjail# freebsd-version
11.2-RELEASE-p15
pluginjail# egrep -rn "<<<<<<<|^======|>>>>>" /etc
/etc/network.subr:25:<<<<<<< current version
/etc/network.subr:27:=======
/etc/network.subr:29:>>>>>>> 11.2-RELEASE
/etc/network.subr:1805:<<<<<<< current version
/etc/network.subr:1889:=======
/etc/network.subr:1892:>>>>>>> 11.2-RELEASE
/etc/network.subr:1894:<<<<<<< current version
/etc/network.subr:1921:=======
/etc/network.subr:1922:>>>>>>> 11.2-RELEASE
/etc/mail/submit.cf:12:<<<<<<< current version
/etc/mail/submit.cf:14:=======
/etc/mail/submit.cf:16:>>>>>>> 11.2-RELEASE
/etc/mail/submit.cf:24:<<<<<<< current version
/etc/mail/submit.cf:28:=======
/etc/mail/submit.cf:29:>>>>>>> 11.2-RELEASE
/etc/mail/submit.cf:38:<<<<<<< current version
/etc/mail/submit.cf:43:=======
/etc/mail/submit.cf:48:>>>>>>> 11.2-RELEASE
/etc/mail/sendmail.cf:12:<<<<<<< current version
/etc/mail/sendmail.cf:14:=======
/etc/mail/sendmail.cf:16:>>>>>>> 11.2-RELEASE
/etc/mail/sendmail.cf:24:<<<<<<< current version
/etc/mail/sendmail.cf:28:=======
/etc/mail/sendmail.cf:29:>>>>>>> 11.2-RELEASE
/etc/mail/sendmail.cf:41:<<<<<<< current version
/etc/mail/sendmail.cf:43:=======
/etc/mail/sendmail.cf:45:>>>>>>> 11.2-RELEASE
/etc/mail/freebsd.cf:12:<<<<<<< current version
/etc/mail/freebsd.cf:14:=======
/etc/mail/freebsd.cf:16:>>>>>>> 11.2-RELEASE
/etc/mail/freebsd.cf:24:<<<<<<< current version
/etc/mail/freebsd.cf:28:=======
/etc/mail/freebsd.cf:29:>>>>>>> 11.2-RELEASE
/etc/mail/freebsd.cf:41:<<<<<<< current version
/etc/mail/freebsd.cf:43:=======
/etc/mail/freebsd.cf:45:>>>>>>> 11.2-RELEASE
/etc/mail/aliases:7:#   >>>>>>>>>>      The program "newaliases" must be run after
/etc/mail/aliases:9:#   >>>>>>>>>>      show through to sendmail.
/etc/mail/freebsd.submit.cf:12:<<<<<<< current version
/etc/mail/freebsd.submit.cf:14:=======
/etc/mail/freebsd.submit.cf:16:>>>>>>> 11.2-RELEASE
/etc/mail/freebsd.submit.cf:24:<<<<<<< current version
/etc/mail/freebsd.submit.cf:28:=======
/etc/mail/freebsd.submit.cf:29:>>>>>>> 11.2-RELEASE
/etc/mail/freebsd.submit.cf:38:<<<<<<< current version
/etc/mail/freebsd.submit.cf:43:=======
/etc/mail/freebsd.submit.cf:48:>>>>>>> 11.2-RELEASE
/etc/aliases:7:#        >>>>>>>>>>      The program "newaliases" must be run after
/etc/aliases:9:#        >>>>>>>>>>      show through to sendmail.
/etc/rc.subr:2:#<<<<<<< current version
/etc/rc.subr:7:#>>>>>>> 11.2-RELEASE
/etc/group:1:<<<<<<< current version
/etc/group:3:=======
/etc/group:5:>>>>>>> 11.2-RELEASE
/etc/passwd:1:<<<<<<< current version
/etc/passwd:3:=======
/etc/passwd:5:>>>>>>> 11.2-RELEASE
/etc/rc.d/routing:5:<<<<<<< current version
/etc/rc.d/routing:7:=======
/etc/rc.d/routing:9:>>>>>>> 11.2-RELEASE
/etc/rc.d/routing:311:<<<<<<< current version
/etc/rc.d/routing:332:=======
/etc/rc.d/routing:333:>>>>>>> 11.2-RELEASE
/etc/rc.d/sshd:3:<<<<<<< current version
/etc/rc.d/sshd:5:=======
/etc/rc.d/sshd:7:>>>>>>> 11.2-RELEASE
/etc/rc.d/sshd:79:<<<<<<< current version
/etc/rc.d/sshd:97:=======
/etc/rc.d/sshd:102:>>>>>>> 11.2-RELEASE
/etc/rc.d/sshd:107:<<<<<<< current version
/etc/rc.d/sshd:124:=======
/etc/rc.d/sshd:127:>>>>>>> 11.2-RELEASE
/etc/rc.d/nsswitch:26:<<<<<<< current version
/etc/rc.d/nsswitch:28:=======
/etc/rc.d/nsswitch:30:>>>>>>> 11.2-RELEASE
/etc/rc.d/jail:3:<<<<<<< current version
/etc/rc.d/jail:5:=======
/etc/rc.d/jail:7:>>>>>>> 11.2-RELEASE
/etc/rc.d/jail:126:<<<<<<< current version
/etc/rc.d/jail:184:=======
/etc/rc.d/jail:226:>>>>>>> 11.2-RELEASE
/etc/rc.d/jail:240:<<<<<<< current version
/etc/rc.d/jail:244:=======
/etc/rc.d/jail:260:>>>>>>> 11.2-RELEASE
/etc/rc.d/jail:262:<<<<<<< current version
/etc/rc.d/jail:314:=======
/etc/rc.d/jail:334:>>>>>>> 11.2-RELEASE
/etc/rc.d/jail:337:<<<<<<< current version
/etc/rc.d/jail:346:=======
/etc/rc.d/jail:381:>>>>>>> 11.2-RELEASE
/etc/rc.d/jail:597:<<<<<<< current version
/etc/rc.d/jail:613:=======
/etc/rc.d/jail:628:>>>>>>> 11.2-RELEASE
/etc/rc.d/jail:691:<<<<<<< current version
/etc/rc.d/jail:758:=======
/etc/rc.d/jail:760:>>>>>>> 11.2-RELEASE
/etc/shells:1:<<<<<<< current version
/etc/shells:3:=======
/etc/shells:5:>>>>>>> 11.2-RELEASE
/etc/master.passwd:1:<<<<<<< current version
/etc/master.passwd:3:=======
/etc/master.passwd:5:>>>>>>> 11.2-RELEASE
/etc/freebsd-update.conf:1:<<<<<<< current version
/etc/freebsd-update.conf:3:=======
/etc/freebsd-update.conf:5:>>>>>>> 11.2-RELEASE
pluginjail# exit
logout
root@floogy:~ # iocage list
+-----+-------------+-------+--------------+---------------+
| JID |    NAME     | STATE |   RELEASE    |      IP4      |
+=====+=============+=======+==============+===============+
| 2   | FAMP        | up    | 11.0-RELEASE | DHCP          |
+-----+-------------+-------+--------------+---------------+
| 21  | dlna_1      | up    | 9.1-RELEASE  | 172.16.240.19 |
+-----+-------------+-------+--------------+---------------+
| 25  | firefly_1   | up    | 11.0-RELEASE | 172.16.240.23 |
+-----+-------------+-------+--------------+---------------+
| 8   | nextcloud   | up    | 11.3-RELEASE | DHCP          |
+-----+-------------+-------+--------------+---------------+
| 26  | nextcloud_1 | up    | 10.3-RELEASE | 172.16.240.16 |
+-----+-------------+-------+--------------+---------------+
| 18  | pluginjail  | up    | 8.3-RELEASE  | 172.16.240.25 |
+-----+-------------+-------+--------------+---------------+
root@floogy:~ # jls
   JID  IP Address      Hostname                      Path
     2                  FAMP                          /mnt/datapool/iocage/jails/FAMP/root
     8                  nextcloud                     /mnt/datapool/iocage/jails/nextcloud/root
    18                  pluginjail                    /mnt/datapool/iocage/jails/pluginjail/root
    21                  dlna_1                        /mnt/datapool/iocage/jails/dlna_1/root
    25                  firefly-1                     /mnt/datapool/iocage/jails/firefly_1/root
    26                  nextcloud_1                   /mnt/datapool/iocage/jails/nextcloud_1/root

It's not possible to get the jail upgraded further with those corrupted conf files.

Code:
root@floogy:~ # iocage upgrade -r 11.3-RELEASE pluginjail
/tmp/tmp2di9s0n6: config_<<<<<<<: not found
Error processing configuration file, line 1:
==> <<<<<<< current version
Command: /tmp/tmp2di9s0n6 -b /mnt/datapool/iocage/jails/pluginjail/root -d /mnt/datapool/iocage/jails/pluginjail/root/var/db/freebsd-update/ -f /mnt/datapool/iocage/jails/pluginjail/root/etc/freebsd-update.conf --not-running-from-cron --currently-running 8.3-RELEASE -r 11.3-RELEASE upgrade failed!


Edit: For example, I found some hints in the forum, but I need the confirmation, that I had understand it.


Code:
<<<<<<< current version
# Do not remove below line
=======
# $FreeBSD: releng/11.2/etc/hosts 109997 2003-01-28 21:29:23Z dbaker $
#
# Host Database
#
# This file should contain the addresses and aliases for local hosts that
# share this file.  Replace 'my.domain' below with the domainname of your
# machine.
#
# In the presence of the domain name service or NIS, this file may
# not be consulted at all; see /etc/nsswitch.conf for the resolution order.
#
#
>>>>>>> 11.2-RELEASE
::1                     localhost localhost.my.domain
127.0.0.1               localhost localhost.my.domain
11.11.11.11            hostname.mydomain.com
~
~

If I want to keep the new version, not the current, I then delete the following lines
Code:
<<<<<<< current version
# Do not remove below line

Those ===== line until another mark, like <<<<<<<, or >>>>>>> is the same, in both files, the current and the new >>>>>>> 11.2-RELEASE, right? So I'll keep this block:

Code:
# $FreeBSD: releng/11.2/etc/hosts 109997 2003-01-28 21:29:23Z dbaker $
#
# Host Database
#
# This file should contain the addresses and aliases for local hosts that
# share this file.  Replace 'my.domain' below with the domainname of your
# machine.
#
# In the presence of the domain name service or NIS, this file may
# not be consulted at all; see /etc/nsswitch.conf for the resolution order.
#
#

Then, finally, I delete the line ">>>>>>> 11.2-RELEASE", and keep this block:
Code:
::1                     localhost localhost.my.domain
127.0.0.1               localhost localhost.my.domain
11.11.11.11            hostname.mydomain.com

Did I understand the process right? I'm not familiar with this merge format at all. Please confirm or give some hints to solve those merge conflicts manually.

With the editing described above, the conf file in this example will look like this:
Code:
# $FreeBSD: releng/11.2/etc/hosts 109997 2003-01-28 21:29:23Z dbaker $
#
# Host Database
#
# This file should contain the addresses and aliases for local hosts that
# share this file.  Replace 'my.domain' below with the domainname of your
# machine.
#
# In the presence of the domain name service or NIS, this file may
# not be consulted at all; see /etc/nsswitch.conf for the resolution order.
#
#
::1                     localhost localhost.my.domain
127.0.0.1               localhost localhost.my.domain
11.11.11.11            hostname.mydomain.com

I see, I have to replace the values of the last block with my own IP addresses and domain names, to make it reasonable.

And therefore the merge conflict is manually solved, and the older/current 8.3-RELEASE conf file is replaced by the content of the new 11.2-RELEASE conf file, right?

I only know a bit of a similiar process on debian, when conf files altered before upgrading the system, the process is asking what to do with that file, and gives an unified diff output then, to edit the file. But it also gives the opportunity to keep the users file, or replace it by the maintainers version.

But the merge format is different from the unified diff format.

 
Okay, I guess I got it all wrong. I looked into merge(1) and found a thread in this forum which described it by an example.
A conflict occurs if both file1 and file3 have changes in a common seg-
ment of lines. If a conflict is found, merge normally outputs a warn-
ing and brackets the conflict with <<<<<<< and >>>>>>> lines. A typi-
cal conflict will look like this:

<<<<<<< file A
lines in file A
=======
lines in file B
>>>>>>> file B

If there are conflicts, the user should edit the result and delete one
of the alternatives.

Title: Manually merging files | The FreeBSD Forums (at forums.freebsd.org)

It also seems, that the outdated 8.3-RELEASE got this issue with freebsd-update/merge

Title: freebsd-update asks me to merge/diff 100+ files | The FreeBSD Forums (at forums.freebsd.org)

So my conclusion is:
  • '<<<<<<< current version' until '======' is the content of the current conf file
  • The block after '======' until '>>>>>> 11.2-RELEASE' is the content of the 11.2-RELEASE conf file, and
  • The content between '>>>>>> 11.2-RELEASE' and '<<<<<<< current version' is identical in both versions.
I looked in /etc/rc.d/jail, which was one of the related files which I should manually merge, and yes, I noticed it's other way around, as I thought in the beginning.
In the merge output there are text blocks which belongs to current and some which belongs to 11.2-RELEASE. Also there are text blocks which are in both files identical. So I have to keep the identical, delete the blocks of the file I don't want and keep the 11.2-RELEASE for example, and maybe, if it contains defaults or values that I know, I should keep, I can use their information in the new format (11.2-RELEASE). I also have to remove the lines that indicates beginning or ending of the text blocks, like '<<<<<<< current version', '======' and e.g. '>>>>>> 11.2-RELEASE'. Then ESC :wq (in vi).
 
Back
Top