Last night I inadvertently deleted /etc and had to recover my system which was still running, and for my own sanity avoid downtime. Everything was still running when I realized what had happened so without logging out most things would continue to if I didn’t stop them.
I run a mix of stable and unstable. If you are on one or the other you will probably be able to simply extract /etc from a recent tarball, I tried doing this from drobbins builds but it was ineffective. After some other attempts I extracted a whole stable tarball from last weeks build. This allowed me to be able to compile with portage (which wasn’t working with just /etc). I then had to systematically rebuild system, fixing problems as I came upon them, ultimately I had to rebuild gcc twice because I use -march=core2 which is not available in the current stable gcc. several packages wouldn’t emerge even at this point so I had to use emerge –resume –skipfirst a couple of times. One of the bigger problem was the world file (where all packages I’ve added are listed) was lost. it’s made things a bit more complicated that simply doing an emerge -aveDbk world once system was fixed.
I could have easily resolved this had I been using buildpkg. instead this is taking hours to clean up and rebuilding everything to restore all lost /etc files. Fortunately I didn’t lose any of my settings because I keep /etc files I modify backed up in a git repository hosted by github.