Gentoo x64 - Reinstall from Scratch

Web, General Add comments

Now my enthusiasm has faded a bit. I worked under the presumption that anything linux would be tested by millions of users and nearly every obscure bug that might occur like if you are running your PSU near its limit and decide to attach an USB hairdryer to the USB hub in your keyboard would have been found eventually.

The install CD passes some unterminated string coming from GRUB to the linux kernel as a parameter. This string then creeps into your environment. When you chroot into your system as it is being installed (and maybe forget to env-update && source /etc/environment - might have happened to me because I chrooted quite often until the thing could boot itself), this unterminated string in the environment gets saved.

Linux version 2.6.24-gentoo-r7 (root@poseidon) (gcc version 4.1.2 (Gentoo 4.1.2 p1.0.2)) #1 SMP Sat Jun 21 06:59:43 UTC 2008
Command line: root=/dev/ram0 init=/linuxrc dokeymap looptype=squashfs
loop=/image.squashfs cdroot vga=791Y^ÛóØÐö^A^È´þ¸7Õ^Fð>å)Ë6B¿u
^Cª^×ÎV^Gé^K¿ú^Éþ¢Xm.^ÍdrRW½Y^×g^Ú^C¤^ÛQ’ñ÷^5÷Vb²Iuf2õ^ʰý^ÁÀ¶^U§^Ï7ãÞ÷;9^U^Òg^
Y^SÛKÈÅd^Ù_^Óê|äKºpN» ðK´¸¼ “NÇ@ܹ¤À×ÉTÊHõ^Rùc;¨øÁ²^Ñ=PcûmMùÒû^É^YH^Óò^É!

I think gentoo’s emerge stores the environment in which a package was installed so that, when the package is uninstalled, this can be done under the exact same environment. For example, if you installed PHP with the apache USE flag, it would have installed the apache extension for php. If you now remove the apache USE flag and uninstall PHP, it wouldn’t know that it has to uninstall the apache extension — unless you let it run in a sandbox with the exact environment at the time of installation.

/var/tmp/binpkgs/app-text/ghostscript-gpl-8.62/temp/environment

[…]
vga=$’791Y\233\363\330\320\366\001\001\001\001\001\001\001\001\001\001\001\001
\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001
\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001
\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001\001…
[…]
vga=”791Y^ÛóØÐö^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A
^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A
^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A
^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A…

To make a long story short, this saved environment was close to 500 KB, maybe only limited by the maximum environment size being reached. Add just one more thing to the environment (something an uninstall sandbox would likely do) and restoring the environment causes it to overflow.

Whenever I tried to rebuild a package or update it, emerge would fail with an error message (and continue doing its stuff — ignoring that a required package just failed to install — wow!).

/usr/lib/portage/bin/ebuild.sh: line 1496: /bin/touch: Argument list too long

This sucks pretty hard. Not knowing how to solve this, I tried increasing my kernel’s environment size and then (after that didn’t work), tried to rob portage of its saved environments. For that, I used find|grep to make a list of all environment.bz2 files in /var/db/pkg. Then I tried to tar the files in the list with the –remove-files option and when couldn’t get tar to do what I wanted, I tried passing the list to rm.

Well, ultimately I managed to clean out my entire /var/db directory - with the exception of my list of files to delete.

I started a reinstall from scratch, this time explicitely unsetting the vga variable in my install CD’s environment before even so much as touching emerge. Hope it works out this time around.

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Login