HOWTO Restoring Removed Key System Packages
From Gentoo Linux Wiki
Please format this article according to the guidelines and Wikification suggestions, then remove this notice {{Wikify}} from the article
This guide is written around glibc. The method works for gcc and any other 'showstopper' packages glibc downgrades are not supported. You need a glibc-2.6 tarball from someone you trust if you cannot build one.
Given 10G of free space you can build your own. This is essentially a gentoo stage 3 install into a file.
Boot a liveCD and mount a partition with >10G free space at /mnt/gentoo Make a 10G empty file
dd if=/dev/zero of=/mnt/gentoo/recovery.file count=2500000 bs=4096
Make a filesystem in the file
mke2fs /mnt/gentoo/recovery.file
a journal is wasted. Make a new mount point
mkdir /mnt/fixme
and mount your new filesystem there
mount -o loop -t ext2 /mnt/gentoo/recovery.file /mnt/fixme
untar a stage 3 tarball into /mnt/fixme Do *not* trash your system by untaring to /mnt/gentoo then mount the fake filesystems
mount -t proc none /mnt/fixme/proc mount -o bind /dev /mnt/fixme/dev
Do not fetch a portage snapshot. Instead, bind mount your real /usr/portage to /mnt/fixme/usr/portage
mount -o bind /mnt/gentoo/usr/portage /mnt/fixme/usr/portage
Continue into the chroot
chroot /mnt/fixme /bin/bash
.... just like the install
env-update source /etc/profile export PS1="(Do not remove glibc) $PS1"
Now you have a working chroot in a file, continue with
emerge glibc quickpkg glibc
As you used your own distfiles and portage tree, everything should be available and the glibc binary tarball will be deposted in your own /usr/portage/packages/All, outside the chroot. Untar this glibc to /mnt/gentoo and reboot to test. You can remove recovery.file when its done what you needed.
