About Archive Tags RSS Feed

 

I don't fuck everything that's dead.

6 August 2009 21:50

This has been a hellishly busy & stressful week for various reasons, but today I made my situation a whole lot worse:

root@steve:~#
root@steve:~# cd /etc
root@steve:/etc# find . -name '*' -delete

Ooops.

I got the system back to minimum functionality by re-creating /etc/hostname, /etc/resolv.conf, and restoring backups of passwd, group, and shadow.

Unfortunately attempting to restore things further soon hit a roadblock so I copied /etc/* from a similar machine and patched up hostnames, etc. Unfortunately things like GDM were missing initscripts so the system failed to give me a good workable base.

What is the preferred way to recover from missing files anyway?

Try this:

 rm /etc/init.d/ssh

The naive attempt at recovery is this:

 apt-get install openssh-server --reinstall

But that doesn't restore the file. I'd be curious to know how I should restore it?

The emacs alternative, and all the symlinks from /etc/alternatives generally were missing, and on the whole it was a broken mess. I could start but gdm failed to give me a login due to dbus/random errors.

In the end I archived /home/steve to another box and planned a reimage. (I've currently installed the base system via a PXE-boot, and am installing the X, Emacs, Firefox stuff)

The good news is I've lost no data. The great news is that the installer recognised my LVM setup, and allowed me to re-mount /home without losing the data, or needing to touch the temporary-off-site backup.

In other news tomorrow we have a magical time:

  • Time 12:34:56 07/08/09

I will try to ensure I'm drinking alcohol that very second.

ObFilm: Kissed

| 3 comments

 

Comments on this entry

icon Anonymous at 17:03 on 6 August 2009

In theory, --force-confmiss should work for dpkg conffiles; however, packages which implement configuration file logic themselves may not properly install a new copy of the configuration file when reinstalling themselves.

Might I recommend etckeeper for the future? :)
(And don't forget to actually push the repository to some secure off-machine location.)

icon Steve Kemp at 17:20 on 6 August 2009

I guess I'll try using that next time and see if it helps, but yeah packages that do their own things in postinst will probably always need to be handled specially.

In theory my desktop machine isn't so important, and so a reinstall isn't a big deal. In practise I'll probably lose tonight setting it up, and a couple of hours over coming weeks restoring dotfiles, packages, and config tweaks.

Ironically I did use to have a backup system in place, but given the slowness of the link I stopped running it. I'll definitely revisit that once I've got the machine back up and running.

icon Suno Ano at 02:38 on 7 August 2009
http://sunoano.name

ouch ... well, double-ouch actually that is what such things are.

As the colleage before me already suggested, I can also only recommend using
http://sunoano.name/ws/public_xhtml/scm.html#etckeeper

Until now, I never had an accident e.g. removed /etc or something below it but if I do some time and /etc/.git is still in place, then I start the timemachine and go back a bit :)