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 better way

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

The faster way

pacman has an --overwrite option which will allow it to overwrite files. If you are sure you want to, you can tell it to

sudo pacman -S $PACKAGE --overwrite path/to/*

This will (re)install the $PACKAGE and overwrite any files under the directory path/to/

This can be very useful if your local database has “lost” a package you’ve already installed (and so every file in the package “conflicts”).

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
Unable to update my system("files in conflict")
So I have an update issue
Manjaro dirvers update error
URL's from my cheat sheet
[Stable Update] 2016-12-23 - Kernels, Nvidia, Firefox
Conflicting files when trying to update
Engrampa interfering with initial package updates
Error on update
Difficulty upgrading Manjaro, some kind of Python 3.6 conflict
Pacman update and upgrade probleme (python?) [solved]
Cannot upgrade my system - Conflicting files
Not able to use TensorFlow in python: Failed to load the native TensorFlow runtime
[Résolu]mise à jour manjaro KDE ne se fait pas.
Can't Update - lots of errors KDE Manjaro
Cinnamon and Desklets
Kauth can't reinstall without losing manjaro settings
Latest package update causing multiple issues
Kauth-5.55.0-1 error
Cannot boot beyond the login screen
Condres OS dejavu?
Error: failed to commit transaction (conflicting files) python-opinel
Failed to commit transaction python-pillow
Upgrade does not run through because of "/usr/lib/python3.7/..." in file system
[Stable Update i686] 2019-02-18 - systemd, LibreOffice, KDE, firmware
Please help python-aiohttp_socks
How do I remove manually installed packages?
[Stable Update] 2019-02-09 - Kernels, Deepin, Firefox, Wine, Python, Haskell
Updating error now egl-wayland : /usr/lib/ ya existe en el sistema de archivos
Problem with update multilib
Update: trouble module & kernel & ipv6
Update: file conflicts
Pacman file exists error on openssl
/var/lib/pacman/local/kscreenlocker-5.14.4-1/desc: No such file or directory
Python-lxml conflict
Errors While Installing Texmaker
Unable to update system: corrupted packages and missing/incomplete metadata
Many conflicting files for pacman update
[Solved] Still stuck at the Stable Update 2018-12-31 because of files that cannot be removed
Error: could not open file /var/lib/pacman/local/bolt-0.6-1/files: No such file or directory
Can't update: many python3.7 files exist
Error upgrading qt5-xmlpatterns
Request help installing pulseaudio-dlna
Forged Alliance Forever client crashes on start
[Testing Update] 2018-12-30 - Kernels, Firefox, Deepin, Virtualbox 6.0, Haskell, Python
Python problems after updating
[SOLVED] Manjaro 32 refuses updates no matter what
Pamac update failed: many (!) files already on system
Pacman error: failed to prepare transaction (could not satisfy dependencies)
Cant update - error: could not open file /var/lib/pacman/local/geos-3.7.0-1/desc
Could not open file /var/lib/pacman/local/ecryptfs-utils-111-3/desc
[SOLVED] Manjaro 32 refuses updates no matter what
Trying to install BOINC / Snatching defeat from the jaws of victory
Updating file once again crashes system. .
[Stable Update] 2018-12-02 - Kernels, Plasma, Mesa, Cinnamon, Gnome, Deepin, XFCE, Vulkan
Openssl conflict blocking upgrade
Error during boot
Can't update system due to numerous file exists errors
[Security Update] 2018-10-23 - Firefox 63
- Can't upgrade to 17-1-2017
[Solved] Error during cuda 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
Pacman: error while loading shared libraries:
Controvercy between yaourt and pacman
Conflicting files: /usr/bin/dboxmenu exists in both rootmenu and rofi-scrits
/usr/lib/python2.7/site-packages/ exists in both 'python2-socks' and 'python2-pysocks'
I think I messed up python
Updating problem, python-dateutil file conflict
I can't upgrade my laptop since " *node* exists in filesystem "
Problems reinstalling Clang
Update fails because of /usr/lib/
Cant install a program with error: libnsl: /usr/include/rpcsvc/nis.x exists in filesystem
Can't install Clementine
Aurman installation: ModuleNotFoundError: No module named 'pycman'
How to install "multisystem" in aur?
Problem with system Upgrade.
GNU C Library ('glibc') update problem / Dropbox (failed locale)
Python code run - segmentation fault core dumped
[Stable Update] 2018-06-10 - Kernels, KDE Apps, LibreOffice, Firefox, GCC, Gambas, Deepin
Failed to commit transaction due to Python conflict
Cannot uninstall video driver (Bumblebee)
Difficulty upgrading Manjaro, some kind of Python 3.6 conflict
Handle a file conflict
Failed to commit transaction: conflicting file
Can't install Nvidia drivers, conflicting files
Impossible to install Aurman (python files is already present in the file system)
[Stable Update] 2018-08-18 - Kernels, Xorg-Server, Mesa, Deepin, MATE, Perl, Python
Error install apper [SOLVED]
Error installing atom
Libidn-133-compat update conflicts with
Failed to commit transaction:
Mabox, Warning: cannot resolve "pacman>=5.1"
Updating Xfce Comes with Error
Failed to commit transaction
AUR: installation of Anaconda fails on Linux Manjaro using Arch Linux package manager, conflicting files
Unable to install Spyder3
[Stable Update] 2018-10-08 - Kernels, Gnome 3.30, Cinnamon, Deepin, Pamac, SPL/ZFS
[Testing Update] 2019-06-17 - Kernels, KDE Plasma, Browsers, XFCE, Deepin, Nvidia, Haskell, Perl
LibreOffice won't start.
GLIBC not found kernel panic
deepin: lightdm file conflicts - unable to update
Cannot remove nordvpn-bin installed with AUR
Problem with update, stable. [solved]
Problem with update, stable. [solved]
[Solved] Cannot install VMware Workstation, file conflicts
youtube-dl issue
Backintime installation error
Failed to commit transaction (conflicting files) when updating
maj soucis et extraction de lot de fichiers (contourné)
Weird issues after update a few days ago