Ubuntu / Linux news and application reviews.

Sometimes when installing / upgrading a package, you get an error about it trying to overwrite some file which is also found in some other package and this results in a error that won't let you install / upgrade that package. I don't know about you, but I get this kind of errors quite often (most probably because I'm running bleeding-edge software but that's another story).

In most cases, such errors occur when some file was moved from one package to another in a newer version. Here is an example of such an error:
Unpacking replacement smplayer ...
dpkg: error processing /var/cache/apt/archives/smplayer_0.6.9+svn3595-1ppa1~maverick1_i386.deb (--unpack):
 trying to overwrite '/usr/share/smplayer/translations/smplayer_eu.qm', which is also in package smplayer-translations 0.6.9-1
dpkg-deb: subprocess paste killed by signal (Broken pipe)

Here's another example:
sudo apt-get install dockmanager
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  dockmanager
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/94.4kB of archives.
After this operation, 430kB of additional disk space will be used.
(Reading database ... 162015 files and directories currently installed.)
Unpacking dockmanager (from .../dockmanager_0.1.0~bzr83-0ubuntu1~10.10~dockers1_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/dockmanager_0.1.0~bzr83-0ubuntu1~10.10~dockers1_amd64.deb (--unpack):
 trying to overwrite '/usr/share/dockmanager/data/skype_invisible.svg', which is also in package faenza-icon-theme 0.8
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/dockmanager_0.1.0~bzr83-0ubuntu1~10.10~dockers1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)


The fix


Fixing this (in most cases but probably not all) is quite simple: look for path of the file that caused the error - in my first example that would be "/var/cache/apt/archives/smplayer_0.6.9+svn3595-1ppa1~maverick1_i386.deb", an run the following command:

sudo dpkg -i --force-overwrite /var/cache/apt/archives/smplayer_0.6.9+svn3595-1ppa1~maverick1_i386.deb

If "--force-overwrite" doesn't work, you can try "--force-all" instead.

In the above command, replace "/var..." with the exact path to the .deb that caused the error on your computer. If you've installed it from a repository, the .deb is located in /var/cache/apt/archives but if not, it's wherever you've downloaded it (either way, the error should display its exact path so you don't have to look for it manually).

What the above command does is force the overwrite of the file that exists in 2 packages and caused the error. Then, to make sure all the packages have installed successfully, also run the following command:
sudo apt-get install -f