3

On Cent OS 5, rpm command hung on my Linux machine.

[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

Below is the 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)

How do I fix rpm so it does not hang?

2
  • 1
    have you some nfs mounted in your system?
    – c4f4t0r
    Aug 20, 2014 at 11:42
  • Maybe some pre/post install script hung? Try pstree -p `pidof -s rpm`
    – LatinSuD
    Aug 20, 2014 at 12:23

3 Answers 3

9

Stop the install command and rebuild your rpm database.

You should be able to:

rm /var/lib/rpm/__db*

Then:

rpm --rebuilddb

Then attempt your installation again.

0

I had a problem with nfs mount. rpm erase was hanging. I couldn't cancel (Ctrl-C) the rpm process. There was no reason why rpm should have been accessing this mount point.

df command was also hanging. Compare mount and df output. The mount that df got stuck on was a problem. Two mounts were a problem for me.

umount /badmount didn't work "umount.nfs: /badmount: device is busy". umount --force -vvv /badmounts got rid of the bad mount (remote machine was down). Then kill <my rpm process>. THen rm /var/lib/rpm/__db* && rpm --rebuilddb. From then on rpm working again.


rpm -vvv was useful and led me to think that mounts were a problem. It was hanging after printing "mounted filesystems:"

$ 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

An ltrace was vaguely interesting but didn't give any clue to problem.

$ 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
0
pstree -p `pidof -s rpm`

worked for me. I was running ps commands trying to grep for the process but I didn't find them all.

pstree -p `pidof -s rpm` 

worked but I had to run it about 4 - 5 times to find and get rid all of the old pids.

And I had to use kill -9 to make them go away. Normal kill and killall wouldn't work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .