3

we are trying to install the following rpm ( that actually already installed )

rpm -qa | grep sshpass
sshpass-1.06-2.el7.x86_64


yum install sshpass-1.06-1.el7.x86_64.rpm
Loaded plugins: langpacks
Examining sshpass-1.06-1.el7.x86_64.rpm: sshpass-1.06-1.el7.x86_64
sshpass-1.06-1.el7.x86_64.rpm: does not update installed package.
Error: Nothing to do

echo $?
1

but its returned exit code 1

why yum not ignoring the rpm that already installed and returned error?

other example

rpm -qa | grep figlet
figlet-2.2.5-9.el7.x86_64



yum install figlet-2.2.5-9.el7.x86_64.rpm
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
configuration
Examining figlet-2.2.5-9.el7.x86_64.rpm: figlet-2.2.5-9.el7.x86_64
figlet-2.2.5-9.el7.x86_64.rpm: does not update installed package.
Error: Nothing to do


echo $?
1

note - we also try yum clean all ,

and removed the /var/cache/yum/*

but not help

1
  • Do you want to (perhaps) reinstall the package?
    – jsbillings
    Jul 12, 2020 at 14:50

3 Answers 3

4

I am under the impression that you are complaining about yum default behavior.

yum serves as a package manager that installs/removes or upgrades packages.

If there's Error: Nothing to do it is de-facto failing a task to install / remove or upgrade a package - hence return code == 1.

If you would like to check if the package is installed and if it is not then install it try the following :

rpm -qa | grep wget || yum -y install wget

This should give you $? == 0 in the standard scenario.

2
  • 1
    This doesn't work. rpm -qa lololol will return 0 even though no such package is installed, at least on Red Hat 7. You need to do something like rpm -qa | grep wget to check for a given package.
    – JM0
    Oct 15, 2020 at 22:46
  • @JM0 yeah that's true - thanks for the heads up - I'll fix it in the answer. Oct 16, 2020 at 2:19
4

You are trying to install packages that are either older than or the same version as what you already have installed on your system. yum checks for this before it operates which is why it is giving the messages when you attempt to use it with those packages. Otherwise, what would yum do during updates? If an update came out and was available in one of the repos, would it upgrade them both to the latest and have two of the exact same package on the system?

If you need an older version of software, then you need to compile it from source instead of using yum to install its rpm.

2
  • figlet-2.2.5-9.el7.x86_64 is the same version this isnt old version !!!
    – yael
    Jul 12, 2020 at 14:33
  • @yael I've explained that. It's the same version that you already have on the system. The version of ssh-pass is older than what you have on the system. That is why yum is giving the message in both cases. Why are you trying to install the same exact version that you already have? Jul 12, 2020 at 14:36
0

I was facing a similar issue while installing a package and the problem was the same version of the package already existed.

The solution which worked for me: Lets say the package name is: package-abc

sudo yum remove package-abc -y

sudo yum install package-abc -y

Hope this helps you too! Cheers!

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.