mergemaster -p messed up /etc/master.passwd

unsobill

Member


Messages: 28

forgive my "noobism" - i've got 8.0 release minimal install and performed upgrade to 8.1 PreRelease using stable-supfile and ports-supfile - buildworld buildkernel installedkernel and then installed world - only after running mergemaster -p in single mode i got confused and disoriented and must have wipedout or replaced old /etc/master.passwd along with all my accounts and groups...

now on boot i get unknown user root - and i cant "cat /etc/master.passwd" - all i get is blank
however i can view "cat /etc/passwd" and see users root, toor and my old user.
None of them i can change passwd - i get an error "user not found"

my temp root is empty also - no idea how that happened - /var/tmp/temproot/

so i have low permission user with access to system and unable to su - i get an error...
any chances of fixing/repairing my system or i got to wipe all and start from the scratch? i can backup kernel and /etc/rc.conf and what else should i migrate to new system if i'm unable to fix this?

THANK YOU !!!
 

jb_fvwm2

Daemon

Reaction score: 184
Messages: 1,697

Someone may answer with specific help, but I've
messed up one buildworld cycle so far, so I always
backup first, then do a 30-part detailed (vs eight
or so ) procedure that has less chance of messing
up.
...
I posted it once on the old defunct bsdforums.-something
site.
...
That buildworld I recovered by an image restore from
backup. Later, I had messed up system libraries
so bad that a "sysinstall-ftp" upgrade only helped.
...
Still running the same v5 > v8 system thanks to the
two recoveries above.
the freebsd-questions list might also answer more
helpfully, if you can you can maybe search it for
"toor" and find a helpful thread.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 8,058
Messages: 31,652

Boot to single user mode and run mergemaster again. That will at least restore a 'basic' passwd file with all the normal accounts. Reset the root password after that. I'm not sure if mergemaster keeps a backup of the old password file and database. But if all that was destroyed are the user accounts they should be relatively easy to add again. Use the pw(8) command to add them, that will allow you to set the correct uid/gid for each. Have a look at your /usr/home/ directory. Unless something went really wrong the user's home directories should still be there. From that directory you can also deduce which user had what uid.
 

jb_fvwm2

Daemon

Reaction score: 184
Messages: 1,697

(/var/etc
or /var/tmp/mergemaster/ )

OTOH I just noticed that
/var/tmp/temproot/etc/ has
copies of (probably the needed....)
shells, master.passwd, hosts, groups, etc.
 
OP
OP
U

unsobill

Member


Messages: 28

jb_fvwm2 said:
then do a 30-part detailed (vs eight
or so ) procedure that has less chance of messing
up.
Thats the only thing i hate about freebsd is un-canonical confusing methods and order of upgrading.

is there bullet point order of the process to complete from ground up install to secured updaded/upgraded server ?

this what i compiled so far:

  1. Updating ports and sources
  2. Copy /usr/share/examples/cvsup/stable-supfile to your ~
  3. [Edit stable-supfile: *default host :cvsup4.freebsd.org]
  4. Csup -L 2 ~/stable-supfile -to update to stable
  5. Csup -L 2 ~/ports-supfile -to update ports
  6. cd /usr/src
  7. *make buildworld -compiles the new compiler and saves result in /usr/obj

  8. Copy GENERIC to UNSOBILL and edit it -------------------------------------------------------à
  9. make buildkernel KERNCONF=UNSOBILL -running compiler from /usr/obj
  10. make installkernel KERNCONF=UNSOBILL -places kernel+modules on disk - The new kernel will be copied to /boot/kernel/kernel – and old /boot/kernel.old/kernel

  11. Boot into single mode
  12. adjkerntz -I -adjust cmos clock
  13. mount -a -t ufs -mount all filesystems listed in fstab and use type ufs
  14. mergemaster -p -prepares conf. files for new world
  15. *make installworld -copies the world from /usr/obj – we have new world
  16. Mergemaster -update the remaining configuration files
 

jb_fvwm2

Daemon

Reaction score: 184
Messages: 1,697

backup /etc... and the old kernel binary...
....
before "env -i buildworld..."
sh /usr/src/usr/sbin/mergemaster/mergemaster.sh -vipPc
...
and again right before installworld (the line above)
...
(just two enhancements)
...
BTW if you are using a custom kernel,
my notes say to...
1... check the official Release Notes (device name changes etc)
2... check the UPDATING for usr sources since your last buildworld
3... visually compare the previous GENERIC to the *new* GENERIC to
see what has changed.
4... and another I forget at the spur of the moment...
...

I've done a buildworld cycle without some of the above, but it
was more or less just to test a new motherboard. And worked
flawlessly.
 
OP
OP
U

unsobill

Member


Messages: 28

Thankfully to FreeBSD 8 auto backup
i had master.passwd.bak in my var/backups with all users present
I moved over bkup to /etc/master.passwd and ran pwd_mkdd /etc/master.passwd to update
reboot and voila -back to original state :)

ISSUE SOLVED - THANK YOU EVERYONE!~ DONT FORGET TO BACKUP
 
Top