Jail upgrade - merge files?

ragametal

Contributor
Joined
May 4, 2021
Messages
188
I created a jail for my nextcloud instance. It is currently on 13.1-RELEASE and I'm trying to updated to 13.2-RELEASE to match the truenas installation as i have done many times before but this time i'm stuck and i need some advisement.

I did the
iocage fetch
and selected 13.2-Release

then i stopped the jail
iocage stop nextcloud

then i ran the upgrade command
iocage upgrade -r 13.2-RELEASE nextcloud
and this is what i got
Upgrade jail 1.png

Upgrade jail 2.png


This is where I'm stuck. I honestly don't know how to manually "merge" the file /etc/passwd or why am i required to do it this time.
When i press "Enter" I do get into VI and i see the file. But, then again, i don't know what is that i need to copy, or paste, or where, or how to save it.

Has anybody experienced this before?
I searched on the forum but got no luck.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
You get a file with both versions intact framed by lines similar to:

>>>>>>
======
<<<<<<

presenting you the "old version" and the "new version". Sometimes the old version is empty, which means there are only lines to be added.

You need to edit these out and from the parts construct the version of the file that you want to save. Then save and exit vi. This can happen - and frequently does - for every major FreeBSD update. man etcupdate for details.
 

Davvo

MVP
Joined
Jul 12, 2022
Messages
3,222

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
The web UI does the merges for you? Or just leave the jail in an inconsistent state? Major FreeBSD frequently require changes to config files in /etc ...
 

Davvo

MVP
Joined
Jul 12, 2022
Messages
3,222
The WebUI has and upgrade option. Never had to upgrade my jails till now, so I don't know how it handles it.
 

ragametal

Contributor
Joined
May 4, 2021
Messages
188
@Davvo I honestly don't know why i didn't try the WebUI. I guess that when i learned how to upgrade jails the WebUI gave me errors and i found this method via the CLI that worked for me and i have been doing it like that ever since.

@Patrick M. Hausen thanks for the advisement, it pointed me in the right direction. During my research i found the following thread on the freeBSD forums that explains this process a bit more Manually Merging Files

I'll explain what i did to solve my issue for future reference to me and others that may be in this situation. It will be extremely basic but i feel that is what somebody like me needed to solve this.

Basically, during the jail upgrade, freeBSD tries to replace the old files with their newer version. But sometimes the contents of the newer files are a bit different than the existing files inside the jails, that is why freeBSD asks file for manual intervention.

In my case I got the following warning during my jail upgrade
Code:
The following file could not be merged automatically: /etc/passwd
press Enter to edit this file in /usr/bin/vi and resolve the conflicts
manually...

So, i pressed "Enter" as per the instructions and the VI text editor opened with a file to modify. This is the part that where i needed help.

This file has 3 parts as follows:
  1. Part 1: is enclosed between <<<<<<< current version and =======. It has the lines of code in the old file that are different from the new file.
  2. Part 2: is enclosed between ======= and >>>>>>> 13.2-RELEASE. It has the lines of code in the new file that are different from the old file.
  3. Part 3: is everything after >>>>>>> 13.2-RELEASE. This part contains the lines of code that didn't change between the old and new file.
In my case the file looked like this (contents were edited since this is the passwd file)
Code:
<<<<<<< current version
# $FreeBSD$
#
root:lines1:lines1:lines1:something1
=======
root:lines2:lines2:lines2:something2
>>>>>>> 13.2-RELEASE
toor:lines3:lines3:lines3:something3
daemon:lines3:lines3:lines3:something3
operator:lines3:lines3:lines3:something3
...

Since this is the passwd file, i figured i should keep the lines of code from the old file in order to keep my jail operating properly. So i deleted the following lines (by putting the cursor at the beginning of each line and using the VI command dd to delete):
<<<<<<< current version
=======
root:lines2:lines2:lines2:something2
>>>>>>> 13.2-RELEASE

the end result is a file that looked like this
Code:
# $FreeBSD$
#
root:lines1:lines1:lines1:something1
toor:lines3:lines3:lines3:something3
daemon:lines3:lines3:lines3:something3
operator:lines3:lines3:lines3:something3
...

Then i saved and quit the file (by using the VI command :wq).

This solved my issue.
 
Last edited:
Joined
Oct 22, 2019
Messages
3,641
I've been using a qBittorrent jail since 11.3 I believe. I've upgraded it whenever a new release was available. Currently on 13.2 now.

Not once did I bump into this "merge conflict". And yes, my /etc/passwd contains custom and additional user accounts which I manually added.

The same is true for a few other jails, and not once did I bump into the "merge conflict" issue.

Could it be that this occurs if you change a property for the root (0) user?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
I run about 100 physical servers and every other major update or so I need to merge some files. A jail ist not different in that respect. But if you do not change much from the installed default, most of the time the merge is automatic.
 

Davvo

MVP
Joined
Jul 12, 2022
Messages
3,222

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Avaiability of packages? Once a release is EOL packages go away. You can of course take a "throw away and install fresh" approach, but I just keep my jails up to date with iocage upgrade (which just runs freebsd-update on the jail) and pkg upgrade. Also, security fixes in system libraries?
 
Joined
Oct 22, 2019
Messages
3,641

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
The WebUI has and upgrade option. Never had to upgrade my jails till now, so I don't know how it handles it.
The WebUI has an Update button. This updates the patch level of the current FreeBSD version the jail is on. A jail upgrade has to be performed from the command line.
 

abhi552a

Cadet
Joined
Jul 27, 2023
Messages
2
I created a jail for my nextcloud instance. It is currently on 13.1-RELEASE and I'm trying to updated to 13.2-RELEASE to match the truenas installation as i have done many times before but this time i'm stuck and i need some advisement.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
So what exactly is your question/problem?
 

abhi552a

Cadet
Joined
Jul 27, 2023
Messages
2
I run about 100 physical servers and every other major update or so I need to merge some files. A jail ist not different in that respect.

Mod note: links deleted.
 
Last edited by a moderator:

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977

ragametal

Contributor
Joined
May 4, 2021
Messages
188

MauricioU

Explorer
Joined
May 22, 2017
Messages
64
Hi all,

I am currently running into this issue for /etc/mail/mailer.conf and I'm not understanding what I need to modify in order to "Resolve the conflicts". I understand how the file is presented in the vi editor, but I am unable to determine which lines are worth keeping and worth deleting. Here is my file:

Code:
Attempting to automatically merge changes in files... done.

The following file could not be merged automatically: /etc/mail/mailer.conf
Press Enter to edit this file in /usr/bin/vi and resolve the conflicts
manually...
<<<<<<< current version
# $FreeBSD: releng/12.3/etc/mail/mailer.conf 363973 2020-08-06 18:13:45Z kevans $
#
# Execute the "real" sendmail program, named /usr/libexec/sendmail/sendmail
#
#sendmail       /usr/libexec/sendmail/sendmail
#mailq          /usr/libexec/sendmail/sendmail
#newaliases     /usr/libexec/sendmail/sendmail
#hoststat       /usr/libexec/sendmail/sendmail
#purgestat      /usr/libexec/sendmail/sendmail

#
# Execute the Postfix sendmail program, named /usr/local/sbin/sendmail
#
sendmail        /usr/local/sbin/sendmail
send-mail       /usr/local/sbin/sendmail
mailq           /usr/local/sbin/sendmail
newaliases      /usr/local/sbin/sendmail
=======
# $FreeBSD$
#
# Execute the "real" sendmail program, named /usr/libexec/sendmail/sendmail
#
# If dma(8) is installed, an example mailer.conf that uses dma(8) instead can
# can be found in /usr/share/examples/dma.
#
sendmail        /usr/libexec/sendmail/sendmail
mailq           /usr/libexec/sendmail/sendmail
newaliases      /usr/libexec/sendmail/sendmail
purgestat       /usr/libexec/sendmail/sendmail
>>>>>>> 13.2-RELEASE





This is for a plex jail, I'm assuming I do not need any of the current version lines? Not sure... looking for someone to help. Thank you!
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Just delete everything from/to and including "current version" and "=======" and then the last line "13.2-RELEASE". So you will keep only the new content. Wich is ok for a generic FreeBSD installation.

mailer.conf is a mechanism to install alternative MTAs and be able to still invoke them with the well-known commands like "sendmail". I don't know from the top of my head but in your current version all the entries are commented out while FreeBSD 13.2 has all of them explicitly active. You will most probably do no harm going with FreeBSD 13.2 ...
 

MauricioU

Explorer
Joined
May 22, 2017
Messages
64
Just delete everything from/to and including "current version" and "=======" and then the last line "13.2-RELEASE". So you will keep only the new content. Wich is ok for a generic FreeBSD installation.

mailer.conf is a mechanism to install alternative MTAs and be able to still invoke them with the well-known commands like "sendmail". I don't know from the top of my head but in your current version all the entries are commented out while FreeBSD 13.2 has all of them explicitly active. You will most probably do no harm going with FreeBSD 13.2 ...
thank you for the answer! this is what I did and it seems to be working fine! Will keep my eye open.
 
Top