Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 257750 - Unmerged dev-lang/python rescue guide
Summary: Unmerged dev-lang/python rescue guide
Status: RESOLVED WONTFIX
Alias: None
Product: Documentation
Classification: Unclassified
Component: Project-specific documentation (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-05 09:15 UTC by Marco Gusy
Modified: 2012-05-09 04:49 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Gusy 2009-02-05 09:15:00 UTC
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
Comment 1 Nick Fortino 2009-02-05 10:02:02 UTC
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
Comment 2 Nick Fortino 2009-02-05 10:32:14 UTC
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.

Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2009-02-05 16:42:02 UTC
(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.
Comment 4 Marco Gusy 2009-02-10 14:02:12 UTC
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).
Comment 5 Mike Gilbert gentoo-dev 2012-05-09 04:49:49 UTC
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.