Sunday, May 18, 2008

Fixing last nights screwups

Well this is what happens when your working around 0400 local time :\

After last nights double upgrades my system wouldn't except my login over ssh citing an invalid password (when it was correct!). Plus it was refus8ing connections on the port I have sshd listing to but accepting on the default port 22, even though I merged my sshd_config with the new one.

Hooked up a monitor and keyboard to the server and even root was being rejected. I know I forgot to run /dev/MAKEDEV before rebooting the kernel but if that had any problems either init, rc, or getty would be dying from problems setting up TTYs and mounting disks!

Booted off the install floppy I had left over from the 4.0 upgrade and dropped to shell. Since I had to did a rude shutdown when I realized what was up, I had to force the mounts before I could go to work. Then I change rooted into the servers file system to get to fixing the login problem.

mount -f /dev/wd0a /mnt
mount -f /dev/wd0g /mnt/usr
chroot -u root /mnt sh

I knew I forgot to make the new device nodes so I did that and took a look at /etc/group and /etc/passwd before touching any thing else.

/dev/MAKEDEV all
TERM=vt220 vi /etc/group

I had to set TERM for nvi because with an empty $TERM after the chroot operation, vi couldn't handle the situation :\

checked out the group file and noted my custom user groups were missing, changed files :e /etc/passwd and noted that my user account was also missing!

Made a fix of this:

group add -g 7778 nfsusers

Added the nfsusers group for the file shares and recreated my personal user before mounting /home. That gave me enough that I could reboot, strip monitor and keyboard, and SSH into it from the desktop to finish poking around.

On login my shell prompt was 'Terry@noname-$ ' and I know my ksh prompts are 'username@hostname-$ ' which means my systems hostname settings were nuked.

Lo and behold, it hit my like a bus.

During last nights upgrade I remembered specifically that I did remove etc42.tgz in /usr/obj/4.2 before using a for loop to extract all of the file sets. But I could not remember doing the same with etc43.tgz in /usr/obj/4.3 when I installed the last file sets :\

Sure enough I looked in both directories and last nights log and bingo that is what happened! I ended up extracting the default configuration files for OpenBSD 4.3 after my upgrade.

I didn't take a backup of /etc before hand because I knew it wouldn't be harmed, assuming I didn't fsck things up. And of course any thing irreplaceable is backed up in like 4 or 5 places any way.

It looks like the only major losses in /etc were exports which I rewrote simply. I copied the %ProgramFiles%\etc\group file to the server as /etc/group.old and used vimdiff to merge my other custom groups in before moving on.

rc.local was overwritten but that's no loss because everything I had in there was commented out and there depends got pkg_delete'd last night ;-)

I repaired /etc/hosts, checking my changes against the hosts file on my desktop, (%WinDir%\system32\drivers\etc\hosts). Each of my machines defines a couple of 'quick' items in hosts. Then fixed /etc/myname with my machines proper name.

the settings in /etc/ntpd.conf were overwritten but unused for ages, the patch operations also left me my original file as /etc/ntpd.conf.orig hehe and I cleaned the rest out

cp /etc/ntpd.conf.orig /etc/ntpd.conf.ORIG
rm /etc/*.orig

Then set to fixing ssh_config and sshd_config

cd /etc/ssh && vim .

This really is what I get for doing things so late at night +S

No comments:

Post a Comment