Linux – yum history

Loading

測試環境為 CentOS 8 x86_64 (虛擬機)

有一次 yum update 到一半,系統掛點連帶著 yum 也沒完成,系統也無法再使用 yum update .

需要透過 yum history 來檢視目前 yum 的歷史狀態.

[root@localhost ~]# yum history
ID     | 指令列                                                         | 日期與時間       | 動作           | 已變動 
---------------------------------------------------------------------------------------------------------------------
    23 | update                                                         | 2021-05-07 06:22 | O, U           |   63 >#
    22 | update                                                         | 2021-04-27 16:29 | E, I, U        |  168 EE
    21 | install langpacks-en glibc-all-langpacks -y                    | 2021-04-27 16:27 | I, U           |    4   
    20 | update                                                         | 2021-03-25 22:13 | E, I, U        |   57   
    19 | update                                                         | 2021-03-04 18:17 | I, U           |  127 EE
    18 | update                                                         | 2021-02-17 06:23 | Upgrade        |  114 EE
    17 | update                                                         | 2021-02-09 18:28 | E, I, U        |  326 EE
    16 | update                                                         | 2021-01-11 23:14 | E, I, U        |  228 EE
    15 | update                                                         | 2020-12-08 21:58 | I, U           |  232 EE
    14 | update                                                         | 2020-11-16 04:44 | I, O, U        |   73   
    13 | update                                                         | 2020-10-22 00:08 | E, I, O, U     |  124   
    12 | update                                                         | 2020-09-07 22:33 | Upgrade        |    3   
    11 | update                                                         | 2020-09-03 18:54 | E, I, U        |  409   
    10 | update                                                         | 2020-07-07 22:50 | E, I, O, U     |  414 EE
     9 | update                                                         | 2020-06-04 22:47 | E, I, O, U     |  542 EE
     8 | update                                                         | 2020-04-01 22:53 | E, I, U        |   46   
     7 | update                                                         | 2020-03-04 21:51 | E, I, U        |   16   
     6 | update                                                         | 2020-02-16 01:29 | E, I, U        |  130   
     5 | update                                                         | 2020-01-16 00:23 | E, I, U        |  112 EE
     4 | install -y centos-release-stream                               | 2020-01-16 00:13 | Install        |    1   
     3 | update --enablerepo=cr                                         | 2020-01-15 19:46 | I, O, U        |  553   
     2 | update                                                         | 2019-11-01 18:17 | I, U           |  172 EE
     1 |                                                                | 2019-11-01 17:52 | Install        | 1320 EE

或是指定 ID.

[root@localhost ~]# yum history 23
ID     | 指令列                                                        | 日期與時間       | 動作           | 已變動 
--------------------------------------------------------------------------------------------------------------------
    23 | update                                                        | 2021-05-07 06:22 | O, U           |   63 ##

我們來看一下 Action(s) (動作) 與 Altered (已變動) 的英文字母個代表什麼意思 , 參考文章 – https://www.cyberciti.biz/faq/yum-history-command/

  • ID – Transaction number.
  • Action(s) (動作) – A list of actions that were performed during a transaction as follows:
    • D or Downgrade – Package has been downgraded to an older version.
    • E or Erase – Package has been removed.
    • I or Install – New package has been installed.
    • O or Obsoleting – Package has been marked as obsolete.
    • R or Reinstall – Package has been reinstalled.
    • U or Update – Package has been updated to a newer version.
  • Altered (已變動) – The number of packages that were affected by a yum, as follows:
    • *lt; – Before the transaction finished, the rpmdb database was changed outside yum.
    • > – After the transaction finished, the rpmdb database was changed outside yum.
    • * – The transaction failed to finish.
    • # – The transaction finished successfully, but yum returned a non-zero exit code.
    • E – The transaction finished successfully, but an error or a warning was displayed.
    • P – The transaction finished successfully, but problems already existed in the rpmdb database.
    • s – The transaction finished successfully, but the –skip-broken command line option was used and certain packages were skipped.

通常 undo 或是 redo 就可以解決了.

[root@localhost ~]# yum history undo 23
[root@localhost ~]# yum history redo 23
沒有解決問題,試試搜尋本站其他內容

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料