How to fix libgdbm3 update problem in Debian
In case you recently tried to update your debian system, and got an error related to libgdbm3 like this:
Preparing to unpack .../libgdbm3_1.8.3-13+b1_i386.deb ...
Unpacking libgdbm3:i386 (1.8.3-13+b1) over (1.8.3-13) ...
dpkg: error processing archive /var/cache/apt/archives/libgdbm3_1.8.3-13+b1_i386.deb (--unpack):
trying to overwrite shared '/usr/share/doc/libgdbm3/changelog.Debian.gz', which is different from other instances of package libgdbm3:i386
Errors were encountered while processing:
/var/cache/apt/archives/libgdbm3_1.8.3-13+b1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
You can fix this easily by deleting the libdgbm3 changelog file.
# Remove the changelog
sudo rm /usr/share/doc/libgdbm3/changelog.Debian.gz
# Fix current installation
sudo apt-get install -f
Hope it helps!
Just maybe some background story. I use debian testing (Jessie) and I’m the type who run the following command everyday:
# One liner for upgrading the system
sudo apt-get update && sudo apt-get dist-upgrade
Some people might say I’m crazy. But I think it’s actually better because you get actually less big surprises. If we want stability, we should use the stable version (Wheezy) anyway. But debian testing itself is actually also very stable. I’ve never encountered any big problem by doing a dist-upgrade everyday (except that one time when they removed the ATI driver from repository).
Back to the topic, a few days ago I just got a problem with libgdbm3 package when trying to update the system. Running apt-get install with -f also can’t fix the problem. Usually, stuff like this will work again the next day, but it didn’t. So I googled around and found the solution to this problem by removing the changelog file.
The problem is, I encountered this problem with all the 3 computers I use with Debian Jessie (Work laptop, Personal laptop, and Personal PC). So I figured out, maybe someone out there will need it. The bug ticket also have a lot of texts, so maybe people will skim through and miss it (I did). Hope it’s useful.