CR7
CR7

Reputation: 135

yum downgrade does not remove new package

Release 1 contains the following packages

Package A-1.0
Package B-1.0

Release 2 contains the following packages

Package A-2.0
Package B-2.0
Package C-2.0

In Release 2, Package B-1.0 was split into two packages - package B-2.0 and package C-2.0.

Now when Release 2 is installed, how do I downgrade to Release 1?

yum downgrade A B tries to install package B-1.0 which has file conflicts with package C-2.0.

yum downgrade A B C does not work because there is no older version for Package C.

Is there a single command through which it erases the new package (package C-2.0) and downgrades packages A and B?

Upvotes: 2

Views: 2356

Answers (4)

RvKmR
RvKmR

Reputation: 1

you just need to use the repo that was referred while executing the earlier yum command.

yum history undo <yum_history_id> --enablerepo=<yum_repo>

Upvotes: 0

Abdallah Jaghoob
Abdallah Jaghoob

Reputation: 146

You can use yum shell to write multiple operations before executing them all in a single transaction.

In your case, you can use the following:

yum shell
yum downgrade A B
yum remove C
run

Upvotes: 2

Chris Maes
Chris Maes

Reputation: 37832

It might be too late as you have already released packages A-2.0 and B-2.0, but what you should have done (and can still do if you can delete your A-2.0 and B-2.0 packages):

In spec file of A-2.0 and B-2.0 add: Requires: C

This has multiple advantages you search (and more):

  • when updating A and/or B; C will be automatically installed.
  • when uninstalling C A and B will be downgraded.

However:

  • when downgrading A and B; C will not be uninstalled.

There is an alternative which I use for my projects: I use a meta-package:

  • meta-package-1.0: Requires A-1.0, B-1.0, Conflicts C
  • meta-package-2.0: Requires A-2.0, B-2.0, C-2.0

(and I use a branch with an unstable meta-package preparing next release: meta-package: Requires A, B)

Upvotes: 2

msuchy
msuchy

Reputation: 5447

If you upgraded several packages and then you want to downgrade just those two, then it cannot be done. Not using just yum (unless you use --nodeps and temporary break deps). There are high level tools like RH Satellite, which can do that.

If you upgrade just those in separate transaction then you can run:

   yum history list
   yum history undo <ID>

or

   yum history undo last

And it will rollback that transaction. I.e. in your case downgrade those packages. See man page of yum for details about history command.

Upvotes: 3

Related Questions