Today I did an idiot thin. I manually unmerged python before upgrading it. This caused ebuild/emerge software not to work anymore. First thing I point out is emerge didn't warn me when I unmerged a core package. Second thing the %PYTHONHOME environment variable didn't work well because /usr/lib/portage/bin/filter-bash-environment.py script reset the environment (and python can't find anymore its modules) Maybe some kind of portage/python recovery solution would help Reproducible: Always Steps to Reproduce: 1.unmerge python 2.emerge something
The best solution I know of ymmv: The idea here is to run python, but never install any version of python that didn't come from portage. cd /root wget http://distfiles.gentoo.org/distfiles/Python-2.5.4-r2.tar.bz2 tar jxvf Python-2.5.4.tar.bz2 cd Python-2.5.4 ./configure make ./python `which emerge` python cd /root rm -rf Python-2.5.4
I'm sorry, I should really know better than to give advice from memory without trying it first. This actually worked in a chroot: cd /root wget http://distfiles.gentoo.org/distfiles/Python-2.5.4.tar.bz2 tar jxvf Python-2.5.4.tar.bz2 cd Python-2.5.4 ./configure make #installs into /usr/local make install ./python `which emerge` python You have to clean up /usr/local on your own if you care, but portage should work again.
(In reply to comment #0) > First thing I point out is emerge didn't warn me when I unmerged a core > package. I find that very hard to believe. emerge by default waits 5 seconds for normal packages and 10 seconds for core packages before removal, while displaying huge warning notices and doing a couple of ^Gs. You're going to have to provide some evidence to the contrary. > Second thing the %PYTHONHOME environment variable didn't work well because > /usr/lib/portage/bin/filter-bash-environment.py Since you were going to "fix" the problem manually anyway, why didn't you just fix that file? :) > script reset the environment (and python can't find anymore its modules) (In reply to comment #2) > #installs into /usr/local That's the bad bit. Why not simply use a pre-packaged tbz2 from http://tinderbox.dev.gentoo.org/ ? Pick the version for your arch closest to the version you just unmerged, then untar it either to / or to some directory under your $HOME perhaps. The former will IMO work best, but may leave some residual files that may cause trouble later on. The latter is known to be more cumbersome, as it requires changes of some environment variables and sometimes changes to files the package installs, but only requires an `rm -r $HOME/[python-unpacked] once you have re-emerged python.
I did it using a rpm package + rpm2targz. I installed in /usr prefix, then a reemerge of python cleared things out. @3 Yes, it warned me for 5 seconds, not 10. I meant this. --- Anyway this was a wishlist, not a bug. A guide in the wiki or some kind of auto-rescue would be very useful. Think to something like a binary backup of core packages in a tar.bz2 format it would help also in some other extreme cases (like a buggy baselayout, it happended once). Most of problems con be solved with a chroot, except when emerge doesn't work (broken python, broken portage or else).
I find it unlikely that anyone is going to write an official guide on this just for python There are already many forum posts and such that describe how to recover from situations like this. You are welcome to document it on the Gentoo wiki as well.