libqtcore4: Sub-process /usr/bin/dpkg returned an error code (1) -- "trying to overwrite shared `/etc/xdg/Trolltech.conf`"

Solution 1:

I've been having a problem with this for a couple months and this little line fixed everything. I wish I'd have read this sooner!

sudo dpkg -i --force-overwrite  /var/cache/apt/archives/libqtcore4_4%3a4.8.7+dfsg-5ubuntu2_amd64.deb

Solution 2:

There's a Launchpad Ubuntu tracker for this bug. This is the posted workaround, which also worked for me:

sudo mv /etc/xdg/Trolltech.conf /etc/xdg/Trolltech.conf.old
sudo apt-get -f install

Solution 3:

After a reboot everything worked again.