3

When installing a package with pacman, I am seeing:

error: failed to commit transaction (conflicting files)
station: /usr/bin/station exists in filesystem

How do I tell pacman to install the package anyway, overwriting the existing file(s)?

3

Check what package includes the filename:

pacman -Qo filename

If it is another package, then file a bug report: packages which have conflicting files should mark themselves as CONFLICTS causing pacman to ask if you wish to replace the conflicting package.

If the files don't belong to any package, rename or delete them.


If you're sure you know what you're doing, you can use the --overwrite option, eg:

pacman -S package-name --overwrite /usr/bin/station 

or

pacman -S package-name --overwrite '*'

The man page says:

   --overwrite <glob>
       Bypass file conflict checks and overwrite conflicting files. If the
       package that is about to be installed contains files that are
       already installed and match glob, this option will cause all those
       files to be overwritten. Using --overwrite will not allow
       overwriting a directory with a file or installing packages with
       conflicting files and directories. Multiple patterns can be
       specified by separating them with a comma. May be specified
       multiple times. Patterns can be negated, such that files matching
       them will not be overwritten, by prefixing them with an exclamation
       mark. Subsequent matches will override previous ones. A leading
       literal exclamation mark or backslash needs to be escaped.
  • The Arch Wiki specifically recommends avoiding --overwrite except as a last resort. The correct approach is to move the conflicting file(s) and complete the install. – jasonwryan Dec 26 '18 at 17:23
  • Thanks, @jasonwryan, I've updated it. I actually had an AUR package conflicting with its own previously installed files - there may be some non-pacman auto-update going on which I'm still looking into. – Tom Hale Dec 26 '18 at 21:27
  • It is a bad idea to use "*" as a glob, since it will overwrite absolutely anything including many things you didn't intend. The --overwrite option was added to pacman, and --force was removed, specifically because greedily matching everything was too dangerous and users got into trouble, whereas globs allow matching only what you need and know is okay. – eschwartz Dec 30 '18 at 1:56
  • @eschwartz In my case, it was ok to overwrite all files for the named package as all were named as conflicts. – Tom Hale Jan 28 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.