[Nottingham] Gentoo fun! And a Geek Rant! emerge fails with python errors

Martin martin at ml1.co.uk
Wed Jun 17 23:44:26 UTC 2009

OK... So I innocently and naively tried updating the kernel on my 
experimental Epia C3 Gentoo diskless system, and...

"emerge" then fails with python errors about various things not being 
found! All along the lines of:

File "/usr/lib64/portage/pym/_emerge/__init__.py",
AttributeError: 'xxxx' object has no attribute 'yyyy'

and repeated a few times.


A Google search on the errors then finds some Geek's blog that then says 
that the errors are not emerge but are to do with python... and says 
nothing more! So... What's the big secret?! How do you fix 'em!???...


So, for any others out there, the fix is nicely described on:



For my example, the first things to try didn't work:

emerge portage


Don't be fooled into trying "emerge --clean" or "emerge clean". Get the 
portage system working properly first!


emerge --fetchonly sys-apps/portage

didn't work either.

Thence, the fix was:

wget -P /usr/portage/distfiles 

cd /root
mkdir portage-recover
cd portage-recover
tar xfj /usr/portage/distfiles/portage-2.1.6.tar.bz2
cd /root/portage-recover/portage-2.1.6
cp -R pym bin /usr/lib/portage/
rm -f /usr/lib/portage/bin/sed

Then check that /etc/make.globals is still ok:

less /etc/make.globals


emerge --metadata
emerge sys-apps/portage

And if you get a command not found error message when you try to run 
emerge, you may have to recreate the symlink:

# ln -s ../lib/portage/bin/emerge /usr/bin/emerge

Then, for good measure, all to be followed up with:

emerge --sync

emerge --pretend --update system
emerge --update system

emerge --pretend --update world
emerge --update world

Small tip for finding the replacement cfg files, place:

alias findcfg='find /etc -iname ._cfg????_*'

in .bashrc so that you can then just use "findcfg"

and then:

diff /etc/._cfgxxxx /etc/yyyy

and if that looks ok without clobbering any of your customisations, then:

mv /etc/._cfgxxxx /etc/yyyy

Good luck!


ps: Still well impressed with Gentoo. I'm also enjoying the clean 
simplicity of the command-line and the utter silence of cool 
disklessness! (OK, so I could add a desktop but then again, why spoil 
the minimalism for a device that isn't going to have a monitor attached 
in any case :-) )

Martin Lomas
martin at ml1.co.uk

More information about the Nottingham mailing list