Bug 270852 - Extra characters in config files after upgrade with freebsd-update(8)
Summary: Extra characters in config files after upgrade with freebsd-update(8)
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.2-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL: https://docs.freebsd.org/en/books/han...
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2023-04-15 03:42 UTC by Kenan Bektas
Modified: 2023-11-22 18:12 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kenan Bektas 2023-04-15 03:42:11 UTC
Hi,

This has been a major issuse for sometime. After any release updates, such as last one I have done recently, after issueing :
freebsd-update -r 13.2-RELEASE upgrade          (from 13.1)
..
At the step 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...


I get the following post (my default editor is vi)

..
<<<<<<< current version
# $FreeBSD$
#
root:*:0:0:Charlie &:/root:/usr/local/bin/bash
=======
root:*:0:0:Charlie &:/root:/bin/csh
toor:*:0:0:Bourne-again Superuser:/root:
>>>>>>> 13.2-RELEASE
..

Major inconsistencies and critical defects:

It is an upgrade, should not change passwd file in any way, unless standart / delimiter / format changed. If user don't pay attention and save it the way it is then passwd file becomes corrupted.

I understand the intent is somewhat adding patch phrase, however,
a) it is not the job of upgrade script to change my passwd file.
b) It is not the job of upgrade script adding already removed user(s) like 'toor', back.


SUPER CRITICAL:

Upgrade script patches sshd server system-wide configuration file. It is too crowded already and hard to see/catch patches on screen.
If I don't pay enough attention and save it the way it is, it continues with invalid characters inserted into sshd_config.

Auto inserted lines similar to the followings are absolute SSHD/PAM killer.

@@ -56,10 +55,11 @@
@@ -77,11 +77,11 @@
<<<<<<< current version
>>>>>>>

...


This once made sshd_config file invalid and, after reboot, SSHD did not start and I was not able to access server remotely. Almost cost me my job.

Please stop this type of standarts in upgrades. Simply dangerous. More harm than good.

Instead, create a large files of:
1) what's done/applied, call it UPGRADE-timestamp.upgrade
2) what needs to be confirmed by user, call it PENDING-timestamp.upgrade
Let user review and apply further changes.

Thanks,.
Comment 1 Graham Perrin freebsd_committer freebsd_triage 2023-04-15 14:53:50 UTC
If a person has the expertise to intentionally remove a user that's normally a part of FreeBSD, I should expect the person to be prepared for reintroduction of the user as part of a normal freebsd-update routine. 

<https://man.freebsd.org/cgi/man.cgi?query=freebsd-update&sektion=8&manpath=freebsd-release>

Re: remnants following use of freebsd-update, I'm surprised that the FreeBSD Handbook does not describe what to do – during an update – when the user is presented with things such as this: 

<<<<<<< current version
Comment 2 Kenan Bektas 2023-04-15 15:36:14 UTC
...
If a person has the expertise to intentionally remove a user that's normally a part of FreeBSD, I should expect the person to be prepared for reintroduction of the user as part of a normal freebsd-update routine. 
...

I beg to differ. It is not about user's skills. We are all human beings, in many circumstances even most skillfull ones will certainly act differently.

The points are:
- If I am the admin, it is my decision to have removed users back or not. Not the update script's. I am the one responsible for the system, after all, not update script. Certain things could be automated but this one is not one of  those.
- If the system has been running perfectly without those users for years, it clearly proves that the suggested practice not really necessary.

In short, we need to trust (admin) users and offer some freedom rather than the approach of "we designers know everything, hence, just follow the directions".

PS: Totally agree with documenting these instances in the handbook.

Thanks,.
Comment 3 Ceri Davies freebsd_committer freebsd_triage 2023-04-15 19:17:28 UTC
It’s not reasonable to “not pay attention” and expect the process to do everything.
Upgrades will, from time to time, need to add users.

However, if anyone wants to work on those functions they are welcome.
Comment 4 Kenan Bektas 2023-04-16 02:45:05 UTC
Folks, if anything I can do to help, let me know.
Comment 5 Graham Perrin freebsd_committer freebsd_triage 2023-04-16 07:31:40 UTC
(In reply to Kenan Bektas from comment #0 and comment #2)

Please consider things such as: 

* the IgnorePaths option of freebsd-update.conf(5) 
  <https://man.freebsd.org/cgi/man.cgi?query=freebsd-update.conf&sektion=5&manpath=freebsd-release>

* etcupdate(8) 
  <https://man.freebsd.org/cgi/man.cgi?query=etcupdate&sektion=8&manpath=freebsd-release>.

If you find appealing the controllability/configurability of etcupdate, then you may prefer to build and install from source; to not rely upon freebsd-update. 

From the introductory paragraph at <https://docs.freebsd.org/en/books/handbook/cutting-edge/#makeworld>: 

>> … complete customization to produce a tailored version of FreeBSD.
Comment 6 Ed Maste freebsd_committer freebsd_triage 2023-11-22 18:12:43 UTC
Note that freebsd-update will (currently) refuse to proceed and prompt the user to re-edit the file, if conflict markers like <<<<<<<<, =========, or >>>>>>>> are found in the file.