Ubuntu 12.04.1 LTS: Recovering from a Broken libc

Note: Reasonably heavy UNIX-geekery ahead. Mostly Linux-specific, somewhat Debian-specific and a little bit Ubuntu-specific. Skip if that isn’t your cup of ichor.

I recently did something incredibly ill-considered while logged in (as root, natch) to my Ubuntu server box at home. In essence, I told the package manager to uninstall libc.

On a scale from good to bad, this is bad.

Now, I could have booted up from a rescue disk and fixed it. I could have re-installed easily enough (using the trick where you just keep your existing partitions and don’t format them — though this would have inevitably led to some fallout as various config files and customizations got clobbered). Heck, I even had a reasonably recent backup at hand. None of these sounded especially fun, mostly because the machine was in a place where it’s a hassle to stick a head on it. I had three things working in my favor: an open root-privileged shell prompt, Internet connectivity and my native cunning.

Read on after the jump for the full tale.