# mergemaster -p messed up /etc/master.passwd



## unsobill (Jun 23, 2010)

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 (Jun 23, 2010)

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 (Jun 23, 2010)

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 (Jun 23, 2010)

(/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.


----------



## unsobill (Jun 23, 2010)

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:


Updating ports and sources  
Copy /usr/share/examples/cvsup/stable-supfile to your ~
[Edit stable-supfile: *default host :cvsup4.freebsd.org]
Csup -L 2 ~/stable-supfile      -to update to stable
Csup -L 2 ~/ports-supfile        -to update ports

cd /usr/src							

*make buildworld   	-compiles the new compiler and saves result in /usr/obj


Copy GENERIC to UNSOBILL and edit it -------------------------------------------------------Ã  
make buildkernel KERNCONF=UNSOBILL	-running compiler from /usr/obj

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


Boot into single mode

adjkerntz -I                        -adjust cmos clock
mount -a -t ufs                  -mount all filesystems listed in fstab and use type ufs
mergemaster -p   	-prepares conf. files for new world	
*make installworld 	-copies the world from /usr/obj â€“ we have new world
Mergemaster		-update the remaining configuration files


----------



## jb_fvwm2 (Jun 23, 2010)

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.


----------



## unsobill (Jun 23, 2010)

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


----------

