Subject: Re: Oh My... /etc is GONE!
To: None <netbsd-help@netbsd.org>
From: ali (Anders Lindgren) <dat94ali@ludat.lth.se>
List: netbsd-help
Date: 04/23/1999 15:31:13
On Thu, 22 Apr 1999, Robert Schmid wrote:

> I was trying to install a package using pkg_add when I realized I was in
> /etc instead of /.  So I CTRL-C out and switched to /.  Suddenly /etc was
> gone.  Someone please tell me this was a disk error that will be magically
> fixed on reboot somehow.

Only /etc? Lucky bastard, I lost most of /bin, /usr etc. as well... ;)
> 
> If not - how did I do this?  Is there anyway to recover without
> reinstalling a new /etc directory?

I'd say 'if you have backups, yeah' because I had the same problem. I
asked about it on irc (and on this list? Can't remember) #Netbsd and
nobody knew, but shortly after it appeared on the list and the
author/maintainer(?)/someone "thanked me for having discovered a
race-condition in pkg_add", so to speak. Apparently if you ^C during a
pkg_add under the wrong circumstances, you can trigger a race-condition
which leads to pkg_add going through its cleanup-stage while in the wrong
directory, meaning a rm -rf * in / instead of /var/instmp.XXXXXX. I lost
so much of my setup due to this bug I had to reinstall the entire system.
I was under the impression that this bug had long since been fixed,
but it seems now I won't be doing any ^C during pkg_add any time soon. :-)

If it's the same race-condition, it should've been known for at /least/ 10
months[0], probably more, but since someone I assumed was the maintainer
found out what went wrong and discussed it on one of the lists I never
filed an official bug-report and it might've gotten lost along the way
that way. Some archive-digging should reveal the dates and details.

Not much consolation I'm afraid, but at least an explanation. I was
severly puzzled for a few minutes until I had to face the horrible
truth. Gave me one hell of a good reason to go about that 1.3.2->1.3.3
upgrade though. :-)

[0] ISTR it was in fact dec. '97, just before the 1.3.3 release
-- 
/ali: Computer Science Major and aspiring cartoonist. :-) 
(dept) dat94ali@ludat.lth.se - http:// www.ludat.lth.se/~dat94ali
* a4ooo/o4o/18Mb/1,5Gb/OS3.o/Ariadne/Picasso2+ - cogito, amiga sum *