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

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

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

The above post also has links to further reading.


Files exist, while updating
So I have an update issue
Unable to update my system("files in conflict")
Manjaro dirvers update error
URL's from my cheat sheet
[Stable Update] 2016-12-23 - Kernels, Nvidia, Firefox
Difficulty upgrading Manjaro, some kind of Python 3.6 conflict
Engrampa interfering with initial package updates
[Security Update] 2018-10-23 - Firefox 63
- 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/libcurl.so.4.4.0 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-6.9.9.26-1 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: libpsl.so.5
Controvercy between yaourt and pacman
Conflicting files: /usr/bin/dboxmenu exists in both rootmenu and rofi-scrits
/usr/lib/python2.7/site-packages/socks.py 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/libmozjs-52.so.0
Cant install a program with error: libnsl: /usr/include/rpcsvc/nis.x exists in filesystem
Error on update
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
Cannot upgrade my system - Conflicting files
[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
Not able to use TensorFlow in python: Failed to load the native TensorFlow runtime
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 libidn.so.11
Failed to commit transaction:
Mabox, Warning: cannot resolve "pacman>=5.1"
Updating Xfce Comes with Error
Failed to commit transaction
AUR: installation of Anaconda 5.3.0.1 fails on Linux Manjaro using Arch Linux package manager, conflicting files
Cant update - error: could not open file /var/lib/pacman/local/geos-3.7.0-1/desc
[Stable Update] 2018-10-08 - Kernels, Gnome 3.30, Cinnamon, Deepin, Pamac, SPL/ZFS
Could not open file /var/lib/pacman/local/ecryptfs-utils-111-3/desc
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