What initially attracted me to Gentoo is its sometimes-elegant portage system, which is Gentoo’s version of a package manager — one of the things that distinguishes Linux flavors from one another.
Portage suffers from a sort of chicken-egg conundrum in that portage and all of its files and dependencies are themselves managed by portage, which means that upgrading libraries that everything relies upon can quickly lead to a system where portage becomes inoperative.
Recently, I managed to mangle “wget” by deinstalling a library it relied upon. This is difficult to recover from since wget is essential to portage’s ability to install packages … such as wget and the libraries it requires. I also discovered that an ftp client is not installed by default, which is surprising, but effectively ruled out just copying a working wget from another system.
As it turns out, the default Gentoo installation does include busybox, which is theoretically less functional, but will do the trick. For those unfamiliar with busybox, it’s essentially one binary that contains (and is capable of replacing) a number of tiny command line functions, from cp and cat to rm and xargs. If you have it installed, typing “busybox” will tell you exactly what command line tools it can replace.
Therefore, it’s possible to [re]install wget by telling portage to use busybox’s wget instead of wget itself:
FETCHCOMMAND="/bin/busybox wget \${URI} -P \${DISTDIR}" emerge wget