14.0-RELEASE - conflicts in /etc/passwd results in losing root

I'd like to preface this by saying I'm purely a hobbyist and my environment means nothing so it's not a big deal for me. I can reinstall if necessary but wondering if there is an easier fix.

I have a FreeBSD laptop that was running 13.1-RELEASE this morning. I did a freebsd-update (twice) up to 13.2-RELEASE, and then again to 14.0-RELEASE.

During the 14.0-RELEASE installation, it said there are conflicts between what I already had in my old /etc/passwd and what 14.0-RELEASE was trying to write in there, and asked me to resolve the conflicts before it could proceed with the upgrade. As it uses vi I was a bit baffled, but anyway, decided to remove the 13.2-RELEASE section. The 13.2 section only had references to my user, root, and wheel, 14.0 added separate entries for a whole load of stuff so I gathered this was some kind of permissions refactor.

Anyway, after the merge conflicts were "fixed" I now don't have an entry for root in my /etc/passwd file and can't login as root. "toor" is there but don't know the password for that one?

Any known fix, or just blow it away and start again?
 
what about:
- boot from a 14.0 installation stick
- mount the partition with the rootless passwd file
- copy the root line in /etc/passwd from stick to mount
 
Additional notes with elgrande's reply.
Maybe the conflict was the change of root shell from csh to sh.
What you should have done was to keep original line for root, disposing updated line, but it's too late for now.
And if you are not enough familiar to vi like me, setting EDITOR environment variable to ee would allow you to use ee instead of vi on vipw.
 
… hobbyist and my environment means nothing so it's not a big deal for me. I can reinstall if necessary but wondering if there is an easier fix. …

Any known fix, or just blow it away and start again?

It's fixable, the suggestion from elgrande looks good, however it's as easy to:
  1. blow it away, start again with a fresh installation of 14.0-RELEASE
  2. learn about horrors such as merge conflict markers at a later date.
 
Too late now but from Colin Percival's blog:

Be careful when merging master.passwd
The default shell for root changed from csh to sh in FreeBSD 14. When you upgrade to FreeBSD 14, freebsd-update will prompt you to merge changes to /etc/master.passwd. Don't just take the new password line for root since it doesn't have a password. Keep your existing line and change the shell (or not, if you prefer to stick with csh).
 
Just wanted to add that I've had this problem too. I thought the password was stored in another file (shadow), and was busy trying to get work done and upgrade my FreeBSD server at the same time so this slipped through. Now I can't login as root or su (as I usually do). Headless server, I'm now going to have to move it and plug in a monitor and resolve it (thanks, elgrande). Be nice if there were some level of warning about this as it's caused a bit of unnecessary effort now.
 
I thought the password was stored in another file (shadow)
Correct. There areetc/pwd.db and etc/spwd.db. These files are generated from /etc/master.passwd using pwd_mkdb(8).
Running vipw(8) opens /etc/master.passwd using the text editor specified by environment variable EDITOR,once saved and exited, check for integrity of it, if OK, generate etc/pwd.db and etc/spwd.db (and would generate /etc/passwd, too).
See manpage vipw(8), especially FILES section for details.
 
To get around the merge issue when upgrading to 14.0 would it work better to change root's shell from /bin/csh to /bin/sh before the upgrade?
 
During the 14.0-RELEASE installation, it said there are conflicts between what I already had in my old /etc/passwd and what 14.0-RELEASE was trying to write in there, and asked me to resolve the conflicts before it could proceed with the upgrade. As it uses vi I was a bit baffled, but anyway, decided to remove the 13.2-RELEASE section. The 13.2 section only had references to my user, root, and wheel, 14.0 added separate entries for a whole load of stuff so I gathered this was some kind of permissions refactor.

Anyway, after the merge conflicts were "fixed" I now don't have an entry for root in my /etc/passwd file and can't login as root. "toor" is there but don't know the password for that one?
Resembles what happened here, I also deleted the 13.3-RELEASE section at the same step in the update and for the same reason.

Discovered something happened when using su - to become superuser: there was no question for a password, instantly became root.

Made a new root password as root with passwd and all was back to normal.
 
Back
Top