by lunarg on March 26th 2008, at 13:17

Had an issue on my PC at work with a corrupt reiser4 filesystem (still no clue as to why). I managed to repair the FS using RiP-Linux, but not without some data loss. After reviewing lost+found, I found most files related to some HTML cache of Konqueror, but fsck.reiser4 complained about a file that could not be recovered.
After awhile, I tried running emerge to install some new package, and there it was: a broken portage...

The error I got:

!!! Failed to complete portage imports. There are internal modules for
 !!! portage and failure here indicates that you have a problem with your
 !!! installation of portage. Please try a rescue portage located in the 
 !!! portage tree under '/usr/portage/sys-apps/portage/files/' (default). 
 !!! There is a README.RESCUE file that details the steps required to perform 
 !!! a recovery of portage. 
     No module named collections

Following directions (see here), I installed a rescue portage, but the error remained. After some searching, I stumbled upon a forgotten thread on Gentoo Forums:

In there, I found the collections to be a Python module (which makes sense, as after all, Portage is a Python-app). I basically followed the solution provided there.

Get the latest pre-compiled Python from tinderbox, and unpack it:

tar xjf python-2.4.4-r6.tbz2

Go into the unpacked dir and copy to the proper place. In my case, the file really was missing:

cp usr/lib/python2.4/lib-dynload/ /usr/lib/python2.4/lib-dynload/

Try running emerge now. If it works, you're good to go.
Do note that I remerged Python, to make sure no other stuff was faulty:

emerge -v python

Now on to getting a decent stage4 so this stuff doesn't happen again.

« September 2023»
« When a bird does poo poo in your eye, be happy elephants don't fly. »