Reputation: 1076
I have a bunch of rpm files in a folder. I am trying to install them using:
rpm -ivh *.rpm
so rpm can take care of the correct installation order.
On some of these rpms I have a newer version installed in my system so I get for example:
package info-5.0-1 (which is newer than info-4.13a-2) is already installed
/opt/freeware/man/man1/infokey.1 from install of info-4.13a-2 conflicts with file from package info-5.0-1
Is there a way to ignore the old .rpm file and resolve the dependency with the new version that is already installed? I thought of the --force option. But how --force resolves the conflicts? Overwrites them with the older version or just ignores them leaving the new version?
Any thoughts are welcome.
Upvotes: 54
Views: 214146
Reputation: 1
If some dependency failed because it requires a different version, try:
rpm -i --nodeps somepackage.rpm
Upvotes: 0
Reputation: 827
i was also receiving "xyz conflicts with file ...messages when using command
sudo rpm -i somefile.rpm
solution was to do:
sudo rpm -U somefile.rpm
the -U option is for upgrades per "man rpm" on linux Fedora 40. after restarting the app it shows the new version and works fine.
Upvotes: 0
Reputation: 554
I use next code to install the latest versions of conflict packages in directory:
cd $packages_dir
function mline {
# converts string with spaces to multiline string
echo "$@" | tr ' ' '\n'
}
all_p=$(ls -1)
uniqs=$(mline $all_p | grep -o -P '^.*?-[0-9]' | awk '{print substr($1, 1, length($1)-2)}' | uniq)
to_install=""
for p in $uniqs
do
p_regex=$(echo $p | sed 's/+/\\+/g' | sed 's/\./\\./g')
candidates=$(mline $all_p | grep -P "^${p_regex}-[0-9]+\." | sort)
count=$(mline $candidates | wc -l)
if [ "$count" != "1" ]
then
echo "package: $p"
echo -e "\tcandidates ($count):"
echo -e "\t\t$(echo $candidates | sed 's/ /\n\t\t/g')"
last=$(mline $candidates | tail -1)
echo -e "\tchosen: $last"
else
last=$candidates
fi
if [ "$(echo $last | xargs)" == "" ]
then
echo not found candidates
sleep 1000
# exit 1
fi
to_install+="$last "
done
dnf install --setopt=install_weak_deps=False -y $to_install
Notes:
?-[0-9]
means to find first version chars and stoptr
translates only 1 symbol to one, so I need to use sed
sometimesSample output:
package: tesseract
candidates (2):
tesseract-3.04.00-5.el7.x86_64.rpm
tesseract-4.1.0-1.el7.x86_64.rpm
chosen: tesseract-4.1.0-1.el7.x86_64.rpm
package: tesseract-osd
candidates (2):
tesseract-osd-3.04.00-5.el7.x86_64.rpm
tesseract-osd-4.1.0-3.el7.noarch.rpm
chosen: tesseract-osd-4.1.0-3.el7.noarch.rpm
Upvotes: 0
Reputation: 1496
The --force
option will reinstall already installed packages or overwrite already installed files from other packages. You don't want this normally.
If you tell rpm
to install all RPMs from some directory, then it does exactly this. rpm
will not ignore RPMs listed for installation. You must manually remove the unneeded RPMs from the list (or directory). It will always overwrite the files with the "latest RPM installed" whichever order you do it in.
You can remove the old RPM and rpm
will resolve the dependency with the newer version of the installed RPM. But this will only work, if none of the to be installed RPMs depends exactly on the old version.
If you really need different versions of the same RPM, then the RPM must be relocatable. You can then tell rpm
to install the specific RPM to a different directory. If the files are not conflicting, then you can just install different versions with rpm -i
(zypper in
can not install different versions of the same RPM). I am packaging for example ruby gems as relocatable RPMs at work. So I can have different versions of the same gem installed.
I don't know on which files your RPMs are conflicting, but if all of them are "just" man pages, then you probably can simply overwrite the new ones with the old ones with rpm -i --replacefiles
. The only problem with this would be, that it could confuse somebody who is reading the old man page and thinks it is for the actual version. Another problem would be the rpm --verify
command. It will complain for the new package if the old one has overwritten some files.
Is this possibly a duplicate of https://serverfault.com/questions/522525/rpm-ignore-conflicts?
Upvotes: 44
Reputation: 197
From the context, the conflict was caused by the version of the package.
Let's take a look the manual about rpm
:
--force
Same as using --replacepkgs, --replacefiles, and --oldpackage.
--oldpackage
Allow an upgrade to replace a newer package with an older one.
So, you can execute the command rpm -Uvh info-4.13a-2.rpm --force
to solve your issue.
Upvotes: 16