LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to fall back after yum update (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-fall-back-after-yum-update-4175621478/)

sterry0101 01-12-2018 07:51 AM

how to fall back after yum update
 
Hello all!
I would like to ask how to fall back after yum update for redhat6/7, centos6/7, oracle.

I found that the following command to do rollback in redhat distribution.
# yum history rollback last-1
However, when compare with previous rpm list after yum update, there are some slightly difference. (command shows as follows.)

# rpm -qa >> test1
After yum update
#yum history rollback last-1
# rpm -qa >>test2
#diff test1 test2
It is not the same.

So, do you guys have any idea how to do that?

jsbjsb001 01-12-2018 07:54 AM

Quote:

Originally Posted by sterry0101 (Post 5805437)
Hello all!
I would like to ask how to fall back after yum update for redhat6/7, centos6/7, oracle.

I found that the following command to do rollback in redhat distribution.
# yum history rollback last-1
However, when compare with previous rpm list after yum update, there are some slightly difference. (command shows as follows.)

# rpm -qa >> test1
After yum update
#yum history rollback last-1
# rpm -qa >>test2
#diff test1 test2
It is not the same.

So, do you guys have any idea how to do that?

Define "fall back" ?

Do you mean to roll back and restore your system back to the way it was before you updated it? (removing the updates you installed)

sterry0101 01-12-2018 07:58 AM

Hi jsbjsb001!
Thank you for your reply first.
Do you mean to roll back and restore your system back to the way it was before you updated it?<----yes!!
As you know that yum update is not only install something, but also upgrade package version.
I want to restore the system back.

jsbjsb001 01-12-2018 08:02 AM

Quote:

Originally Posted by sterry0101 (Post 5805442)
Hi jsbjsb001!
Thank you for your reply first.
Do you mean to roll back and restore your system back to the way it was before you updated it?<----yes!!
As you know that yum update is not only install something, but also upgrade package version.
I want to restore the system back.

As far as I can see, the only option that would come close is the downgrade option for yum.

Which will (as it suggests) downgrade packages.

sterry0101 01-12-2018 08:45 AM

Yes. If just need to handle a few packages, yum downgrade can be used.
But how about handling 500 package?
It is hard to downgrade the package one by one. And those old version may not found in the internet.

jsbjsb001 01-12-2018 09:03 AM

Quote:

Originally Posted by sterry0101 (Post 5805455)
Yes. If just need to handle a few packages, yum downgrade can be used.
But how about handling 500 package?
It is hard to downgrade the package one by one. And those old version may not found in the internet.

Yeah, you're right... it does not look easy. The only thing I can suggest in that case is to have a look at the following:

https://access.redhat.com/solutions/64069
https://www.cyberciti.biz/faq/howto-...entific-linux/ - a little dated, but should still work.

You should also backup your system before installing updates. I'm glad I did, to cut a long story short.

(I've never tried to downgrade 500 different packages before myself - that's why I do backups beforehand)

Hint: The yum history command is what your looking for.

sterry0101 01-12-2018 09:16 AM

Yes. I read these website before. But i found that it cannot completely rollback to original system.
Just what i said before,
Before yum update
#rpm -qa >> test.1
after yum update
# yum history rollback last-1 (or yum history undo [the last transaction])
# rpm -qa >> test.2
# diff test.1 test.2
They are not completely same.

Have you tried these command before?

jsbjsb001 01-12-2018 09:23 AM

Quote:

Originally Posted by sterry0101 (Post 5805479)
Yes. I read these website before. But i found that it cannot completely rollback to original system.
Just what i said before,
Before yum update
#rpm -qa >> test.1
after yum update
# yum history rollback last-1 (or yum history undo [the last transaction])
# rpm -qa >> test.2
# diff test.1 test.2
They are not completely same.

Have you tried these command before?

I am using CentOS 7.3 myself and have used the yum and rpm commands many times, but once again I've never even tried to "roll back" the whole system before. So if that's what you mean, well... no.

The best option in your case maybe to backup all data you want to keep and do a clean install instead.

This is my system:

Code:

NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"


sterry0101 01-12-2018 09:55 AM

Um.. can i ask... is there any command that can repackage installed package as rpm?

jsbjsb001 01-12-2018 09:58 AM

Quote:

Originally Posted by sterry0101 (Post 5805505)
Um.. can i ask... is there any command that can repackage installed package as rpm?

I'm not clear about what your asking here? What exactly do you mean?

sterry0101 01-12-2018 10:26 AM

if we # rpm -qa , we saw lots of package. Can we generate a rpm for one of package?

jsbjsb001 01-12-2018 10:32 AM

Quote:

Originally Posted by sterry0101 (Post 5805528)
if we # rpm -qa , we saw lots of package. Can we generate a rpm for one of package?

If I'm understanding you correctly, I believe the answer is no.

Code:

[root@localhost ~]# rpm --help
Usage: rpm [OPTION...]

Query/Verify package selection options:
  -a, --all                        query/verify all packages
  -f, --file                      query/verify package(s) owning file
  -g, --group                      query/verify package(s) in group
  -p, --package                    query/verify a package file
  --pkgid                          query/verify package(s) with package identifier
  --hdrid                          query/verify package(s) with header identifier
  --triggeredby                    query the package(s) triggered by the package
  --whatrequires                  query/verify the package(s) which require a dependency
  --whatprovides                  query/verify the package(s) which provide a dependency
  --nomanifest                    do not process non-package files as manifests

Query options (with -q or --query):
  -c, --configfiles                list all configuration files
  -d, --docfiles                  list all documentation files
  -L, --licensefiles              list all license files
  --dump                          dump basic file information
  -l, --list                      list files in package
  --queryformat=QUERYFORMAT        use the following query format
  -s, --state                      display the states of the listed files
...

The options you've specified in are bold.

sterry0101 01-12-2018 10:35 AM

OK. Then is there any command can do that? Maybe no?

jsbjsb001 01-12-2018 10:39 AM

Quote:

Originally Posted by sterry0101 (Post 5805534)
OK. Then is there any command can do that? Maybe no?

You can build your own RPM packages if you want, but you would need to install the following command, to do it:

Code:

[james@localhost ~]$ rpmbuild --help
Usage: rpmbuild [OPTION...]

Build options with [ <specfile> | <tarball> | <source package> ]:
  -bp                          build through %prep (unpack sources and apply patches) from <specfile>
  -bc                          build through %build (%prep, then compile) from <specfile>
  -bi                          build through %install (%prep, %build, then install) from <specfile>
  -bl                          verify %files section from <specfile>
  -ba                          build source and binary packages from <specfile>
  -bb                          build binary package only from <specfile>
  -bs                          build source package only from <specfile>
  -tp                          build through %prep (unpack sources and apply patches) from <tarball>
  -tc                          build through %build (%prep, then compile) from <tarball>
  -ti                          build through %install (%prep, %build, then install) from <tarball>
  -ta                          build source and binary packages from <tarball>
  -tb                          build binary package only from <tarball>
  -ts                          build source package only from <tarball>
  --rebuild                    build binary package from <source package>
  --recompile                  build through %install (%prep, %build, then install) from <source package>
  --buildroot=DIRECTORY        override build root
  --clean                      remove build tree when done
  --nobuild                    do not execute any stages of the build
  --nodeps                      do not verify build dependencies
  --nodirtokens                generate package header(s) compatible with (legacy) rpm v3 packaging
  --noclean                    do not execute %clean stage of the build
  --nocheck                    do not execute %check stage of the build
  --rmsource                    remove sources when done
  --rmspec                      remove specfile when done
  --short-circuit              skip straight to specified stage (only for c,i)
  --target=CPU-VENDOR-OS        override target platform
...

Code:

Installed Packages
Name        : rpm-build
Arch        : x86_64
Version    : 4.11.3
Release    : 21.el7
Size        : 320 k
Repo        : installed
From repo  : anaconda
Summary    : Scripts and executable programs used to build packages
URL        : http://www.rpm.org/
License    : GPLv2+
Description : The rpm-build package contains the scripts and executable programs
            : that are used to build packages using the RPM Package Manager.

You should not need to add any extra repo's to your repo list, if your using CentOS.

sterry0101 01-12-2018 10:49 AM

OK! Thank you so much!!


All times are GMT -5. The time now is 06:37 AM.