Another day half gone…
September 12, 2006
I work half-days. Somehow this seems a lot less than the 5 hours it actually is. I seem to have far less than 5/8ths of the time available that the other team members do.
Yesterday and today were completely swallowed by yet another Gentoo issue. Basically, I corrupted a portage database, and it took me two days to get it back. At some point, I’m probably going to move to Ubuntu, since this seems to break far less often. Anyway, summary of problem and solution follow:
Problem: pc wouldn’t shut down on Friday. Now emerge gives the following error:
Traceback (most recent call last):
File “/usr/bin/emerge”, line 12, in ?
import portage
File “/usr/lib/portage/pym/portage.py”, line 7235, in ?
init_legacy_globals()
File “/usr/lib/portage/pym/portage.py”, line 7201, in init_legacy_globals
mtimedb = load_mtimedb(f)
File “/usr/lib/portage/pym/portage.py”, line 7126, in load_mtimedb
d = mypickle.load()
cPickle.UnpicklingError: invalid load key, ‘[‘.
————–
Aaargh!
So I searched around on line, and then tried manually fixing my portage installation, as per http://www.gentoo.org/proj/en/portage/doc/manually-fixing-portage.xml
Current portage installation (as at 11/09/2006) was 2.1.1, so I did:
wget -P /usr/portage/distfiles http://distfiles.gentoo.org/distfiles/portage-2.1.1.tar.bz2
Then I try to emerge again, and get another error!!!!
Traceback (most recent call last):
File “/usr/bin/emerge”, line 4049, in ?
emerge_main()
File “/usr/bin/emerge”, line 3768, in emerge_main
settings, trees, mtimedb = load_emerge_config()
File “/usr/bin/emerge”, line 3689, in load_emerge_config
mtimedb = portage.MtimeDB(mtimedbfile)
File “/usr/lib/portage/pym/portage.py”, line 6717, in __init__
self._load(filename)
File “/usr/lib/portage/pym/portage.py”, line 6724, in _load
d = mypickle.load()
cPickle.UnpicklingError: invalid load key, ‘[‘.
————————-
Now I call the system administrator.
He suggests:
http://forums.gentoo.org/viewtopic.php?t=143863&highlight=bestmatchvisible
Tried: rm -rf /var/cache/edb/dep/*
emerge –metadata
Still nothing. Then omniscient-type system admin person did some debugging…..
Added print statement to line 6717 of File “/usr/lib/portage/pym/portage.py”
This showed that the file that was loading before the unpickling error was /var/cache/edb/mtimedb
Then moved /var/cache/edb/mtimedb to /var/cache/edb/old
Did:
emerge –metadata
Hooray!!!!!
Then, just to make sure, did emerge sys-apps/portage. So now, 2 days later, my system sort of works again.
————————————————————————————————————–
November 15, 2006 at 4:11 am
Thanks for the post. I had a different problem, but your article led me to my answer
For others troubleshooting similar issues I had corrupt files in /usr/portage/metadata/cache and emerge couldn’t compile its cache. Downloading the latest portage tarball and re-extracting to usr/portage resolved my issues.
February 4, 2007 at 2:28 am
Thanks–this post just saved me a lot of time too (I had the same mtimedb corruption)
August 15, 2008 at 1:01 am
Thanks! I had almost identical problem and solved it using your method – different file though. Clever solution, saved me a lot of time and worrying.