rpm-software-management / rpm

The RPM package manager
http://rpm.org
Other
511 stars 370 forks source link

when rebuilding rpmdb database gets inconsistent when installing at the same time #1761

Open oliverkurth opened 3 years ago

oliverkurth commented 3 years ago

There seems to be a race when locking the db using rpm --rebuilddb. If a package gets installed at the same time, the database gets inconsistent. To reproduce:

In one shell, continuously rebuild the db: while true; do echo "start"; rpm --rebuilddb; echo "done" ; done

In another shell, install an arbitrary package. There is no error:

[root@localhost ~]# rpm -Uv ./lsof-4.93.2-4.fc33.aarch64.rpm 
warning: waiting for transaction lock on /var/lib/rpm/.rpm.lock
Verifying packages...
Preparing packages...
lsof-4.93.2-4.fc33.aarch64
[root@localhost ~]#

Then check for it:

[root@localhost ~]# rpm -qi lsof
package lsof is not installed
[root@localhost ~]#

However, the bits are all there:

[root@localhost ~]# lsof -v
lsof version information:
    revision: 4.93.2
...

This behavior reproduces reliably. Version is:

[root@localhost ~]# rpm --version
RPM version 4.16.1.2
[root@localhost ~]# 

Above repro is on Fedora 33. I observe the same behavior in Photon 4.

pmatilai commented 3 years ago

Thanks for the report, we'll look into it.

hexiaowen commented 3 years ago

I have the same problem with rpmdb --rebuilddb and concurrent installation, upgrade, downgrade, and uninstallation of data inconsistencies.


rpm1="time-1.9-7.eulerosv2r9.x86_64.rpm"
rpm2="time-1.9-8.eulerosv2r10.x86_64.rpm"
rpm3="systemd-243-31.h30.eulerosv2r10.x86_64.rpm"

function loop_qurey() {
#    for i in $(seq 500); do
        while true;do
        echo "qurey rpm info $i"
        rpm -qa -v | grep time-1
        echo "[ivh] $rpm1"
        rpm -ivh "$rpm1"
        ls -l /etc/*/*/*-time-*
        echo "[uvh] $rpm2"
        rpm -Uvh "$rpm2"
        ls -l /etc/*/*/*-time-*
        echo "[dvh] $rpm1"
        rpm -Uvh "$rpm1" --oldpackage
        ls -l /etc/*/*/*-time-*
        echo "[erase] time"
        rpm -qi time
        rpm -e time
        ls -l /etc/*/*/*-time-*
        done
}
pmatilai commented 3 years ago

Yes, rpm does not currently handle concurrent db rebuild and other operations correctly, this would be an old, old bug.

However database rebuild is a maintenance/repair operation that you're only supposed to need once in every blue moon, not something that is run as a part of daily operations. Yes, the locking should prevent it, but if you're rebuilding the database concurrently with other operations then you're also doing something wrong.

hexiaowen commented 3 years ago

After the installation, upgrade, or downgrade is complete, run the rpm -qi command to query the value. The value should be time-1.9-7. In fact, a little time-1.9-7, a little time-1.9-8, that's weird.

+ echo 'qurey rpm info '
qurey rpm info
+ rpm -qa -v
+ grep time-1
+ echo '[ivh] time-1.9-7.eulerosv2r9.x86_64.rpm'
[ivh] time-1.9-7.eulerosv2r9.x86_64.rpm
+ rpm -vvv -ivh time-1.9-7.eulerosv2r9.x86_64.rpm
ufdio:       1 reads,    17908 total bytes in 0.000010 secs
ufdio:       1 reads,      881 total bytes in 0.000001 secs
ufdio:       1 reads,    17908 total bytes in 0.000008 secs
D: ============== time-1.9-7.eulerosv2r9.x86_64.rpm
D: loading keyring from pubkeys in /var/lib/rpm/pubkeys/*.key
D: couldn't find any keys in /var/lib/rpm/pubkeys/*.key
D: loading keyring from rpmdb
D: opening  db index       /var/lib/rpm/Packages.db mode=0x0
D: opening  db index       /var/lib/rpm/Index.db mode=0x0
D: opening  db index       Name tag=1000
D: opening  db index       Basenames tag=1117
D: opening  db index       Group tag=1016
D: opening  db index       Requirename tag=1049
D: opening  db index       Providename tag=1047
D: opening  db index       Conflictname tag=1054
D: opening  db index       Obsoletename tag=1090
D: opening  db index       Triggername tag=1066
D: opening  db index       Dirnames tag=1118
D: opening  db index       Installtid tag=1128
D: opening  db index       Sigmd5 tag=261
D: opening  db index       Sha1header tag=269
D: opening  db index       Filetriggername tag=5069
D: opening  db index       Transfiletriggername tag=5079
D: opening  db index       Recommendname tag=5046
D: opening  db index       Suggestname tag=5049
D: opening  db index       Supplementname tag=5052
D: opening  db index       Enhancename tag=5055
warning: time-1.9-7.eulerosv2r9.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
D: time-1.9-7.eulerosv2r9.x86_64.rpm: Header SHA1 digest: OK
ufdio:       5 reads,     4896 total bytes in 0.000005 secs
D: Plugin: calling hook init in ima plugin
D: Plugin: calling hook init in syslog plugin
D:      added binary package [0]
D: found 0 source and 1 binary packages
D: ========== +++ time-1.9-7.eulerosv2r9 x86_64/linux 0x2
D:  read h#     168
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:  Requires: libc.so.6()(64bit)                            YES (db provides)
D:  read h#     168
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:  Requires: libc.so.6(GLIBC_2.2.5)(64bit)                 YES (db provides)
D:  read h#     168
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:  Requires: libc.so.6(GLIBC_2.3.4)(64bit)                 YES (db provides)
D:  read h#     168
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:  Requires: libc.so.6(GLIBC_2.4)(64bit)                   YES (db provides)
D:  Requires: rpmlib(CompressedFileNames) <= 3.0.4-1        YES (rpmlib provides)
D:  Requires: rpmlib(FileDigests) <= 4.6.0-1                YES (rpmlib provides)
D:  Requires: rpmlib(PayloadFilesHavePrefix) <= 4.0-1       YES (rpmlib provides)
D:  Requires: rpmlib(PayloadIsXz) <= 5.2-1                  YES (rpmlib provides)
D:  read h#     168
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:  Requires: rtld(GNU_HASH)                                YES (db provides)
D: ========== recording tsort relations
D: ========== tsorting packages (order, #predecessors, #succesors, depth)
D:     0    0    0    1   +time-1.9-7.eulerosv2r9.x86_64
D: installing binary packages
D: closed   db index       Enhancename
D: closed   db index       Supplementname
D: closed   db index       Suggestname
D: closed   db index       Recommendname
D: closed   db index       Transfiletriggername
D: closed   db index       Filetriggername
D: closed   db index       Sha1header
D: closed   db index       Sigmd5
D: closed   db index       Installtid
D: closed   db index       Dirnames
D: closed   db index       Triggername
D: closed   db index       Obsoletename
D: closed   db index       Conflictname
D: closed   db index       Providename
D: closed   db index       Requirename
D: closed   db index       Group
D: closed   db index       Basenames
D: closed   db index       Name
D: closed   db index       /var/lib/rpm/Index.db
D: closed   db index       /var/lib/rpm/Packages.db
D: opening  db index       /var/lib/rpm/Packages.db mode=0x42
D: opening  db index       /var/lib/rpm/Index.db mode=0x42
D: opening  db index       Name tag=1000
D: opening  db index       Basenames tag=1117
D: opening  db index       Group tag=1016
D: opening  db index       Requirename tag=1049
D: opening  db index       Providename tag=1047
D: opening  db index       Conflictname tag=1054
D: opening  db index       Obsoletename tag=1090
D: opening  db index       Triggername tag=1066
D: opening  db index       Dirnames tag=1118
D: opening  db index       Installtid tag=1128
D: opening  db index       Sigmd5 tag=261
D: opening  db index       Sha1header tag=269
D: opening  db index       Filetriggername tag=5069
D: opening  db index       Transfiletriggername tag=5079
D: opening  db index       Recommendname tag=5046
D: opening  db index       Suggestname tag=5049
D: opening  db index       Supplementname tag=5052
D: opening  db index       Enhancename tag=5055
D: sanity checking 1 elements
Verifying...                          ufdio:       7 reads,    25048 total bytes in 0.000014 secs
################################# [100%]
D: Plugin: calling hook tsm_pre in selinux plugin
D: selabel_open: (/etc/selinux/targeted/contexts/files/file_contexts)
D: Plugin: calling hook tsm_pre in syslog plugin
D: running pre-transaction scripts
D: computing 7 file fingerprints
Preparing...                          D: computing file dispositions
D: 0x0000fd00     4096     10554154      2913511 /
################################# [100%]
D: ========== +++ time-1.9-7.eulerosv2r9 x86_64-linux 0x2
D: time-1.9-7.eulerosv2r9.x86_64: Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
D: time-1.9-7.eulerosv2r9.x86_64: Header SHA1 digest: OK
D:   install: time-1.9-7.eulerosv2r9.x86_64 has 7 files
D: Plugin: calling hook psm_pre in digest_list plugin
D: digest_list: IMA interface '/sys/kernel/security/ima/digest_list_data' not found, disabling plugin
D: Plugin: calling hook psm_pre in selinux plugin
Updating / installing...
   1:time-1.9-7.eulerosv2r9           D: ========== Directories not explicitly included in package:
D:          0 /etc/ima/digest_lists.sig/
D:          1 /etc/ima/digest_lists.tlv/
D:          2 /etc/ima/digest_lists/
D:          3 /usr/bin/
D:          4 /usr/share/licenses/
D: ==========
D: create     100400  1 (   0,   0)   521 /etc/ima/digest_lists.sig/0-metadata_list-compact-time-1.9-7.eulerosv2r9.x86_64.sig;6124e6c9
D: Plugin: calling hook fsm_file_pre in digest_list plugin
ufdio:       1 writes,      521 total bytes in 0.000010 secs
D: Plugin: calling hook fsm_file_prepare in ima plugin
D: Plugin: calling hook fsm_file_prepare in selinux plugin
D: lsetfilecon: (/etc/ima/digest_lists.sig/0-metadata_list-compact-time-1.9-7.eulerosv2r9.x86_64.sig;6124e6c9, system_u:object_r:etc_t:s0)
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: create     100400  1 (   0,   0)   191 /etc/ima/digest_lists.tlv/0-metadata_list-compact_tlv-time-1.9-7.eulerosv2r9.x86_64;6124e6c9
D: Plugin: calling hook fsm_file_pre in digest_list plugin
ufdio:       1 writes,      191 total bytes in 0.000009 secs
D: Plugin: calling hook fsm_file_prepare in ima plugin
D: Plugin: calling hook fsm_file_prepare in selinux plugin
D: lsetfilecon: (/etc/ima/digest_lists.tlv/0-metadata_list-compact_tlv-time-1.9-7.eulerosv2r9.x86_64;6124e6c9, system_u:object_r:etc_t:s0)
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: create     100400  1 (   0,   0)    96 /etc/ima/digest_lists/0-metadata_list-compact-time-1.9-7.eulerosv2r9.x86_64;6124e6c9
D: Plugin: calling hook fsm_file_pre in digest_list plugin
ufdio:       1 writes,       96 total bytes in 0.000008 secs
D: Plugin: calling hook fsm_file_prepare in ima plugin
D: Plugin: calling hook fsm_file_prepare in selinux plugin
D: lsetfilecon: (/etc/ima/digest_lists/0-metadata_list-compact-time-1.9-7.eulerosv2r9.x86_64;6124e6c9, system_u:object_r:etc_t:s0)
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: create     100755  1 (   0,   0) 22944 /usr/bin/time;6124e6c9
D: Plugin: calling hook fsm_file_pre in digest_list plugin
ufdio:       1 writes,    22944 total bytes in 0.000023 secs
D: Plugin: calling hook fsm_file_prepare in ima plugin
D: Plugin: calling hook fsm_file_prepare in selinux plugin
D: lsetfilecon: (/usr/bin/time;6124e6c9, system_u:object_r:bin_t:s0)
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: create     040755  1 (   0,   0)     0 /usr/share/licenses/time
D: Plugin: calling hook fsm_file_pre in digest_list plugin
D: Plugin: calling hook fsm_file_prepare in ima plugin
D: Plugin: calling hook fsm_file_prepare in selinux plugin
D: lsetfilecon: (/usr/share/licenses/time, system_u:object_r:usr_t:s0)
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: create     100644  1 (   0,   0)   263 /usr/share/licenses/time/AUTHORS;6124e6c9
D: Plugin: calling hook fsm_file_pre in digest_list plugin
ufdio:       1 writes,      263 total bytes in 0.000008 secs
D: Plugin: calling hook fsm_file_prepare in ima plugin
D: Plugin: calling hook fsm_file_prepare in selinux plugin
D: lsetfilecon: (/usr/share/licenses/time/AUTHORS;6124e6c9, system_u:object_r:usr_t:s0)
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: create     100644  1 (   0,   0) 35147 /usr/share/licenses/time/COPYING;6124e6c9
D: Plugin: calling hook fsm_file_pre in digest_list plugin
################################# [100%]
ufdio:       2 writes,    35147 total bytes in 0.000031 secs
D: Plugin: calling hook fsm_file_prepare in ima plugin
D: Plugin: calling hook fsm_file_prepare in selinux plugin
D: lsetfilecon: (/usr/share/licenses/time/COPYING;6124e6c9, system_u:object_r:usr_t:s0)
D: Plugin: calling hook fsm_file_post in digest_list plugin
fdio:      40 reads,    60424 total bytes in 0.001862 secs
D: adding "time" to Name index.
D: adding 7 entries to Basenames index.
D: adding "Unspecified" to Group index.
D: adding 9 entries to Requirename index.
D: adding 2 entries to Providename index.
D: adding 6 entries to Dirnames index.
D: adding 1 entries to Installtid index.
D: adding 1 entries to Sigmd5 index.
D: adding "8944dd6585c470c02cd42d949d3ff1d5eb4e7cdc" to Sha1header index.
D: Plugin: calling hook psm_post in syslog plugin
ufdio:       5 reads,     4896 total bytes in 0.000006 secs
D: running post-transaction scripts
D:  read h#     457
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D: Plugin: calling hook psm_pre in digest_list plugin
D: Plugin: calling hook psm_pre in selinux plugin
D: Plugin: calling hook psm_post in syslog plugin
D: Plugin: calling hook tsm_post in selinux plugin
D: Plugin: calling hook tsm_post in syslog plugin
D: syncing fs /
D: closed   db index       Enhancename
D: closed   db index       Supplementname
D: closed   db index       Suggestname
D: closed   db index       Recommendname
D: closed   db index       Transfiletriggername
D: closed   db index       Filetriggername
D: closed   db index       Sha1header
D: closed   db index       Sigmd5
D: closed   db index       Installtid
D: closed   db index       Dirnames
D: closed   db index       Triggername
D: closed   db index       Obsoletename
D: closed   db index       Conflictname
D: closed   db index       Providename
D: closed   db index       Requirename
D: closed   db index       Group
D: closed   db index       Basenames
D: closed   db index       Name
D: closed   db index       /var/lib/rpm/Index.db
D: closed   db index       /var/lib/rpm/Packages.db
D: Exit status: 0
+ ls -l /etc/ima/digest_lists/0-metadata_list-compact-time-1.9-7.eulerosv2r9.x86_64 /etc/ima/digest_lists.sig/0-metadata_list-compact-time-1.9-7.eulerosv2r9.x86_64.sig /etc/ima/digest_lists.tlv/0-metadata_list-compact_tlv-time-1.9-7.eulerosv2r9.x86_64
-r--------. 1 root root  96 Aug 21 17:00 /etc/ima/digest_lists/0-metadata_list-compact-time-1.9-7.eulerosv2r9.x86_64
-r--------. 1 root root 521 Aug 21 17:00 /etc/ima/digest_lists.sig/0-metadata_list-compact-time-1.9-7.eulerosv2r9.x86_64.sig
-r--------. 1 root root 191 Aug 21 17:00 /etc/ima/digest_lists.tlv/0-metadata_list-compact_tlv-time-1.9-7.eulerosv2r9.x86_64
+ echo '[uvh] time-1.9-8.eulerosv2r10.x86_64.rpm'
[uvh] time-1.9-8.eulerosv2r10.x86_64.rpm
+ rpm -vvv -Uvh time-1.9-8.eulerosv2r10.x86_64.rpm
ufdio:       1 reads,    17908 total bytes in 0.000009 secs
ufdio:       1 reads,      881 total bytes in 0.000002 secs
ufdio:       1 reads,    17908 total bytes in 0.000007 secs
warning: waiting for transaction lock on /var/lib/rpm/.rpm.lock
D: ============== time-1.9-8.eulerosv2r10.x86_64.rpm
D: loading keyring from pubkeys in /var/lib/rpm/pubkeys/*.key
D: couldn't find any keys in /var/lib/rpm/pubkeys/*.key
D: loading keyring from rpmdb
D: opening  db index       /var/lib/rpm/Packages.db mode=0x0
D: opening  db index       /var/lib/rpm/Index.db mode=0x0
D: opening  db index       Name tag=1000
D: opening  db index       Basenames tag=1117
D: opening  db index       Group tag=1016
D: opening  db index       Requirename tag=1049
D: opening  db index       Providename tag=1047
D: opening  db index       Conflictname tag=1054
D: opening  db index       Obsoletename tag=1090
D: opening  db index       Triggername tag=1066
D: opening  db index       Dirnames tag=1118
D: opening  db index       Installtid tag=1128
D: opening  db index       Sigmd5 tag=261
D: opening  db index       Sha1header tag=269
D: opening  db index       Filetriggername tag=5069
D: opening  db index       Transfiletriggername tag=5079
D: opening  db index       Recommendname tag=5046
D: opening  db index       Suggestname tag=5049
D: opening  db index       Supplementname tag=5052
D: opening  db index       Enhancename tag=5055
warning: time-1.9-8.eulerosv2r10.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
D: time-1.9-8.eulerosv2r10.x86_64.rpm: Header SHA1 digest: OK
ufdio:       5 reads,     5324 total bytes in 0.000098 secs
D: Plugin: calling hook init in ima plugin
D: Plugin: calling hook init in syslog plugin
D:  read h#     457
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:      added binary package [0]
D: found 0 source and 1 binary packages
D: ========== +++ time-1.9-8.eulerosv2r10 x86_64/linux 0x2
D:  read h#     168
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:  Requires: libc.so.6()(64bit)                            YES (db provides)
D:  read h#     168
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:  Requires: libc.so.6(GLIBC_2.2.5)(64bit)                 YES (db provides)
D:  read h#     168
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:  Requires: libc.so.6(GLIBC_2.3.4)(64bit)                 YES (db provides)
D:  read h#     168
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:  Requires: libc.so.6(GLIBC_2.4)(64bit)                   YES (db provides)
D:  Requires: rpmlib(CompressedFileNames) <= 3.0.4-1        YES (rpmlib provides)
D:  Requires: rpmlib(FileDigests) <= 4.6.0-1                YES (rpmlib provides)
D:  Requires: rpmlib(PayloadFilesHavePrefix) <= 4.0-1       YES (rpmlib provides)
D:  Requires: rpmlib(PayloadIsXz) <= 5.2-1                  YES (rpmlib provides)
D:  read h#     168
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:  Requires: rtld(GNU_HASH)                                YES (db provides)
D: ========== --- time-1.9-7.eulerosv2r9 x86_64/linux 0x2
D: ========== recording tsort relations
D: ========== tsorting packages (order, #predecessors, #succesors, depth)
D:     0    0    0    1   +time-1.9-8.eulerosv2r10.x86_64
D:     1    0    0    1   -time-1.9-7.eulerosv2r9.x86_64
D: installing binary packages
D: closed   db index       Enhancename
D: closed   db index       Supplementname
D: closed   db index       Suggestname
D: closed   db index       Recommendname
D: closed   db index       Transfiletriggername
D: closed   db index       Filetriggername
D: closed   db index       Sha1header
D: closed   db index       Sigmd5
D: closed   db index       Installtid
D: closed   db index       Dirnames
D: closed   db index       Triggername
D: closed   db index       Obsoletename
D: closed   db index       Conflictname
D: closed   db index       Providename
D: closed   db index       Requirename
D: closed   db index       Group
D: closed   db index       Basenames
D: closed   db index       Name
D: closed   db index       /var/lib/rpm/Index.db
D: closed   db index       /var/lib/rpm/Packages.db
D: opening  db index       /var/lib/rpm/Packages.db mode=0x42
D: opening  db index       /var/lib/rpm/Index.db mode=0x42
D: opening  db index       Name tag=1000
D: opening  db index       Basenames tag=1117
D: opening  db index       Group tag=1016
D: opening  db index       Requirename tag=1049
D: opening  db index       Providename tag=1047
D: opening  db index       Conflictname tag=1054
D: opening  db index       Obsoletename tag=1090
D: opening  db index       Triggername tag=1066
D: opening  db index       Dirnames tag=1118
D: opening  db index       Installtid tag=1128
D: opening  db index       Sigmd5 tag=261
D: opening  db index       Sha1header tag=269
D: opening  db index       Filetriggername tag=5069
D: opening  db index       Transfiletriggername tag=5079
D: opening  db index       Recommendname tag=5046
D: opening  db index       Suggestname tag=5049
D: opening  db index       Supplementname tag=5052
D: opening  db index       Enhancename tag=5055
D: sanity checking 1 elements
D:  read h#     457
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:  read h#     457
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
Verifying...                          ufdio:       7 reads,    26188 total bytes in 0.000302 secs
################################# [100%]
D: Plugin: calling hook tsm_pre in selinux plugin
D: selabel_open: (/etc/selinux/targeted/contexts/files/file_contexts)
D: Plugin: calling hook tsm_pre in syslog plugin
D: running pre-transaction scripts
D: computing 16 file fingerprints
Preparing...                          D: computing file dispositions
D: 0x0000fd00     4096     10550057      2913468 /
################################# [100%]
D:  read h#     457
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D: Plugin: calling hook psm_pre in digest_list plugin
D: digest_list: IMA interface '/sys/kernel/security/ima/digest_list_data' not found, disabling plugin
D: Plugin: calling hook psm_pre in selinux plugin
D: Plugin: calling hook psm_post in syslog plugin
D: ========== +++ time-1.9-8.eulerosv2r10 x86_64-linux 0x2
D: time-1.9-8.eulerosv2r10.x86_64: Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
D: time-1.9-8.eulerosv2r10.x86_64: Header SHA1 digest: OK
D:   install: time-1.9-8.eulerosv2r10.x86_64 has 9 files
D: Plugin: calling hook psm_pre in digest_list plugin
D: Plugin: calling hook psm_pre in selinux plugin
Updating / installing...
   1:time-1.9-8.eulerosv2r10          D: ========== Directories not explicitly included in package:
D:          0 /etc/dim/digest_list/
D:          1 /etc/ima/digest_lists.sig/
D:          2 /etc/ima/digest_lists.tlv/
D:          3 /etc/ima/digest_lists/
D:          4 /usr/bin/
D:          5 /usr/share/licenses/
D: ==========
D: create     100400  1 (   0,   0)   272 /etc/dim/digest_list/time-1.9-8.eulerosv2r10.x86_64.hash;6124e6cb
D: Plugin: calling hook fsm_file_pre in digest_list plugin
ufdio:       1 writes,      272 total bytes in 0.000010 secs
D: Plugin: calling hook fsm_file_prepare in digest_list plugin
D: Plugin: calling hook fsm_file_prepare in ima plugin
D: Plugin: calling hook fsm_file_prepare in selinux plugin
D: lsetfilecon: (/etc/dim/digest_list/time-1.9-8.eulerosv2r10.x86_64.hash;6124e6cb, system_u:object_r:etc_t:s0)
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: create     100400  1 (   0,   0)   512 /etc/dim/digest_list/time-1.9-8.eulerosv2r10.x86_64.hash.sig;6124e6cb
D: Plugin: calling hook fsm_file_pre in digest_list plugin
ufdio:       1 writes,      512 total bytes in 0.000010 secs
D: Plugin: calling hook fsm_file_prepare in digest_list plugin
D: Plugin: calling hook fsm_file_prepare in ima plugin
D: Plugin: calling hook fsm_file_prepare in selinux plugin
D: lsetfilecon: (/etc/dim/digest_list/time-1.9-8.eulerosv2r10.x86_64.hash.sig;6124e6cb, system_u:object_r:etc_t:s0)
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: create     100400  1 (   0,   0)   521 /etc/ima/digest_lists.sig/0-metadata_list-compact-time-1.9-8.eulerosv2r10.x86_64.sig;6124e6cb
D: Plugin: calling hook fsm_file_pre in digest_list plugin
ufdio:       1 writes,      521 total bytes in 0.000009 secs
D: Plugin: calling hook fsm_file_prepare in digest_list plugin
D: Plugin: calling hook fsm_file_prepare in ima plugin
D: Plugin: calling hook fsm_file_prepare in selinux plugin
D: lsetfilecon: (/etc/ima/digest_lists.sig/0-metadata_list-compact-time-1.9-8.eulerosv2r10.x86_64.sig;6124e6cb, system_u:object_r:etc_t:s0)
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: create     100400  1 (   0,   0)   191 /etc/ima/digest_lists.tlv/0-metadata_list-compact_tlv-time-1.9-8.eulerosv2r10.x86_64;6124e6cb
D: Plugin: calling hook fsm_file_pre in digest_list plugin
ufdio:       1 writes,      191 total bytes in 0.000009 secs
D: Plugin: calling hook fsm_file_prepare in digest_list plugin
D: Plugin: calling hook fsm_file_prepare in ima plugin
D: Plugin: calling hook fsm_file_prepare in selinux plugin
D: lsetfilecon: (/etc/ima/digest_lists.tlv/0-metadata_list-compact_tlv-time-1.9-8.eulerosv2r10.x86_64;6124e6cb, system_u:object_r:etc_t:s0)
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: create     100400  1 (   0,   0)    96 /etc/ima/digest_lists/0-metadata_list-compact-time-1.9-8.eulerosv2r10.x86_64;6124e6cb
D: Plugin: calling hook fsm_file_pre in digest_list plugin
ufdio:       1 writes,       96 total bytes in 0.000008 secs
D: Plugin: calling hook fsm_file_prepare in digest_list plugin
D: Plugin: calling hook fsm_file_prepare in ima plugin
D: Plugin: calling hook fsm_file_prepare in selinux plugin
D: lsetfilecon: (/etc/ima/digest_lists/0-metadata_list-compact-time-1.9-8.eulerosv2r10.x86_64;6124e6cb, system_u:object_r:etc_t:s0)
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: create     100755  1 (   0,   0) 22952 /usr/bin/time;6124e6cb
D: Plugin: calling hook fsm_file_pre in digest_list plugin
ufdio:       1 writes,    22952 total bytes in 0.000053 secs
D: Plugin: calling hook fsm_file_prepare in digest_list plugin
D: Plugin: calling hook fsm_file_prepare in ima plugin
D: Plugin: calling hook fsm_file_prepare in selinux plugin
D: lsetfilecon: (/usr/bin/time;6124e6cb, system_u:object_r:bin_t:s0)
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: create     040755  1 (   0,   0)     0 /usr/share/licenses/time
D: Plugin: calling hook fsm_file_pre in digest_list plugin
D: Plugin: calling hook fsm_file_prepare in digest_list plugin
D: Plugin: calling hook fsm_file_prepare in ima plugin
D: Plugin: calling hook fsm_file_prepare in selinux plugin
D: lsetfilecon: (/usr/share/licenses/time, system_u:object_r:usr_t:s0)
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: create     100644  1 (   0,   0)   263 /usr/share/licenses/time/AUTHORS;6124e6cb
D: Plugin: calling hook fsm_file_pre in digest_list plugin
ufdio:       1 writes,      263 total bytes in 0.000037 secs
D: Plugin: calling hook fsm_file_prepare in digest_list plugin
D: Plugin: calling hook fsm_file_prepare in ima plugin
D: Plugin: calling hook fsm_file_prepare in selinux plugin
D: lsetfilecon: (/usr/share/licenses/time/AUTHORS;6124e6cb, system_u:object_r:usr_t:s0)
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: create     100644  1 (   0,   0) 35147 /usr/share/licenses/time/COPYING;6124e6cb
D: Plugin: calling hook fsm_file_pre in digest_list plugin
################################# [ 50%]
ufdio:       2 writes,    35147 total bytes in 0.000073 secs
D: Plugin: calling hook fsm_file_prepare in digest_list plugin
D: Plugin: calling hook fsm_file_prepare in ima plugin
D: Plugin: calling hook fsm_file_prepare in selinux plugin
D: lsetfilecon: (/usr/share/licenses/time/COPYING;6124e6cb, system_u:object_r:usr_t:s0)
D: Plugin: calling hook fsm_file_post in digest_list plugin
fdio:      45 reads,    61556 total bytes in 0.001950 secs
D: adding "time" to Name index.
D: adding 9 entries to Basenames index.
D: adding "Unspecified" to Group index.
D: adding 9 entries to Requirename index.
D: adding 2 entries to Providename index.
D: adding 7 entries to Dirnames index.
D: adding 1 entries to Installtid index.
D: adding 1 entries to Sigmd5 index.
D: adding "dca89419ebbc5842014b65b9fb49098d0b4d5093" to Sha1header index.
D: Plugin: calling hook psm_post in syslog plugin
ufdio:       5 reads,     5324 total bytes in 0.000006 secs
D: ========== +++ time-1.9-7.eulerosv2r9 x86_64-linux 0x2
D:  read h#     457
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:     erase: time-1.9-7.eulerosv2r9.x86_64 has 7 files
D: Plugin: calling hook psm_pre in digest_list plugin
D: Plugin: calling hook psm_pre in selinux plugin
Cleaning up / removing...
   2:time-1.9-7.eulerosv2r9           D: skip       100644  1 (   0,   0) 35147 /usr/share/licenses/time/COPYING
D: Plugin: calling hook fsm_file_pre in digest_list plugin
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: skip       100644  1 (   0,   0)   263 /usr/share/licenses/time/AUTHORS
D: Plugin: calling hook fsm_file_pre in digest_list plugin
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: skip       040755  2 (   0,   0)  4096 /usr/share/licenses/time
D: Plugin: calling hook fsm_file_pre in digest_list plugin
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: skip       100755  1 (   0,   0) 22952 /usr/bin/time
D: Plugin: calling hook fsm_file_pre in digest_list plugin
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: erase      100400  1 (   0,   0)    96 /etc/ima/digest_lists/0-metadata_list-compact-time-1.9-7.eulerosv2r9.x86_64
D: Plugin: calling hook fsm_file_pre in digest_list plugin
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: erase      100400  1 (   0,   0)   191 /etc/ima/digest_lists.tlv/0-metadata_list-compact_tlv-time-1.9-7.eulerosv2r9.x86_64
D: Plugin: calling hook fsm_file_pre in digest_list plugin
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: erase      100400  1 (   0,   0)   521 /etc/ima/digest_lists.sig/0-metadata_list-compact-time-1.9-7.eulerosv2r9.x86_64.sig
D: Plugin: calling hook fsm_file_pre in digest_list plugin
D: Plugin: calling hook fsm_file_post in digest_list plugin
################################# [100%]
D:   --- h#     457 time-1.9-7.eulerosv2r9.x86_64
D: adding "time" to Name index.
D: adding 7 entries to Basenames index.
D: adding "Unspecified" to Group index.
D: adding 9 entries to Requirename index.
D: adding 2 entries to Providename index.
D: adding 6 entries to Dirnames index.
D: adding 1 entries to Installtid index.
D: adding 1 entries to Sigmd5 index.
D: adding "8944dd6585c470c02cd42d949d3ff1d5eb4e7cdc" to Sha1header index.
D: Plugin: calling hook psm_post in syslog plugin
D: running post-transaction scripts
D:  read h#     462
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D: Plugin: calling hook psm_pre in digest_list plugin
D: Plugin: calling hook psm_pre in selinux plugin
D: Plugin: calling hook psm_post in syslog plugin
D: Plugin: calling hook tsm_post in selinux plugin
D: Plugin: calling hook tsm_post in syslog plugin
D: syncing fs /
D: closed   db index       Enhancename
D: closed   db index       Supplementname
D: closed   db index       Suggestname
D: closed   db index       Recommendname
D: closed   db index       Transfiletriggername
D: closed   db index       Filetriggername
D: closed   db index       Sha1header
D: closed   db index       Sigmd5
D: closed   db index       Installtid
D: closed   db index       Dirnames
D: closed   db index       Triggername
D: closed   db index       Obsoletename
D: closed   db index       Conflictname
D: closed   db index       Providename
D: closed   db index       Requirename
D: closed   db index       Group
D: closed   db index       Basenames
D: closed   db index       Name
D: closed   db index       /var/lib/rpm/Index.db
D: closed   db index       /var/lib/rpm/Packages.db
D: Exit status: 0
+ ls -l /etc/ima/digest_lists/0-metadata_list-compact-time-1.9-8.eulerosv2r10.x86_64 /etc/ima/digest_lists.sig/0-metadata_list-compact-time-1.9-8.eulerosv2r10.x86_64.sig /etc/ima/digest_lists.tlv/0-metadata_list-compact_tlv-time-1.9-8.eulerosv2r10.x86_64
-r--------. 1 root root  96 Aug 21 17:00 /etc/ima/digest_lists/0-metadata_list-compact-time-1.9-8.eulerosv2r10.x86_64
-r--------. 1 root root 521 Aug 21 17:00 /etc/ima/digest_lists.sig/0-metadata_list-compact-time-1.9-8.eulerosv2r10.x86_64.sig
-r--------. 1 root root 191 Aug 21 17:00 /etc/ima/digest_lists.tlv/0-metadata_list-compact_tlv-time-1.9-8.eulerosv2r10.x86_64
+ echo '[dvh] time-1.9-7.eulerosv2r9.x86_64.rpm'
[dvh] time-1.9-7.eulerosv2r9.x86_64.rpm
+ rpm -vvv -Uvh time-1.9-7.eulerosv2r9.x86_64.rpm --oldpackage
ufdio:       1 reads,    17908 total bytes in 0.000156 secs
ufdio:       1 reads,      881 total bytes in 0.000002 secs
ufdio:       1 reads,    17908 total bytes in 0.000055 secs
D: ============== time-1.9-7.eulerosv2r9.x86_64.rpm
D: loading keyring from pubkeys in /var/lib/rpm/pubkeys/*.key
D: couldn't find any keys in /var/lib/rpm/pubkeys/*.key
D: loading keyring from rpmdb
D: opening  db environment /var/lib/rpm cdb:0x401
D: opening  db index       /var/lib/rpm/Packages 0x400 mode=0x0
D: locked   db index       /var/lib/rpm/Packages
D: opening  db index       /var/lib/rpm/Name 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Basenames 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Group 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Requirename 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Providename 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Conflictname 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Obsoletename 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Triggername 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Dirnames 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Installtid 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Sigmd5 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Sha1header 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Filetriggername 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Transfiletriggername 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Recommendname 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Suggestname 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Supplementname 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Enhancename 0x400 mode=0x0
warning: time-1.9-7.eulerosv2r9.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
D: time-1.9-7.eulerosv2r9.x86_64.rpm: Header SHA1 digest: OK
ufdio:       5 reads,     4896 total bytes in 0.000083 secs
D: Plugin: calling hook init in ima plugin
D: Plugin: calling hook init in syslog plugin
D:  read h#     439
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:      added binary package [0]
D: found 0 source and 1 binary packages
D: ========== +++ time-1.9-7.eulerosv2r9 x86_64/linux 0x2
D:  read h#     168
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:  Requires: libc.so.6()(64bit)                            YES (db provides)
D:  read h#     168
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:  Requires: libc.so.6(GLIBC_2.2.5)(64bit)                 YES (db provides)
D:  read h#     168
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:  Requires: libc.so.6(GLIBC_2.3.4)(64bit)                 YES (db provides)
D:  read h#     168
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:  Requires: libc.so.6(GLIBC_2.4)(64bit)                   YES (db provides)
D:  Requires: rpmlib(CompressedFileNames) <= 3.0.4-1        YES (rpmlib provides)
D:  Requires: rpmlib(FileDigests) <= 4.6.0-1                YES (rpmlib provides)
D:  Requires: rpmlib(PayloadFilesHavePrefix) <= 4.0-1       YES (rpmlib provides)
D:  Requires: rpmlib(PayloadIsXz) <= 5.2-1                  YES (rpmlib provides)
D:  read h#     168
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:  Requires: rtld(GNU_HASH)                                YES (db provides)
D: ========== --- time-1.9-7.eulerosv2r9 x86_64/linux 0x2
D: ========== recording tsort relations
D: ========== tsorting packages (order, #predecessors, #succesors, depth)
D:     0    0    0    1   +time-1.9-7.eulerosv2r9.x86_64
D:     1    0    0    1   -time-1.9-7.eulerosv2r9.x86_64
D: installing binary packages
D: closed   db index       /var/lib/rpm/Packages
D: closed   db index       /var/lib/rpm/Enhancename
D: closed   db index       /var/lib/rpm/Supplementname
D: closed   db index       /var/lib/rpm/Suggestname
D: closed   db index       /var/lib/rpm/Recommendname
D: closed   db index       /var/lib/rpm/Transfiletriggername
D: closed   db index       /var/lib/rpm/Filetriggername
D: closed   db index       /var/lib/rpm/Sha1header
D: closed   db index       /var/lib/rpm/Sigmd5
D: closed   db index       /var/lib/rpm/Installtid
D: closed   db index       /var/lib/rpm/Dirnames
D: closed   db index       /var/lib/rpm/Triggername
D: closed   db index       /var/lib/rpm/Obsoletename
D: closed   db index       /var/lib/rpm/Conflictname
D: closed   db index       /var/lib/rpm/Providename
D: closed   db index       /var/lib/rpm/Requirename
D: closed   db index       /var/lib/rpm/Group
D: closed   db index       /var/lib/rpm/Basenames
D: closed   db index       /var/lib/rpm/Name
D: closed   db environment /var/lib/rpm
D: opening  db environment /var/lib/rpm cdb:0x401
D: opening  db index       /var/lib/rpm/Packages (none) mode=0x42
D: opening  db index       /var/lib/rpm/Name (none) mode=0x42
D: opening  db index       /var/lib/rpm/Basenames (none) mode=0x42
D: opening  db index       /var/lib/rpm/Group (none) mode=0x42
D: opening  db index       /var/lib/rpm/Requirename (none) mode=0x42
D: opening  db index       /var/lib/rpm/Providename (none) mode=0x42
D: opening  db index       /var/lib/rpm/Conflictname (none) mode=0x42
D: opening  db index       /var/lib/rpm/Obsoletename (none) mode=0x42
D: opening  db index       /var/lib/rpm/Triggername (none) mode=0x42
D: opening  db index       /var/lib/rpm/Dirnames (none) mode=0x42
D: opening  db index       /var/lib/rpm/Installtid (none) mode=0x42
D: opening  db index       /var/lib/rpm/Sigmd5 (none) mode=0x42
D: opening  db index       /var/lib/rpm/Sha1header (none) mode=0x42
D: opening  db index       /var/lib/rpm/Filetriggername (none) mode=0x42
D: opening  db index       /var/lib/rpm/Transfiletriggername (none) mode=0x42
D: opening  db index       /var/lib/rpm/Recommendname (none) mode=0x42
D: opening  db index       /var/lib/rpm/Suggestname (none) mode=0x42
D: opening  db index       /var/lib/rpm/Supplementname (none) mode=0x42
D: opening  db index       /var/lib/rpm/Enhancename (none) mode=0x42
D: sanity checking 1 elements
D:  read h#     439
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
Verifying...                          ufdio:       7 reads,    25048 total bytes in 0.000049 secs
################################# [100%]
D: Plugin: calling hook tsm_pre in selinux plugin
D: selabel_open: (/etc/selinux/targeted/contexts/files/file_contexts)
D: Plugin: calling hook tsm_pre in syslog plugin
D: computing 14 file fingerprints
Preparing...                          D: computing file dispositions
D: 0x0000fd00     4096     10553684      2913481 /
################################# [100%]
D: Plugin: calling hook tsm_post in selinux plugin
D: Plugin: calling hook tsm_post in syslog plugin
        package time-1.9-7.eulerosv2r9.x86_64 is already installed
D: closed   db index       /var/lib/rpm/Packages
D: closed   db index       /var/lib/rpm/Enhancename
D: closed   db index       /var/lib/rpm/Supplementname
D: closed   db index       /var/lib/rpm/Suggestname
D: closed   db index       /var/lib/rpm/Recommendname
D: closed   db index       /var/lib/rpm/Transfiletriggername
D: closed   db index       /var/lib/rpm/Filetriggername
D: closed   db index       /var/lib/rpm/Sha1header
D: closed   db index       /var/lib/rpm/Sigmd5
D: closed   db index       /var/lib/rpm/Installtid
D: closed   db index       /var/lib/rpm/Dirnames
D: closed   db index       /var/lib/rpm/Triggername
D: closed   db index       /var/lib/rpm/Obsoletename
D: closed   db index       /var/lib/rpm/Conflictname
D: closed   db index       /var/lib/rpm/Providename
D: closed   db index       /var/lib/rpm/Requirename
D: closed   db index       /var/lib/rpm/Group
D: closed   db index       /var/lib/rpm/Basenames
D: closed   db index       /var/lib/rpm/Name
D: closed   db environment /var/lib/rpm
D: Exit status: 2
+ ls -l /etc/ima/digest_lists/0-metadata_list-compact-time-1.9-8.eulerosv2r10.x86_64 /etc/ima/digest_lists.sig/0-metadata_list-compact-time-1.9-8.eulerosv2r10.x86_64.sig /etc/ima/digest_lists.tlv/0-metadata_list-compact_tlv-time-1.9-8.eulerosv2r10.x86_64
-r--------. 1 root root  96 Aug 21 17:00 /etc/ima/digest_lists/0-metadata_list-compact-time-1.9-8.eulerosv2r10.x86_64
-r--------. 1 root root 521 Aug 21 17:00 /etc/ima/digest_lists.sig/0-metadata_list-compact-time-1.9-8.eulerosv2r10.x86_64.sig
-r--------. 1 root root 191 Aug 21 17:00 /etc/ima/digest_lists.tlv/0-metadata_list-compact_tlv-time-1.9-8.eulerosv2r10.x86_64
+ echo '[erase] time'
[erase] time
+ rpm -qi time
Name        : time
Version     : 1.9
Release     : 7.eulerosv2r9
Architecture: x86_64
Install Date: Tue 24 Aug 2021 08:32:09 PM CST
Group       : Unspecified
Size        : 59162
License     : GPLv3+ and GFDL
Signature   : RSA/SHA256, Sat 21 Aug 2021 06:17:24 PM CST, Key ID 71a7e90fe2ec75bc
Source RPM  : time-1.9-7.eulerosv2r9.src.rpm
Build Date  : Sat 21 Aug 2021 05:00:33 PM CST
Build Host  : szxrtosci10000
Packager    : https://euleros.huawei.com/repos
Vendor      : HUAWEI TECHNOLOGIES CO.,LTD
URL         : http://www.gnu.org/software/time/
Summary     : Monitoring the system resources used by running program
Description :
This package runs another program and displays information
about the resources used by that program. The information is
collected by the system while the program was running.
+ rpm -vvv -e time
ufdio:       1 reads,    17908 total bytes in 0.000105 secs
ufdio:       1 reads,      881 total bytes in 0.000001 secs
ufdio:       1 reads,    17908 total bytes in 0.000009 secs
D: opening  db environment /var/lib/rpm cdb:0x401
D: opening  db index       /var/lib/rpm/Packages 0x400 mode=0x0
D: locked   db index       /var/lib/rpm/Packages
D: opening  db index       /var/lib/rpm/Name 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Basenames 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Group 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Requirename 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Providename 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Conflictname 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Obsoletename 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Triggername 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Dirnames 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Installtid 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Sigmd5 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Sha1header 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Filetriggername 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Transfiletriggername 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Recommendname 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Suggestname 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Supplementname 0x400 mode=0x0
D: opening  db index       /var/lib/rpm/Enhancename 0x400 mode=0x0
D: loading keyring from pubkeys in /var/lib/rpm/pubkeys/*.key
D: couldn't find any keys in /var/lib/rpm/pubkeys/*.key
D: loading keyring from rpmdb
D:  read h#     439
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D: Plugin: calling hook init in ima plugin
D: Plugin: calling hook init in syslog plugin
D: ========== --- time-1.9-7.eulerosv2r9 x86_64/linux 0x2
D: ========== recording tsort relations
D: ========== tsorting packages (order, #predecessors, #succesors, depth)
D:     0    0    0    1   -time-1.9-7.eulerosv2r9.x86_64
D: erasing packages
D: closed   db index       /var/lib/rpm/Packages
D: closed   db index       /var/lib/rpm/Enhancename
D: closed   db index       /var/lib/rpm/Supplementname
D: closed   db index       /var/lib/rpm/Suggestname
D: closed   db index       /var/lib/rpm/Recommendname
D: closed   db index       /var/lib/rpm/Transfiletriggername
D: closed   db index       /var/lib/rpm/Filetriggername
D: closed   db index       /var/lib/rpm/Sha1header
D: closed   db index       /var/lib/rpm/Sigmd5
D: closed   db index       /var/lib/rpm/Installtid
D: closed   db index       /var/lib/rpm/Dirnames
D: closed   db index       /var/lib/rpm/Triggername
D: closed   db index       /var/lib/rpm/Obsoletename
D: closed   db index       /var/lib/rpm/Conflictname
D: closed   db index       /var/lib/rpm/Providename
D: closed   db index       /var/lib/rpm/Requirename
D: closed   db index       /var/lib/rpm/Group
D: closed   db index       /var/lib/rpm/Basenames
D: closed   db index       /var/lib/rpm/Name
D: closed   db environment /var/lib/rpm
D: opening  db environment /var/lib/rpm cdb:0x401
D: opening  db index       /var/lib/rpm/Packages (none) mode=0x42
D: opening  db index       /var/lib/rpm/Name (none) mode=0x42
D: opening  db index       /var/lib/rpm/Basenames (none) mode=0x42
D: opening  db index       /var/lib/rpm/Group (none) mode=0x42
D: opening  db index       /var/lib/rpm/Requirename (none) mode=0x42
D: opening  db index       /var/lib/rpm/Providename (none) mode=0x42
D: opening  db index       /var/lib/rpm/Conflictname (none) mode=0x42
D: opening  db index       /var/lib/rpm/Obsoletename (none) mode=0x42
D: opening  db index       /var/lib/rpm/Triggername (none) mode=0x42
D: opening  db index       /var/lib/rpm/Dirnames (none) mode=0x42
D: opening  db index       /var/lib/rpm/Installtid (none) mode=0x42
D: opening  db index       /var/lib/rpm/Sigmd5 (none) mode=0x42
D: opening  db index       /var/lib/rpm/Sha1header (none) mode=0x42
D: opening  db index       /var/lib/rpm/Filetriggername (none) mode=0x42
D: opening  db index       /var/lib/rpm/Transfiletriggername (none) mode=0x42
D: opening  db index       /var/lib/rpm/Recommendname (none) mode=0x42
D: opening  db index       /var/lib/rpm/Suggestname (none) mode=0x42
D: opening  db index       /var/lib/rpm/Supplementname (none) mode=0x42
D: opening  db index       /var/lib/rpm/Enhancename (none) mode=0x42
D: Plugin: calling hook tsm_pre in selinux plugin
D: selabel_open: (/etc/selinux/targeted/contexts/files/file_contexts)
D: Plugin: calling hook tsm_pre in syslog plugin
D: running pre-transaction scripts
D: computing 7 file fingerprints
Preparing packages...
D: computing file dispositions
D: 0x0000fd00     4096     10553966      2913487 /
D:  read h#     439
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D: Plugin: calling hook psm_pre in digest_list plugin
D: digest_list: IMA interface '/sys/kernel/security/ima/digest_list_data' not found, disabling plugin
D: Plugin: calling hook psm_pre in selinux plugin
D: Plugin: calling hook psm_post in syslog plugin
D: ========== +++ time-1.9-7.eulerosv2r9 x86_64-linux 0x2
D:  read h#     439
Header V4 RSA/SHA256 Signature, key ID e2ec75bc: NOKEY
Header SHA1 digest: OK
D:     erase: time-1.9-7.eulerosv2r9.x86_64 has 7 files
D: Plugin: calling hook psm_pre in digest_list plugin
D: Plugin: calling hook psm_pre in selinux plugin
time-1.9-7.eulerosv2r9.x86_64
D: erase      100644  1 (   0,   0) 35147 /usr/share/licenses/time/COPYING
D: Plugin: calling hook fsm_file_pre in digest_list plugin
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: erase      100644  1 (   0,   0)   263 /usr/share/licenses/time/AUTHORS
D: Plugin: calling hook fsm_file_pre in digest_list plugin
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: erase      040755  2 (   0,   0)  4096 /usr/share/licenses/time
D: Plugin: calling hook fsm_file_pre in digest_list plugin
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: erase      100755  1 (   0,   0) 22952 /usr/bin/time
D: Plugin: calling hook fsm_file_pre in digest_list plugin
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: erase      000000  0 (   0,   0)     0 /etc/ima/digest_lists/0-metadata_list-compact-time-1.9-7.eulerosv2r9.x86_64
D: Plugin: calling hook fsm_file_pre in digest_list plugin
warning: file /etc/ima/digest_lists/0-metadata_list-compact-time-1.9-7.eulerosv2r9.x86_64: remove failed: No such file or directory
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: erase      000000  0 (   0,   0)     0 /etc/ima/digest_lists.tlv/0-metadata_list-compact_tlv-time-1.9-7.eulerosv2r9.x86_64
D: Plugin: calling hook fsm_file_pre in digest_list plugin
warning: file /etc/ima/digest_lists.tlv/0-metadata_list-compact_tlv-time-1.9-7.eulerosv2r9.x86_64: remove failed: No such file or directory
D: Plugin: calling hook fsm_file_post in digest_list plugin
D: erase      000000  0 (   0,   0)     0 /etc/ima/digest_lists.sig/0-metadata_list-compact-time-1.9-7.eulerosv2r9.x86_64.sig
D: Plugin: calling hook fsm_file_pre in digest_list plugin
warning: file /etc/ima/digest_lists.sig/0-metadata_list-compact-time-1.9-7.eulerosv2r9.x86_64.sig: remove failed: No such file or directory
D: Plugin: calling hook fsm_file_post in digest_list plugin
D:   --- h#     439 time-1.9-7.eulerosv2r9.x86_64
D: adding "time" to Name index.
D: adding 7 entries to Basenames index.
D: adding "Unspecified" to Group index.
D: adding 9 entries to Requirename index.
D: adding 2 entries to Providename index.
D: adding 6 entries to Dirnames index.
D: adding 1 entries to Installtid index.
D: adding 1 entries to Sigmd5 index.
D: adding "8944dd6585c470c02cd42d949d3ff1d5eb4e7cdc" to Sha1header index.
D: Plugin: calling hook psm_post in syslog plugin
D: running post-transaction scripts
D: Plugin: calling hook tsm_post in selinux plugin
D: Plugin: calling hook tsm_post in syslog plugin
D: syncing fs /
D: closed   db index       /var/lib/rpm/Packages
D: closed   db index       /var/lib/rpm/Enhancename
D: closed   db index       /var/lib/rpm/Supplementname
D: closed   db index       /var/lib/rpm/Suggestname
D: closed   db index       /var/lib/rpm/Recommendname
D: closed   db index       /var/lib/rpm/Transfiletriggername
D: closed   db index       /var/lib/rpm/Filetriggername
D: closed   db index       /var/lib/rpm/Sha1header
D: closed   db index       /var/lib/rpm/Sigmd5
D: closed   db index       /var/lib/rpm/Installtid
D: closed   db index       /var/lib/rpm/Dirnames
D: closed   db index       /var/lib/rpm/Triggername
D: closed   db index       /var/lib/rpm/Obsoletename
D: closed   db index       /var/lib/rpm/Conflictname
D: closed   db index       /var/lib/rpm/Providename
D: closed   db index       /var/lib/rpm/Requirename
D: closed   db index       /var/lib/rpm/Group
D: closed   db index       /var/lib/rpm/Basenames
D: closed   db index       /var/lib/rpm/Name
D: closed   db environment /var/lib/rpm
D: Exit status: 0
+ ls -l /etc/ima/digest_lists/0-metadata_list-compact-time-1.9-8.eulerosv2r10.x86_64 /etc/ima/digest_lists.sig/0-metadata_list-compact-time-1.9-8.eulerosv2r10.x86_64.sig /etc/ima/digest_lists.tlv/0-metadata_list-compact_tlv-time-1.9-8.eulerosv2r10.x86_64
-r--------. 1 root root  96 Aug 21 17:00 /etc/ima/digest_lists/0-metadata_list-compact-time-1.9-8.eulerosv2r10.x86_64
-r--------. 1 root root 521 Aug 21 17:00 /etc/ima/digest_lists.sig/0-metadata_list-compact-time-1.9-8.eulerosv2r10.x86_64.sig
-r--------. 1 root root 191 Aug 21 17:00 /etc/ima/digest_lists.tlv/0-metadata_list-compact_tlv-time-1.9-8.eulerosv2r10.x86_64
hexiaowen commented 3 years ago

I tried adding a global lock to the rpm command, and it didn't seem to work. Log as indicated in previous comments

---
 lib/rpminstall.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/rpminstall.c b/lib/rpminstall.c
index 302ec0b..a076087 100644
--- a/lib/rpminstall.c
+++ b/lib/rpminstall.c
@@ -415,6 +415,11 @@ int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_t fileArgv)
     rpmVSFlags ovfyflags;
     int rc;
     int i;
+   rpmtxn txn = NULL;
+
+   if (!(txn = rpmtxnBegin(ts, RPMTXN_WRITE))) {
+       return -1;
+   }

     vsflags = setvsFlags(ia);
     ovsflags = rpmtsSetVSFlags(ts, (vsflags | RPMVSF_NEEDPAYLOAD));
@@ -671,6 +676,7 @@ exit:
     rpmtsEmpty(ts);
     rpmtsSetVSFlags(ts, ovsflags);
     rpmtsSetVfyFlags(ts, ovfyflags);
+    rpmtxnEnd(txn);

     return rc;
 }
@@ -682,8 +688,12 @@ int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t argv)
     int numFailed = 0;
     int numPackages = 0;
     rpmVSFlags vsflags, ovsflags;
+   rpmtxn txn = NULL;

     if (argv == NULL) return 0;
+   if (!(txn = rpmtxnBegin(ts, RPMTXN_WRITE))) {
+       return -1;
+   }

     vsflags = setvsFlags(ia);
     ovsflags = rpmtsSetVSFlags(ts, vsflags);
@@ -732,6 +742,7 @@ int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t argv)
 exit:
     rpmtsEmpty(ts);
     rpmtsSetVSFlags(ts, ovsflags);
+    rpmtxnEnd(txn);

     return (numFailed < 0) ? numPackages : numFailed;
 }
-- 
2.26.3
hexiaowen commented 3 years ago

Yes, rpm does not currently handle concurrent db rebuild and other operations correctly, this would be an old, old bug.

However database rebuild is a maintenance/repair operation that you're only supposed to need once in every blue moon, not something that is run as a part of daily operations. Yes, the locking should prevent it, but if you're rebuilding the database concurrently with other operations then you're also doing something wrong.

We have a database corruption check script that does not work with the upgrade tool. Inevitably there is a simultaneous operation. This problem occurs in data center scenarios, and the probability is not low.

Oddly, both processes use rpmtxnBegin and rpmtxnEnd, but they cannot prevent concurrency.

This may be related to the switchover from the BDB to the NDB.

oliverkurth commented 3 years ago

FWIW, I tried to fix this in tdnf (https://github.com/vmware/tdnf) by calling rpmtxnBegin() just after rpmtsCreate(), and rpmtxnEnd() just before rpmtsFree(), and I still see this problem.

I see this in both Fedora 33 with sqlite and in Photon 4 with bdb. It does not seem related to the db backend.

pmatilai commented 3 years ago

I know people have all manner of hacks to recover after BDB failures. When you switch to something else, you need to stop using those BDB kludges because they do all sorts of things (like database rebuilds) which should NOT happen as a part of normal operation and end up only hurting instead of helping. So again, yes there is a bug regarding this concurrency, been there just about forever. It'll get dealt at some point, but in the meanwhile I suggest people stop shooting themselves in the foot.

oliverkurth commented 3 years ago

Not sure why this needs to be mentioned, but obviously rebuilding the db continuously is a test scenario, not intended for everyday use. However, it does show that rebuilding the db, for example for transitioning from BDB to another db, may cause weird issues if an rpm operation happens at the same time, like "every blue moon", and this cannot prevented easily. Nobody is trying to shoot themselves into the foot.

pmatilai commented 3 years ago

@oliverkurth - see above, it's not a test scenario for everybody. That's what I was referring to.

sshedi commented 3 years ago

I have an update on this:

rpmtxn rpmtxnEnd(rpmtxn txn)
{
    if (txn) {
        sync();  // ---> This flushes the file system buffer cache and I'm not seeing contention anymore
    rpmlockRelease(txn->lock);
    if (txn->flags & RPMTXN_WRITE)
        rpmsqBlock(SIG_UNBLOCK);
    rpmtsFree(txn->ts);
    free(txn);
    }
    return NULL;
}

If someone else here can try this out and confirm that it's working, I will send a PR.