在 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
它才不至于挂起?
答案1
停止安装命令并重建 rpm 数据库。
你应该能够:
rm /var/lib/rpm/__db*
然后:
rpm --rebuilddb
然后再次尝试安装。
答案2
我在使用 nfs mount 时遇到了问题。rpm erasure 挂起了。我无法取消 (Ctrl-C) rpm 进程。rpm 没有理由访问此挂载点。
df
命令也挂了。比较mount
并df
输出。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
答案3
pstree -p `pidof -s rpm`
对我有用。我运行了 ps 命令,试图 grep 查找该进程,但我没有找到所有进程。
pstree -p `pidof -s rpm`
有效,但我必须运行大约 4 - 5 次才能找到并摆脱所有旧的 pid。
我必须使用 kill -9 才能让它们消失。常规 kill 和 killall 不起作用。