Package installation says FILENAME exists in filesystem; Failed to commit transaction (conflicting files)



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):

The above post also has links to further reading.

Files exist, while updating
So I have an update issue
Manjaro dirvers update error
URL's from my cheat sheet
[Stable Update] 2016-12-23 - Kernels, Nvidia, Firefox
Unable to update my system("files in conflict")
Aurman installation: ModuleNotFoundError: No module named 'pycman'
Can't install Clementine
Error on update
Cant install a program with error: libnsl: /usr/include/rpcsvc/nis.x exists in filesystem
Update fails because of /usr/lib/
Problems reinstalling Clang
I can't upgrade my laptop since " *node* exists in filesystem "
Updating problem, python-dateutil file conflict
I think I messed up python
/usr/lib/python2.7/site-packages/ exists in both 'python2-socks' and 'python2-pysocks'
Conflicting files: /usr/bin/dboxmenu exists in both rootmenu and rofi-scrits
Controvercy between yaourt and pacman
- 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!
Problems installing Gnome
Blackarch install error logs?
WIFI fails time to time RTL8821ae
Libcurl-compat: /usr/lib/ exists in filesystem
Can't seem to install WPA update; I get conflic
[Stable Update] 2017-10-26 - Gnome, KDE, Deepin, LibreOffice, Firefox, Wine, Virtualbox
[Stable Update] 2017-11-25 - Kernels, Jade, VirtualBox, Deepin, Kernel v4.15
(Solved) Can not update libmagick6- during system update
Having trouble updating manjaro32
Errors occurred, no packages were upgraded ! no idea about that
Can't install Chromium error: failed to commit transaction (conflicting files)
Ffmpeg0.10: installing libx264 breaks dependency
[ruby PKGBUID] Conflicting files: /bin already exists in filesystem
Manjaro KDE freeze at installation to 75%
Unable to update following fresh install; conficting files
Cant install a package
Cannot get rid of update
Failed to commit transaction due to Python conflict
Pacman: error while loading shared libraries:
[Stable Update] 2018-06-10 - Kernels, KDE Apps, LibreOffice, Firefox, GCC, Gambas, Deepin
Cannot upgrade my system - Conflicting files
Python code run - segmentation fault core dumped
GNU C Library ('glibc') update problem / Dropbox (failed locale)
Problem with system Upgrade.
How to install "multisystem" in aur?