Package installation says FILENAME exists in filesystem

faq

#1

I can’t install or update a package because I get (something like) this:

error: could not prepare transaction
error: failed to commit transaction (conflicting files)
libname: /insert/file/name/here exists in filesystem
Errors occurred, no packages were upgraded.

Why is this happening?

The package manager, pacman, has detected an unexpected file already exists on disk. By design it will not overwrite files that already exist. This is a design feature, not a flaw - package managers are designed to keep track of installed files.

This issue normally happens because you’ve manually added, copied, or created a file. It can also happen when you install software using a downloaded executable, run a make install, or use a third-party package system such as conda. It also occurs when you install an AUR package which installs files that conflict with a repo package.

When using a third-party installer you should always specify an alternative installation location, such as under your home directory, or under /opt or /usr/local/. Never install directly under / or /usr.

How can I fix this?

The first step is to identify which, if any, package owns the file. This can be easily done with:

pacman -Qo /path/to/file

If this identifies a conflicting package you can decide to remove it with pacman -R. If no package is identified you can delete the file, e.g. rm /path/to/file (or move it to a backup location, e.g. mv /path/to/file /path/to/file.backup).

Where can I read more?

This post was inspired by (and adapted from):

https://bbs.archlinux.org/viewtopic.php?id=56373

The above post also has links to further reading.


Files exist, while updating
Manjaro dirvers update error
So I have an update issue
URL's from my cheat sheet
[Stable Update] 2016-12-23 - Kernels, Nvidia, Firefox
Having trouble updating manjaro32
(Solved) Can not update libmagick6-6.9.9.26-1 during system update
[Stable Update] 2017-11-25 - Kernels, Jade, VirtualBox, Deepin, Kernel v4.15
Unable to update my system("files in conflict")
[Stable Update] 2017-10-26 - Gnome, KDE, Deepin, LibreOffice, Firefox, Wine, Virtualbox
Can't seem to install WPA update; I get conflic
Libcurl-compat: /usr/lib/libcurl.so.4.4.0 exists in filesystem
WIFI fails time to time RTL8821ae
Blackarch install error logs?
- Can't upgrade to 17-1-2017
[Solved] Error during cuda update
Conflicting files when trying to update
Ncurse conflicting error while updating
Packages from pip conflicting with pacman?
Atom not installing because 2 dlls exist already
[Stable Update] 2017-05-12 - Kernels, KDE, KDE Apps, Gnome, Browsers
Can't update system or install anything
Conflicting files on update
Gnome 17.0.2 fail to upgrade: conflicting packages
Error updating packages
{SOLVED}Clean Install Manjaro XFCE 17.0.2 Need Help!
Unable to update following fresh install; conficting files
Problems installing Gnome
Manjaro KDE freeze at installation to 75%
[ruby PKGBUID] Conflicting files: /bin already exists in filesystem
Ffmpeg0.10: installing libx264 breaks dependency
Can't install Chromium error: failed to commit transaction (conflicting files)
Errors occurred, no packages were upgraded ! no idea about that