yum downgrade does not remove new package - upgrade

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?

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.

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)

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

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>

Related

pacman -Syu errors occured, no packages were upgraded

Following problem:
After a fresh installation of Blackarch i want to execute
pacman -Syu
but after it downloaded all the packages i get the same error for all packages. For example:
/usr/lib/ruby/gems/2.5.0/gems/colorize-0.8.1/LICENSE exists in both 'ssrf-proxy and 'yawast'
This means that two packages claim ownership of the same file. In reality, they conflict, but the package maintainers haven't noticed and haven't updated MAKEPKG. You'll need to uninstall one of the packages. Use pacman -Qii <package> to inspect each package. If one was explicitly installed, then it's safe to remove with pacman -Rns <package>

How to detect upgrade when an RPM that obsoletes another RPM is being installed

RPM scriptlets are passed in $1 ( the number of packages of this name which will be left on the system when the action completes ) so they can determine whether a package upgrade or removal is occurring. For reasons outside my control, I believe the next version of the package may have a different package name than the first version. I tried to create a new package that "obsoletes" the old one and upgraded using it. However, the old package postun scriptlet still got $1 == 0 and my postun cleanup script ran.
This is a bit of an edge case, because technically there are 0 packages with that name remaining, but I thought the obsoletes case might pretend that there's still a package with that name during the upgrade. Is there a way to test for the situation when a package is being obsoleted so that the scriptlet can determine an upgrade is occurring instead of a package removal?
Can you try this command to check the rpm packages in the OS
rpm -qa | grep -i "(RPMNAME)"

Is it possible to unistall the dependency package but not the actual package?

Use case:
package A
Requires: package B ( B doesn't require A)
$ yum remove package B
will remove package A too
Is there any way to avoid uninstalling package A,modifying somehow the spec file?
yum and dnf sit on top of rpm as an interface. You can force rpm directly to erase the RPM.
However, it is probably not the right thing to do and can easily lead you to headaches down the road, unless you very specifically know what you are doing and why.
From comments I assume you know what you are doing:
rpm -e --nodeps <pkg>
Other readers: please handle this carefuly as you may shot yourself in your own leg.

yum update dependencies only

I install my new rpm package using yum install (my package name) command; yum command installs main rpm package along with dependencies; there is no issue.
If my main package is updated to new and higher version then yum update (my package name) work fine, without any issues.
Please note, I execute createrepo command whenever new rpm is copied into rpm collection folder.
Problem is: If only adependent rpm is upgraded i.e. to new version in rpm collection folder at repo server, How to update only dependent rpms on client machine (RH machine)?
What I tried:
1. sudo yum update (my package name) command always returns (my package name) is already updated but It did not even check dependencies for a new version
I added one more dependent pkg (deppkg) section in repo file like below:
[mainpkg]
name=simplest
baseurl="file:///home/anand/testcode/rpmtest/"
gpgcheck=0
[deppkg]
name=simplest
baseurl="file:///home/anand/testcode/rpmtest/"
gpgcheck=0
Having added one deppkg section, yum update deppkg started working which is obvious. Still, yum update mainpkg command still does not find new dependencies.
I do not want to go by 2nd option as there can be many pkgs and will have to add or delete time to time so it will be difficult in the long run.
Could you please let me know if there are any alternative ways which would be useful to update only dependencies from a remote machine?
Regards,
Anand Choubey
Just "sudo yum upgrade" should pull in the updates. Don't give it any package names.
Edit: If you only want the ones from your repo, you can do "sudo yum upgrade --disablerepo=* --enablerepo=yourreponame"
you can run sudo yum makecache to update repos
and sudo yum update --downloadonly to pull rpm's without installing it

Uninstalling Perl Error: Cannot remove due to the following packages that depend on it

I'm trying to upgrade my version of Perl from 5.14 up to 5.20.
When I run the perl 5.20 upgrade sudo pkg update system/runtime/perl#5.20 I get this error:
pkg update: No matching version of system/runtime/perl can be installed:
Reject: pkg://ms.system.com/system/runtime/perl#5.20.0,5.11-0.151006:20140604T182727Z
Reason: This version is excluded by installed incorporation pkg://perl.system.com/omniti/incorporation/perl-514-incorporation#5.14,5.11-0.151002:20120725T211507Z
Thus I'm trying to uninstall the current 5.14 version first with sudo pkg uninstall system/incorporation/perl-514-incorporation and got:
Creating Planpkg uninstall: Cannot remove 'pkg://perl.omniti.com/omniti/incorporation/perl-514-incorporation#5.14,5.11-0.151002:20120725T211507Z' due to the following packages that depend on it:
// A list of dependent packages
Any idae on how to get pass this?
I strongly recommend that you don't attempt to upgrade your system perl. A lot of miscellaneous stuff in your OS depends on it and upgrading it to a new major version will entail breaking a lot of stuff. Consider also that this upgrade will require rebuilding every CPAN module with XS dependencies as well.
The better solution is to use perlbrew to install perl-5.20.0 locally in your home directory. You can then use that to work with newer perls without touching your OS perl.