Arch Linux upgrade fails because some file exists in filesystem
Published at May 17, 2014 - 17:46:15 by dixDel
From time to time, pacman refuses to upgrade because of a file conflict. Since it does not want to take the responsibility of overwriting an existing file which might be used by another package, it displays the following error:
error: failed to commit transaction (conflicting files) freeimage: /usr/lib/libfreeimageplus.so.3 exists in filesystem Errors occurred, no packages were upgraded.
In this case, pacman tries to install the package freeimage, which contains a file named libfreeimageplus.so.3, but detects that a file with the same name exists at the same location.
To solve this conflict, we first need to verify that this file is currently not owned by another package:
$ pacman -Qo /usr/lib/libfreeimageplus.so.3 error: No package owns /usr/lib/libfreeimageplus.so.3
The above message means we can safely (re)move this file. Since we are cautious people:
$ sudo mv /usr/lib/libfreeimageplus.so.3 /usr/lib/libfreeimageplus.so.3.back
We repeat this procedure each time we see this error, then the next pacman -Syu should go smoothly. If pacman -Qo should return something like this:
$ pacman -Qo /usr/lib/libfreeimageplus.so.3 /usr/lib/libfreeimageplus.so.3 is owned by freeimage 3.16.0-2
Then it is probably a bug!