2

we have rhel server 7.6 version

I am trying to remove the following rpm but without to remove rpm dependencies

but I get

 rpm -e --nodeps sshpass
error: "sshpass" specifies multiple packages:
  sshpass-1.06-2.el7.x86_64
  sshpass-1.05-5.el7.x86_64

I also try ( but this is invalid option )

yum remove --noautoremove sshpass -y
Loaded plugins: langpacks
Usage: yum [options] COMMAND

List of Commands:

any other ideas?

1
  • Use --allmatches to remove all matching versions
    – altblue
    Feb 5, 2021 at 0:17

2 Answers 2

2

You can specify the version:

rpm -e --nodeps sshpass-1.05-5 sshpass-1.06-2
3
  • what in case I dont know the details of the rpms?
    – yael
    Feb 1, 2021 at 17:25
  • for example I only have the sshpass , but not the sshpass details
    – yael
    Feb 1, 2021 at 17:30
  • I’d suggest sshpass-\* but I can’t check that that works right now. Feb 1, 2021 at 22:05
1

So, to begin with, you should probably not put yourself in a situation where multiple instances of the same RPM are present in the RPM database, as is the case here. It is either the result of an interrupted update transaction or prior use of --no-deps. In the end, the files are only present on the system once.

As Stephen answered earlier, you can simply expand your rpm -e --nodeps arguments to include the RPM version and release.

If you don't know the exact versions installed, simply run

rpm -q sshpass

On a clean RPM database, this will only output the name-version-release-arch of one installed RPM. In your case, this should give two lines instead of one.

From here, it should be pretty obvious how to remove an arbitrary number of RPMs that are installed concurrently. An example among many ways:

rpm -e --nodeps $(rpm -q sshpass)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .