Search code examples
linuxrpmyumdnf

dnf equivalent of rpm --replacefiles option


rpm command support --replacefiles option (subset of --force) which allows a package to overwrite files owned by another installed package.

Example: Package 'myrpm' owns multiple files, and is already installed. I want to install 'myrpm-custom-patch', which overwrites one of the files owned my 'mrrpm'.

# rpm -q myrpm
myrpm-1.0-0.x86_64

# rpm -ivh myrpm-custom-patch-2.0-0.x86_64.rpm
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
        file /usr/share/myfile from install of myrpm-custom-patch-2.0-0.x86_64 conflicts with file from package myrpm-1.0-0.x86_64

# rpm -ivh --replacefiles myrpm-custom-patch-2.0-0.x86_64.rpm
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:myrpm-custom-patch-2.0-0            ################################# [100%]

# rpm -q myrpm-custom-patch-2.0-0.x86_64.rpm 
myrpm-custom-patch-2.0-0.x86_64

If I want to install using dnf command rather than rpm command for installing, is there any equivalent option to force replacing files owned by other packages?


Solution

  • As confirmed by redhat team, dnf does not support this.

    More details here: https://bugzilla.redhat.com/show_bug.cgi?id=2129808