Repairing a messed up 7.3-RELEASE

I messed up severely today and now I'm asking for your advise on this. :r

I have a few remote servers (quite large ones with lots of stuff on them, RAID etc) running 7.3-RELEASE - everything working very well up to today. I was cleaning up unused user accounts on one of the servers using 'rmuser'. After deleting about 10 accounts it got a little monotonous and I didn't watch so carefully what I was doing. Suddenly after pressing 'y' to confirm the deletion of the user home directory on one of the users, I noticed it took much longer time to delete that account than it did with previous accounts. Then I noticed that the user had its home directory set to '/' (!!!) :x

I have no idea how this could happen. I have always the home directories set to /home/<username>/. Anyway, I pressed Ctrl+c in panic and started to examine the directory structure for missing files. I have found that most symlinks are missing (I guess it starts with deleting these?) and perhaps some more base files :( Luckily most of the public services are still working, like email, http, etc.

How do I fix this the easiest way without completely reinstalling the server?

Running sysinstall? Would that overwrite all my config?

Please help!
 
You can try just doing a # make installworld if you have an already built world sitting there.
 
Thanks for your reply. I have not "built world" before - just used the freebsd installer. Would it be possible to use this method anyway?
 
Which one? installworld? Maybe, if the required binary tools haven't been removed during the accident and the buildworld files it uses are there, which isn't the case for you.
As for sysinstall, it may overwrite some files like /etc/fstab and the users and groups databases. Or possibly everything under /etc, I'm not sure.
 
Thanks for your reply and sorry that I was unclear in my previous post. I have been doing some tests using a vmware installed freebsd 7.3 now. Sysinstall would overwrite at least /etc/ssh/sshd_config and /etc/passwd, making the server unreachable for me. So that alternative seems to be out of the question. I guess I will have to recreate all symlinks manually or perhaps tar all base files from a working server and copy to this one.
 
The easiest way is to extract 7.3 base and exclude /etc


1) get the 7.3 source (/src/etc should be enough) and do a # mergemaster -i
2) get the 7.3 base and extract it with the following script instead off install.sh

Code:
#!/bin/sh
DESTDIR=/
# remove schg flags from files and dircetories
SCHGDIRS="bin lib libexec sbin usr/bin usr/lib usr/libexec usr/sbin var/empty"

for DIR in ${SCHGDIRS}; do
   find ${DESTDIR:-/}${DIR}/ -flags schg -maxdepth 1 | xargs chflags -v noschg
done

# extract base but exclude /etc
cat base.?? | tar --unlink -xpzf - [B]--exclude ./etc[/B] -C ${DESTDIR:-/}

3) don't forget to check the kernel, you can extract GENERIC and use the # nextboot -k GENERIC command for the next boot.

I always upgrade my machines this way (no build/install world)
 
Are you using ZFS or UFS? With ZFS. I would clone the root filesystem, download 7.3 distfiles, unpack them into the new rootfs clone, compare the 2 root filesystem configuration files against each other and go from there.
 
Back
Top