pacman: exists in filesystem

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

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x