solved : RPMDB altered outside of yum

2014-01-21 RPMDB altered outside of yum

在使用yum的时候报的错误,解决方法为:

yum history sync

主要是将我们rpmdbyumdb进行同步一下,注意,这个过程根据你的机器情况和安装软件包的数量可能会小小的需要一段时间。

 

Refer

https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/7-Beta/html/System_Administrators_Guide/sect-Yum-Transaction_History.html

 

5.4. Working with Transaction History

The yum history command allows users to review information about a timeline of Yum transactions, the dates and times they occurred, the number of packages affected, whether transactions succeeded or were aborted, and if the RPM database was changed between transactions. Additionally, this command can be used to undo or redo certain transactions. All history data are stored in the history DB in the var/lib/yum/history/ directory.

5.4.1. Listing Transactions

To display a list of twenty most recent transactions, as root, either run yum history with no additional arguments, or type the following at a shell prompt:

yum history list

To display all transactions, add the all keyword:

yum history list all

To display only transactions in a given range, use the command in the following form:

yum history list start_id..end_id

You can also list only transactions regarding a particular package or packages. To do so, use the command with a package name or a glob expression:

yum history list glob_expression…

Example 5.18. Listing the five oldest transactions

 

In the output of yum history list, the most recent transaction is displayed at the top of the list. To display information about the five oldest transactions stored in the history data base, type:

~]# yum history list 1..5

Loaded plugins: product-id, refresh-packagekit, subscription-manager

ID     | Login user               | Date and time    | Action(s)      | Altered

——————————————————————————-

     5 | Jaromir … <jhradilek>  | 2013-07-29 15:33 | Install        |    1

     4 | Jaromir … <jhradilek>  | 2013-07-21 15:10 | Install        |    1

     3 | Jaromir … <jhradilek>  | 2013-07-16 15:27 | I, U           |   73

     2 | System <unset>           | 2013-07-16 15:19 | Update         |    1

     1 | System <unset>           | 2013-07-16 14:38 | Install        | 1106

history list

 

All forms of the yum history list command produce tabular output with each row consisting of the following columns:

ID — an integer value that identifies a particular transaction.

Login user — the name of the user whose login session was used to initiate a transaction. This information is typically presented in the Full Name <username> form. For transactions that were not issued by a user (such as an automatic system update), System <unset> is used instead.

Date and time — the date and time when a transaction was issued.

Action(s) — a list of actions that were performed during a transaction as described in Table 5.1, “Possible values of the Action(s) field”.

Altered — the number of packages that were affected by a transaction, possibly followed by additional information as described in Table 5.2, “Possible values of the Altered field”.

Table 5.1. Possible values of the Action(s) field

 

Action   Abbreviation   Description

Downgrade D    At least one package has been downgraded to an older version.

Erase    E     At least one package has been removed.

Install    I      At least one new package has been installed.

Obsoleting  O    At least one package has been marked as obsolete.

Reinstall      R     At least one package has been reinstalled.

Update U    At least one package has been updated to a newer version.

 

Table 5.2. Possible values of the Altered field

 

Symbol Description

<     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.

 

To synchronize the rpmdb or yumdb database contents for any installed package with the currently used rpmdb or yumdb database, type the following:

yum history sync

To display some overall statistics about the currently used history DB use the following command:

yum history stats

Example 5.19. Example output of yum history stats

 

~]# yum history stats

Loaded plugins: langpacks, presto, refresh-packagekit

File        : //var/lib/yum/history/history-2012-08-15.sqlite

Size        : 2,766,848

Transactions: 41

Begin time  : Wed Aug 15 16:18:25 2012

End time    : Wed Feb 27 14:52:30 2013

Counts      :

  NEVRAC :  2,204

  NEVRA  :  2,204

  NA     :  1,759

  NEVR   :  2,204

  rpm DB :  2,204

  yum DB :  2,204

history stats

 

Yum also allows you to display a summary of all past transactions. To do so, run the command in the following form as root:

yum history summary

To display only transactions in a given range, type:

yum history summary start_id..end_id

Similarly to the yum history list command, you can also display a summary of transactions regarding a certain package or packages by supplying a package name or a glob expression:

yum history summary glob_expression…

Example 5.20. Summary of the five latest transactions

 

~]# yum history summary 1..5

Loaded plugins: product-id, refresh-packagekit, subscription-manager

Login user                 | Time                | Action(s)        | Altered

——————————————————————————-

Jaromir … <jhradilek>    | Last day            | Install          |        1

Jaromir … <jhradilek>    | Last week           | Install          |        1

Jaromir … <jhradilek>    | Last 2 weeks        | I, U             |       73

System <unset>             | Last 2 weeks        | I, U             |     1107

history summary

 

All forms of the yum history summary command produce simplified tabular output similar to the output of yum history list.

As shown above, both yum history list and yum history summary are oriented towards transactions, and although they allow you to display only transactions related to a given package or packages, they lack important details, such as package versions. To list transactions from the perspective of a package, run the following command as root:

yum history package-list glob_expression…

Example 5.21. Tracing the history of a package

 

For example, to trace the history of subscription-manager and related packages, type the following at a shell prompt:

~]# yum history package-list subscription-manager\*

Loaded plugins: product-id, refresh-packagekit, subscription-manager

ID     | Action(s)      | Package

——————————————————————————-

     3 | Updated        | subscription-manager-0.95.11-1.el6.x86_64

     3 | Update         |                      0.95.17-1.el6_1.x86_64

     3 | Updated        | subscription-manager-firstboot-0.95.11-1.el6.x86_64

     3 | Update         |                                0.95.17-1.el6_1.x86_64

     3 | Updated        | subscription-manager-gnome-0.95.11-1.el6.x86_64

     3 | Update         |                            0.95.17-1.el6_1.x86_64

     1 | Install        | subscription-manager-0.95.11-1.el6.x86_64

     1 | Install        | subscription-manager-firstboot-0.95.11-1.el6.x86_64

     1 | Install        | subscription-manager-gnome-0.95.11-1.el6.x86_64

history package-list

In this example, three packages were installed during the initial system installation: subscription-manager, subscription-manager-firstboot, and subscription-manager-gnome. In the third transaction, all these packages were updated from version 0.95.11 to version 0.95.17.

 

5.4.2. Examining Transactions

To display the summary of a single transaction, as root, use the yum history summary command in the following form:

yum history summary id

To examine a particular transaction or transactions in more detail, run the following command as root:

yum history info id…

The id argument is optional and when you omit it, yum automatically uses the last transaction. Note that when specifying more than one transaction, you can also use a range:

yum history info start_id..end_id

Example 5.22. Example output of yum history info

 

The following is sample output for two transactions, each installing one new package:

~]# yum history info 4..5

Loaded plugins: product-id, refresh-packagekit, subscription-manager

Transaction ID : 4..5

Begin time     : Thu Jul 21 15:10:46 2011

Begin rpmdb    : 1107:0c67c32219c199f92ed8da7572b4c6df64eacd3a

End time       :            15:33:15 2011 (22 minutes)

End rpmdb      : 1109:1171025bd9b6b5f8db30d063598f590f1c1f3242

User           : Jaromir Hradilek <jhradilek>

Return-Code    : Success

Command Line   : install screen

Command Line   : install yum-plugin-fs-snapshot

Transaction performed with:

    Installed     rpm-4.8.0-16.el6.x86_64

    Installed     yum-3.2.29-17.el6.noarch

    Installed     yum-metadata-parser-1.1.2-16.el6.x86_64

Packages Altered:

    Install screen-4.0.3-16.el6.x86_64

    Install yum-plugin-fs-snapshot-1.1.30-6.el6.noarch

history info

 

You can also view additional information, such as what configuration options were used at the time of the transaction, or from what repository and why were certain packages installed. To determine what additional information is available for a certain transaction, type the following at a shell prompt as root:

yum history addon-info id

Similarly to yum history info, when no id is provided, yum automatically uses the latest transaction. Another way to refer to the latest transaction is to use the last keyword:

yum history addon-info last

Example 5.23. Example output of yum history addon-info

 

For the fourth transaction in the history, the yum history addon-info command provides the following output:

~]# yum history addon-info 4

Loaded plugins: product-id, refresh-packagekit, subscription-manager

Transaction ID: 4

Available additional history information:

  config-main

  config-repos

  saved_tx

 

history addon-info

 

In the output of the yum history addon-info command, three types of information are available:

config-main — global Yum options that were in use during the transaction. Refer to Section 5.5.1, “Setting [main] Options” for information on how to change global options.

config-repos — options for individual Yum repositories. Refer to Section 5.5.2, “Setting [repository] Options” for information on how to change options for individual repositories.

saved_tx — the data that can be used by the yum load-transaction command in order to repeat the transaction on another machine (see below).

To display selected type of additional information, run the following command as root:

yum history addon-info id information

5.4.3. Reverting and Repeating Transactions

Apart from reviewing the transaction history, the yum history command provides means to revert or repeat a selected transaction. To revert a transaction, type the following at a shell prompt as root:

yum history undo id

To repeat a particular transaction, as root, run the following command:

yum history redo id

Both commands also accept the last keyword to undo or repeat the latest transaction.

Note that both yum history undo and yum history redo commands only revert or repeat the steps that were performed during a transaction. If the transaction installed a new package, the yum history undo command will uninstall it, and if the transaction uninstalled a package the command will again install it. This command also attempts to downgrade all updated packages to their previous version, if these older packages are still available. If you need to restore the system to the state before an update, consider using the fs-snapshot plug-in described in Section 5.6.3, “Working with Plug-ins”.

When managing several identical systems, Yum also allows you to perform a transaction on one of them, store the transaction details in a file, and after a period of testing, repeat the same transaction on the remaining systems as well. To store the transaction details to a file, type the following at a shell prompt as root:

yum -q history addon-info id saved_tx > file_name

Once you copy this file to the target system, you can repeat the transaction by using the following command as root:

yum load-transaction file_name

You can configure load-transaction to ignore missing packages or rpmdb version. For more information on these configuration options see the yum.conf man page.

5.4.4. 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.

rpm or yum error: %preun( ) scriptlet failed, exit status 1

rpm删除出现”error: %preun( ) scriptlet failed, exit status 1解决方法

 

今天删除软件的时候报了下面的这个错误:

错误提示是:error: %preun(xxxxxx) scriptlet failed, exit status 1

 

最后在网上找到一个办法,就是加noscripts 标记来删除RPMnoscripts 相当于 -nopre -nopost  -nopreun -nopostun

即卸载命令变为:

$rpm -e –noscripts xxxxxx

若要查看与RPM关联的scripts,使用-script查询RPM包。

rpm -q -scripts package

卸载时,若系统里有同一程序的多个安装版本要一起删除,可使用-allmatches标记,如

rpm -e –noscripts -allmatches xxxxxx

the using of package-cleanup

package-cleanup的使用

clip_image001

以前对于多余的内核,都是rpm-grep-remove你懂的,这次发现了这个软件包。神呐,节省了很多时间,只需要package-cleanup –oldkernels就可以把就内核(对于版本升级而言)删除,加上–count参数就可以指定留下几个grub选项,注意最好轻易不要设定1,除非你确定刚升级好的内核是OK的,默认值是2,即会保存前一个内核。

 

package-cleanup 用于清理本地安装的RPM软件包

注意:这是一个只对RPM有用的工具,Ubuntu 之类的无法使用。

Fedora系统中package-cleanup是默认安装的,而且manpage也比较好懂,这里挑出几个命令来解释一下。

命令格式:

package-cleanup [options] <item …>

 

1. 列出与其他RPM没有依赖关系的软件包,又叫叶节点(leaf node),即,没有软件包依赖叶节点。

$ package-cleanup –leaves

libacl-devel-2.2.49-8.fc14.i686
libcap-devel-2.17-1.fc13.i686
libchamplain-gtk-0.6.1-4.fc14.i686
libcurl-devel-7.21.0-5.fc14.i686
libdbi-dbd-mysql-0.8.3-6.fc14.i686
libertas-usb8388-firmware-5.110.22.p23-4.fc13.noarch
libgail-gnome-1.20.3-1.fc14.i686
libgtop2-devel-2.28.2-1.fc14.i686
libidn-devel-1.18-1.fc14.i686
libiodbc-3.52.7-1.fc12.i686

可以看到,列出的都是一些函数库,这些库函数没有被其他程序用到。

2. 列出当前软件仓库中不再提供支持的本地已安装的软件包。也就是说,列出的软件包将不会再升级。

$ package-cleanup –orphans

alchemist-1.0.37-8.fc12.i686
antlr-2.7.7-6.fc12.i686
kernel-2.6.34.7-61.fc13.i686
kernel-devel-2.6.34.7-61.fc13.i686
kmod-nvidia-2.6.34.7-61.fc13.i686-260.19.12-1.fc13.1.i686
schroedinger-1.0.10-1.fc13.i686
system-config-display-2.2-1.fc12.i686
xorg-x11-drv-wacom-0.10.8-2.fc13.i686

3. 删除旧内核文件(kernel, kernel-devel)。

$ package-cleanup –oldkernels

前面一篇文章提到过如何手工删除旧内核文件,这条命令就可以解决了。

可以用参数–count <COUNT>指定要保留的内核个数,默认是2

可以用参数 “–keepdevel” 指定不要删除 kernel-devel

例如:

$ package-cleanup –oldkernels –count=3 –keepdevel

含义是:保留最近3个内核文件和kernel-devel文件,并删除其余的kernels

4. 列出有依赖问题的软件包。

$ package-cleanup –problems

Package alchemist-1.0.37-8.fc12.i686 requires python(abi) = (’0, 2.6, None)
Package alchemist-1.0.37-8.fc12.i686 requires python-abi = (’0
, 2.6
, None)
Package system-config-display-2.2-1.fc12.i686 requires libpython2.6.so.1.0
Package system-config-display-2.2-1.fc12.i686 requires python(abi) = (
0
, 2.6
, None)

我的运行结果显示有些软件包需要python 2.6的支持,Fedora 14已经默认安装python 2.7

5. 扫描重复安装的RPM软件包。

$ package-cleanup –dupes

6. 扫描重复安装的软件包,并删除老版本的软件包。

$ package-cleanup –cleandupes

 

No manual entry for printf in section 3

No manual entry for printf in section 3

Fedora && Ubuntu 安装manual

clip_image001

Fedora

用虚拟机装好fedora 19之后,竟然查阅不到,

直接yum install man-pages即可解决。

Ubuntu

网上看到说是安装manpages-dev即可。

亮点

clip_image002

现在fedora19grouplist多了好几个比较好的包,比如:

GNOME Desktop

   KDE Plasma Workspaces

   Xfce Desktop

   LXDE Desktop

   Cinnamon Desktop

   MATE Desktop

   Sugar Desktop Environment

   Development and Creative Workstation

   Web Server

   Infrastructure Server

   Basic Desktop

   Minimal Install

   C Development Tools and Libraries

   Development Tools

   LibreOffice

   RPM Development Tools

   System Tools

   3D Printing

   Administration Tools

   Authoring and Publishing

   Books and Guides

   Cloud Infrastructure

   Design Suite

   Editors

   Educational Software

   Electronic Lab

   Engineering and Scientific

   Fedora Eclipse

   Games and Entertainment

   Medical Applications

   Milkymist

   Network Servers

   Office/Productivity

   Robotics

   Security Lab

   Sound and Video

   Text-based Internet

   Window Managers

特别是上面的C开发和开发工具,偶觉得都是亮点。