Linux

RPM 命令掛起

  • April 29, 2020

在 Cent OS 5 上,rpm命令掛在我的 Linux 機器上。

[root@manage glib]# rpm -i libgcc-4.1.1-52.el5.i386.rpm

[root@manage glib]# ps -efww | grep libgcc
root      2020 32168  0 13:50 pts/0    00:00:00 grep libgcc
root     14254  2974  0 13:09 pts/1    00:00:00 rpm -i libgcc-4.1.1-52.el5.i386.rpm

下面是strace

[root@manage glib]# strace -p 14254
Process 14254 attached - interrupt to quit
select(0, NULL, NULL, NULL, {0, 643179}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {1, 0})     = 0 (Timeout)
select(0, NULL, NULL, NULL, {1, 0})     = 0 (Timeout)
read(4, "\0\0\0\0\1\0\0\0\0\0\0\0a\25\6\0\7\0\0\0\0\20\0\0\0\10\0\0\0\0\0\0"..., 256) = 256
close(4)                                = 0
open("/var/lib/rpm/Packages", O_RDONLY|O_LARGEFILE) = 4
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
fstat64(4, {st_mode=S_IFREG|0644, st_size=5582848, ...}) = 0
brk(0x821e000)                          = 0x821e000
select(0, NULL, NULL, NULL, {0, 1000})  = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 2000})  = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 4000})  = 0 (Timeout)

如何修復rpm它不會掛起?

停止安裝命令並重建您的 rpm 數據庫。

你應該能夠:

rm /var/lib/rpm/__db*

然後:

rpm --rebuilddb

然後再次嘗試安裝。

我遇到了 nfs mount 的問題。rpm 擦除掛起。我無法取消 (Ctrl-C) rpm 程序。rpm 沒有理由訪問這個掛載點。

df命令也掛了。比較mountdf輸出。df 卡住的掛載是個問題。兩個坐騎對我來說是個問題。

umount /badmount沒有工作“umount.nfs:/badmount:設備正忙”。 umount --force -vvv /badmounts擺脫了壞坐騎(遠端機器停機)。然後kill <my rpm process>。那麼rm /var/lib/rpm/__db* && rpm --rebuilddb。從那時起 rpm 再次工作。


rpm -vvv很有用,讓我認為坐騎是個問題。它在列印“已安裝的文件系統:”後掛起

$ rpm -e --noscripts -vvv PACKAGE
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/Packages cdb:mpool:joinenv
D: opening  db index       /var/lib/rpm/Packages rdonly mode=0x0
D: locked   db index       /var/lib/rpm/Packages
D: opening  db index       /var/lib/rpm/Name rdonly mode=0x0
D:  read h#    1489 Header sanity check: OK
D: added key gpg-pubkey-57bbccba-4a6f97af to keyring
D: Using legacy gpg-pubkey(s) from rpmdb
D:  read h#     912 Header SHA1 digest: OK (9fda42f8af7a801b81d14291987d1052d2c17c53)
D: ========== --- OMN-Traffic-Control-vx.xx.xx-1.FC9 i686/linux 0x0
D: opening  db index       /var/lib/rpm/Requirename rdonly mode=0x0
D: ========== recording tsort relations
D: ========== tsorting packages (order, #predecessors, #succesors, tree, depth, breadth)
D:     0    0    0    0    1    0   -OMN-Traffic-Control-vx.xx.xx-1.FC9.i686
D: erasing packages
D: closed   db index       /var/lib/rpm/Requirename
D: closed   db index       /var/lib/rpm/Name
D: closed   db index       /var/lib/rpm/Packages
D: closed   db environment /var/lib/rpm/Packages
D: opening  db environment /var/lib/rpm/Packages cdb:mpool:joinenv
D: opening  db index       /var/lib/rpm/Packages create mode=0x42
D: mounted filesystems:
D:     i        dev    bsize       bavail       iavail mount point

ltrace 有點意思,但沒有給出任何問題的線索。

$ ltrace rpm -e PACKAGE
__libc_start_main(0x8049680, 3, 0xffab6264, 0x804ae90, 0x804ae80 <unfinished ...>
mtrace()                                                                                                      = <void>
strrchr("rpm", '/')                                                                                           = NULL
setlocale(6, "")                                                                                              = "en_US.UTF-8"
bindtextdomain("rpm", "/usr/share/locale")                                                                    = "/usr/share/locale"
textdomain("rpm")                                                                                             = "rpm"
rpmlogSetMask(63, 0x99a390, 0xf63d4e2e, 0xb3ff08, 28)                                                         = 63
poptGetContext(0x804af4c, 3, 0xffab6264, 0x804ce40, 0)                                                        = 0x98528d8
rpmConfigDir(0x804af4c, 3, 0xffab6264, 0x804ce40, 0)                                                          = 0xce2432
rpmGenPath(0xce2432, 0x804af75, 0, 0x804ce40, 0)                                                              = 0x9852b40
poptReadConfigFile(0x98528d8, 0x9852b40, 0, 0x804ce40, 0)                                                     = 0
free(0x9852b40)                                                                                               = <void>
poptReadDefaultConfig(0x98528d8, 1, 0, 0x804ce40, 0)                                                          = 0
rpmConfigDir(0x98528d8, 1, 0, 0x804ce40, 0)                                                                   = 0xce2432
poptSetExecPath(0x98528d8, 0xce2432, 1, 0x804ce40, 0)                                                         = 1
poptGetNextOpt(0x98528d8, 0xce2432, 1, 0x804ce40, 0)                                                          = -1
rpmcliConfigured(0x98528d8, 0xce2432, 1, 0x804ce40, 0)                                                        = 0
urlIsURL(0xd487af, 0xce2432, 1, 0x804ce40, 0)                                                                 = 0
rpmLookupSignatureType(1, 0xce2432, 1, 0x804ce40, 0)                                                          = 0
rpmtsCreate(1, 0xce2432, 1, 0x804ce40, 0)                                                                     = 0x98729c8
rpmtsSetRootDir(0x98729c8, 0xd487af, 1, 0x804ce40, 0)                                                         = 0
poptPeekArg(0x98528d8, 0xd487af, 1, 0x804ce40, 0)                                                             = 0xffab7622
poptGetArgs(0x98528d8, 0xd487af, 1, 0x804ce40, 0)                                                             = 0x9852a70
rpmErase(0x98729c8, 0xd5c440, 0x9852a70, 0x804ce40, 0

引用自:https://serverfault.com/questions/622671