LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-26-2011, 10:41 AM   #1
veeruk101
Member
 
Registered: Mar 2005
Distribution: Ubuntu 12.04 LTS
Posts: 249

Rep: Reputation: 16
Question for experienced yum users about 'yum downgrade'


Let's say I have a server that's running fine, and I decide to do a 'sudo yum update' to get the latest updates. The output is as follows:

Code:
--> Running transaction check
---> Package feh.i686 0:1.16.1-1.el6.rf will be updated
---> Package feh.i686 0:2.0-1.el6.rf will be an update
---> Package libmemcached.i686 0:0.52-1.el6.remi will be updated
---> Package libmemcached.i686 0:0.53-1.el6.remi will be an update
---> Package libmemcached-devel.i686 0:0.52-1.el6.remi will be updated
---> Package libmemcached-devel.i686 0:0.53-1.el6.remi will be an update
---> Package mysql.i686 0:5.5.14-1.el6.remi will be updated
---> Package mysql.i686 0:5.5.17-1.el6.remi will be an update
---> Package mysql-devel.i686 0:5.5.14-1.el6.remi will be updated
---> Package mysql-devel.i686 0:5.5.17-1.el6.remi will be an update
---> Package mysql-libs.i686 0:5.5.14-1.el6.remi will be updated
---> Package mysql-libs.i686 0:5.5.17-1.el6.remi will be an update
---> Package mysql-server.i686 0:5.5.14-1.el6.remi will be updated
---> Package mysql-server.i686 0:5.5.17-1.el6.remi will be an update
---> Package php-pear.noarch 1:1.9.4-1.el6.remi will be updated
---> Package php-pear.noarch 1:1.9.4-3.el6.remi will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
 Package                                    Arch                           Version                                    Repository                        Size
=============================================================================================================================================================
Updating:
 feh                                        i686                           2.0-1.el6.rf                               rpmforge                         169 k
 libmemcached                               i686                           0.53-1.el6.remi                            remi                             163 k
 libmemcached-devel                         i686                           0.53-1.el6.remi                            remi                             255 k
 mysql                                      i686                           5.5.17-1.el6.remi                          remi                             5.8 M
 mysql-devel                                i686                           5.5.17-1.el6.remi                          remi                             152 k
 mysql-libs                                 i686                           5.5.17-1.el6.remi                          remi                             758 k
 mysql-server                               i686                           5.5.17-1.el6.remi                          remi                              10 M
 php-pear                                   noarch                         1:1.9.4-3.el6.remi                         remi                             394 k
Now let's I apply the above changes, and say something stops working or I encounter problems, and I suspect it has something to do with these updates. What would be the best way for me to roll back the group of all of the above changes to their previous state - I know there's a 'yum downgrade' command, but would I have to note all of the above packages by hand, and do 'yum downgrade feh libmemcached libmemcached-devel mysql mysql-devel mysql-libs mysql-server php-pear', or is there a better way?

Now I have some specific questions about yum downgrade. I'd experiment with it but since I only have a new system that hasn't had the chance for many upgrades, I can't seem to test too much downgrading stuff myself, so I thought I'd ask some questions to people like you who may have had plenty of experience upgrading/downgrading and otherwise managing packages in their system.

Let's say a repository has versions A of a package, then releases version B. You install version B of the package for the first time on your system. Then the repository releases version C (which you do NOT upgrade to), then version D (which you DO upgrade to). Then again the repository releases version E (which you do NOT upgrade to), then version F (which you DO upgrade to). So the repository now has versions A, B, C, D, E, F, but you only ever had installed on your system versions B, D, F. Version F is currently on your system. If at this point you run 'yum downgrade', which of the following will you be offered as options for versions you can downgrade to:
- D (because it was the last version you had)
- E (because it was the last version the repository had)
- B and D (because they were all the lower versions you had)
- A, B, C, D and E (because they were all the lower versions the repository had)
- B, C, D and E (because they were all the lower versions the repository had after you first installed the package at version B)

If running a production server I'd be afraid to do yum updates without having a reliable and repeatable way to roll them back, either immediately or more likely a few days/weeks after when any problem is likely to make itself known. So I'd like to know the details about how it works.
 
Old 10-26-2011, 11:56 AM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
To roll back the last update:
Code:
yum history undo last
To select the update to rollback, for example:
Code:
# yum history
Loaded plugins: downloadonly, fastestmirror, langpacks, presto, refresh-packagekit
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
  1377 | Mace Moneta <mmoneta>    | 2011-10-26 08:28 | Update         |    1
  1376 | root <root>              | 2011-10-26 05:02 | Update         |    1 EE
  1375 | root <root>              | 2011-10-25 05:01 | Update         |   19  <
  1374 | Mace Moneta <mmoneta>    | 2011-10-24 22:30 | E, I, U        |    7 >
  1373 | root <root>              | 2011-10-24 05:01 | Update         |    1
  1372 | System <unset>           | 2011-10-23 18:26 | Install        |    1
  1371 | Mace Moneta <mmoneta>    | 2011-10-23 18:21 | Install        |    1
  1370 | Mace Moneta <mmoneta>    | 2011-10-23 18:17 | Erase          |    1
  1369 | Mace Moneta <mmoneta>    | 2011-10-23 18:16 | Install        |    1  <
  1368 | Mace Moneta <mmoneta>    | 2011-10-22 23:38 | I, U           |    2 >
  1367 | Mace Moneta <mmoneta>    | 2011-10-22 23:33 | Update         |    6 ss
  1366 | Mace Moneta <mmoneta>    | 2011-10-21 21:59 | E, I, U        |    6 s<
  1365 | root <root>              | 2011-10-21 05:02 | Update         |   12 ><
  1364 | Mace Moneta <mmoneta>    | 2011-10-19 22:05 | E, I, U        |    7 >
  1363 | root <root>              | 2011-10-19 05:03 | I, U           |   34 EE
  1362 | Mace Moneta <mmoneta>    | 2011-10-17 23:40 | Install        |    1   
  1361 | Mace Moneta <mmoneta>    | 2011-10-17 23:40 | Erase          |    1   
  1360 | Mace Moneta <mmoneta>    | 2011-10-17 23:29 | Install        |    1   
  1359 | Mace Moneta <mmoneta>    | 2011-10-17 23:26 | Install        |    1   
  1358 | System <unset>           | 2011-10-17 17:07 | Install        |    1
Get information on the transaction:

Code:
# yum history info 1375
Loaded plugins: downloadonly, fastestmirror, langpacks, presto, refresh-packagekit
Transaction ID : 1375
Begin time     : Tue Oct 25 05:01:48 2011
Begin rpmdb    : 3014:f52b3f3b740dfbcc50390bea8c924159439040a4
End time       :            05:02:33 2011 (45 seconds)
End rpmdb      : 3014:5934110424c18db7b8e90e9b1f655825bca6ad6b
User           : root <root>
Return-Code    : Success
Command Line   : -y update
Transaction performed with:
    Installed     rpm-4.9.1.2-1.fc15.x86_64
    Installed     yum-3.2.29-9.fc15.noarch
    Installed     yum-metadata-parser-1.1.4-4.fc15.x86_64
    Installed     yum-plugin-fastestmirror-1.1.31-2.fc15.noarch
    Installed     yum-presto-0.6.2-3.fc15.noarch
Packages Altered:
    Updated dcraw-9.10-1.fc15.x86_64
    Update        9.11-1.fc15.x86_64
    Updated kdelibs3-3.5.10-25.fc15.x86_64
...
Rollback the transaction:

Code:
# yum history undo 1375 
...
Undoing transaction 1375, from Tue Oct 25 05:01:48 2011
    Updated dcraw-9.10-1.fc15.x86_64   
    Update        9.11-1.fc15.x86_64   
    Updated kdelibs3-3.5.10-25.fc15.x86_64
...

Last edited by macemoneta; 10-26-2011 at 12:00 PM.
 
Old 10-27-2011, 01:42 PM   #3
veeruk101
Member
 
Registered: Mar 2005
Distribution: Ubuntu 12.04 LTS
Posts: 249

Original Poster
Rep: Reputation: 16
Actually is this history command only available in certain versions? On my CentOS 6 there's yum 3.2.29 which has the command, but on my CentOS 5.6 there's yum 3.2.22 which doesn't have the command. Running yum update on the latter only updates the release of 3.2.22.
 
Old 10-27-2011, 01:53 PM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Yum with the history functionality was released in 2009 with version 3.2.25. Server OS, like CentOS run older software for stability. In general you can pull the newer software, but it may have too many dependencies.
 
Old 10-29-2011, 08:33 PM   #5
veeruk101
Member
 
Registered: Mar 2005
Distribution: Ubuntu 12.04 LTS
Posts: 249

Original Poster
Rep: Reputation: 16
Something weird just happened. I tried running 'sudo yum history' and got the following output:

Code:
Loaded plugins: fastestmirror, refresh-packagekit
No transactions
Error: Failed history list
Whereas a couple of days ago I got a list of yum transactions with IDs going up to 49. So I ran 'sudo yum update' and then got the following output, which is surprising because there's only 1 item and it has an ID of 1. What happened to all the other records I saw just a couple of days ago?

Code:
Loaded plugins: fastestmirror, refresh-packagekit
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     1 | User <user>            | 2011-10-30 01:13 | Update         |   21 EE
history list
In the yum update I just did, yum was updated to yum.noarch 0:3.2.29-17.el6.centos.1, could that have something to do with it? I doubt it, because I was getting the 'Failed history list' error before I updated the package. What could I possibly have done to erase the history here? This could be a problem in a production environment for me if I wanted to roll back a set of updates only to find I'd somehow erased the history. I'm surprised it's not an append-only kind of history...

Last edited by veeruk101; 10-29-2011 at 08:53 PM.
 
Old 10-29-2011, 08:51 PM   #6
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
It sounds like someone ran:

Code:
yum history new
From the documentation:

Quote:
Starting New Transaction History
Yum stores the transaction history in a single SQLite database file. To start new transaction history, run the following command as root:

yum history new

This will create a new, empty database file in the /var/lib/yum/history/ directory. The old transaction history will be kept, but will not be accessible as long as a newer database file is present in the directory.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
yum install flash ... yum: command not found ... which yum ... /usr/bin/yum tg0000 Fedora 8 04-13-2011 11:25 AM
how to update rhel 5 using centos yum updater without conflict with yum redhat plugin udayvikram Linux - Newbie 1 03-29-2010 12:56 PM
yum question: How to update from backed up yum cache? Arodef Linux - Software 2 02-02-2010 11:42 PM
problem after yum yum yum (delicious) alaios Fedora 3 01-14-2009 02:34 AM
yum config error parsing file failed - yum won't run emuub Linux - Software 9 11-04-2008 05:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration