How to manually merge files upgrading 11.1 > 11.2

Hello,

Today I tried to upgrade my FreeBSD 11.1 to 11.2 using this how to article :


Then in the middle of the upgrade process I faced with this message :

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

Then after I pressed return I faced this :

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
~
~


But I can not literally do anything. I can just remove or add to the lines. Nothing saves this file or whatsoever.

I would appreciate your help regarding this issue, I really don't know what to do .

Thank you
 
Be careful there!
You may need check each file for errors if something breaks after the upgrade as a result of you poorly editing those files.

Take for instance, if one of the files apparently has ">>>>>>> 11.2-RELEASE " in one of its lines, that would break the configuration. I have seen such happened after an upgrade. I saw that line in the etc/ttys file. So take note of the filenames you are presented to make or accept changes to them.
 
Hello,

Today I tried to upgrade my FreeBSD 11.1 to 11.2 using this how to article :
If you wish to avoid these problems in the future then don't remove the header(s) of an official configuration file, because that's one way in which mergemaster detects the need for changes.

(edit): Although my comment is true it also ignores an important detail: sometimes these errors occur even if you didn't edit any of those config files, something I just experienced myself while updating my laptop to 11.2. As such I'm removing my code segment because it makes no sense on my part to assume that the other file(s) would have been edited.

Another tip... even though I definitely agree with SirDice above that knowing how to use vi is pretty essential knowledge for administrating FreeBSD (or any other Unix environment) there is a way around this: set the EDITOR environment variable and point it to something else.

For example, I'm aware that one user of a server I administrate has EDITOR pointed to /usr/local/bin/mcedit. Definitely not my personal favorite, but it really seems to work for them.

press "shift + : " then "wq" ,without " ,like in vi session.
Or just use :x ;)
 
Last edited:
Thank you very much to all of you guy.

I am pretty new in FreeBSD world and I am still learning.

I have not customized any of the files.

Be careful there!
You may need check each file for errors if something breaks after the upgrade as a result of you poorly editing those files.

Take for instance, if one of the files apparently has ">>>>>>> 11.2-RELEASE " in one of its lines, that would break the configuration. I have seen such happened after an upgrade. I saw that line in the etc/ttys file. So take note of the filenames you are presented to make or accept changes to them.
Therefore, you would recommend to remove that like ? and the like before which is : "<<<<<<< current version" ?


Learn to use vi(1), at least some of the basics.

https://www.cs.colostate.edu/helpdocs/vi.html
Definitely I would.

This is my first upgrade :D
 
Definitely I would.
Learning the basics of vi(1) will get you a long way, not only on FreeBSD. It's quite often the only editor on installations, so it definitely helps if you know how to do some basic editing with it. But it's certainly not the easiest editor to learn.
 
Therefore, you would recommend to remove that like ? and the like before which is : "<<<<<<< current version" ?
YES, if and only if the config files ended up containing those special characters. You need know a few vi commands to remove them. So, take a crash course on how to use the VI editor.
To get going, you only need know
(1) how to insert character(s) using CS+i (press Control & Shift buttons together and while pressing them, hit the 'i' button. You can then start typing. When done press ESC to exit the insert mode
(2) to save your changes, press 'S:' (shift and colon buttons together), followed by 'wq' and then the enter button.
(3)After exiting the insert mode, you can delete a character by pressing the DEL button or a whole line, by press the 'd' button twice.
4)you can force write with ':w!'; force quit with ':!q' (e.g. when you don't want to effect your changes); force write and quit with ':wq!' (e.g. when you don't have the necessary permissions on a file).
5) a sample command to open files with vi is '%vi /usr/local/sample.txt'.

Good luck.
 
Thank you very much.

I finally updated my server to the latest version... of course I had many backups before :D
 
Back
Top