I was messing about with apt on an Red Hat Enterprise Linux WS 2.1 whose RHN subscription had expired, and I broke Berkeley DB, to the point where RPM would segfault every time I ran it, which made fixing things somewhat hilarious.
\r\n\r\n[I highly suspect that I managed to get the shared system libraries on the box woefully out of sync with the executables]
\r\n\r\nI'd already run apt-get dist-upgrade and it'd downloaded a huge pile of RPM files which I was convinced would fix the problem, but which I couldn't install.
\r\n\r\nFirstly, I knew that going from RPM 4.0.4 to RPM 4.3 would entail the following step:
\r\n\r\n # rm -f /var/lib/rpm/__*\r\n\r\n
Then, I did this, which is quite, quite horrible:
\r\n\r\n#!/bin/bash\r\n\r\nfor file in *.rpm ; do\r\n echo $file\r\n rpm2cpio $file > $file.cpio\r\n pushd .\r\n cd /\r\n cpio -iduv < /var/cache/apt/archives/$file.cpio\r\n popd\r\ndone\r\n\r\n
It worked. I re-ran ldconfig -v and I could then run my dist-upgrade (to square up the RPM database).
\r\nCan't say I'm proud, though :-)
\r\n[Note. You CAN dist-upgrade from Red Hat Enterprise Workstation 2.1 to Fedora Core 2, although it's not a route I would recommend, and definitely not for a production machine. That's what I was doing (the upgrade part, not the production part).]