Error “ruby-bundler: /usr/share/man/man5/gemfile.5.gz exists in filesystem (owned by ruby)” (SOLVED)

Whenever operating system packages are updated (as well as when new packages are installed), in addition to checking dependencies, package managers also check that there is no file conflict. That is, a package containing files that are already on disk and do not belong to this package will not be updated or installed.

During a regular system update (Arch Linux, for example) with the command

sudo pacman -Syu

you may run into error:

(8/8) checking for file conflicts                  [######################] 100%
(8/8) checking for file conflicts
error: failed to commit transaction (conflicting files)
ruby-bundler: /usr/share/man/man5/gemfile.5.gz exists in filesystem (owned by ruby)
Errors occurred, no packages were upgraded.

This issue is specific to the ruby-bundler-2.2.16-1 package. The essence of the error is that the gemfile.5.gz file already exists in the file system, it belongs to the ruby package, and this file is also present in the new version of the ruby-bundler package. As a result, the update cannot complete due to file conflicts.

Apparently, this problem will be solved in the ruby-3.0.1-1 package, which is currently at the testing stage (the [testing] repository).

You do not have to wait for the upgrade from ruby 2 to ruby 3, especially since this process can be delayed, you can use one of the following workarounds.

Please note that the file /usr/share/man/man5/gemfile.5.gz is just a manual file, documentation, that is, this file is not critical for the operating system.

You can overwrite this file right during the update, for this run the command:

sudo pacman -Syu --overwrite /usr/share/man/man5/gemfile.5.gz

Related article: Analogue of the --force option in pacman

Another option is just delete this file before updating:

sudo rm /usr/share/man/man5/gemfile.5.gz
sudo pacman -Syu

These methods are equivalent, choose any of them to update the packages in the operating system.

Leave Your Observation

Your email address will not be published. Required fields are marked *