Bug 135200 - rpm -ivh takes long time to install kernel rpm
Summary: rpm -ivh takes long time to install kernel rpm
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: Mike McLean
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-10-10 03:42 UTC by Steven Shiau
Modified: 2007-11-30 22:10 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-12-08 04:00:48 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Steven Shiau 2004-10-10 03:42:12 UTC
Description of problem:
I am trying to install kernel-smp-2.6.8-1.521.i586.rpm into atypical
root directory (/tftpboot/node_root) for the diskless clients to use.
rpm version: rpm-4.3.1-0.3
OS: fedora core 2

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. mkdir -p /tftpboot/node_root/var/lib/
2. rsync -a /var/lib/rpm /tftpboot/node_root/var/lib/
3. rpm -ivh -vvv  --root /tftpboot/node_root/ --force --nodeps
--noscripts kernel-smp-2.6.8-1.521.i586.rpm

  
Actual results:
However, it takes more than 30 minutes to finish this...
I also tried to use the rpm in the development (version: 4.3.2-10),
the result is the same.

ps. The "rpm -ivh -vvv" stopped in "D: opening  db index
/var/lib/rpm/Basenames create mode=0x42" like this:
--------------------------------------------------------------
...
Preparing...                D: computing file dispositions
D: opening  db index       /var/lib/rpm/Basenames create mode=0x42
--------------------------------------------------------------
I have to wait for more than 30 minutes until it shows
"########################################### [100%]"

Expected results:
Finish in less than 3 minutes

Additional info:

Comment 1 Jeff Johnson 2004-10-10 16:03:18 UTC
How many kernels do you have installed? In fact, please
attach rpm -qa output here.

How large a memory footprint (i.e. check with top)?

What sort of machine? Are you swapping because of too little RAM?




Comment 2 Steven Shiau 2004-10-11 02:22:21 UTC
1. rpm -qa |grep kernel
kernel-2.6.8-1.521drbl
kernel-sourcecode-2.6.8-1.521
kernel-smp-2.6.8-1.584
kernel-smp-2.6.5-1.358
kernel-smp-2.6.8-1.541
kernel-smp-2.6.8-1.521
kernel-utils-2.4-9.1.131
kernel-2.6.5-1.358

2. free
             total       used       free     shared    buffers     cached
Mem:       1025948     949012      76936          0     251304     187236
-/+ buffers/cache:     510472     515476
Swap:      1959888     298284    1661604

3. Intel P4 2.6 GHz with 1G RAM

I also tried this in my VMWare with 256MB RAM, and it takes longer.
However, for the same installation, if I run it in in Fedora Core 1
with rpm-4.2.1-0.30, it finished in 1 minute in VMWare with 256MB RAM.

Comment 3 Jeff Johnson 2004-10-11 03:51:25 UTC
Hmm, not too many kernels, lots of memory, fast machine.

30 minutes is way too long. I've seen 5-7 minutes with
30 kernels installed, there's a slow %post script that
walks /lib/modules, creating hardlinks iirc.

Can you try attaching strace, looking for pread calls
that indicate rpmdb being read?

You might try rpm --rebuilddb -vv to recreate the Basenames
(and all the other) indexes. I don't expect --rebuilddb to
change the behavior, but it won't hurt.

Comment 4 Jeff Johnson 2004-10-11 03:53:50 UTC
There's also a --stats option that will time various
operations. You might try that with a few non-kernel
packages to get a feel for where rpm spends time, then
see where the kernel install slows down so much.

Comment 5 Steven Shiau 2004-10-11 09:10:51 UTC
The following case I run is in my VMWARE 4.21 (256 MB allocated) with
host machine (dual Xeon 2.4 GHz, 1GB RAM). Still Fedora Core 2.

I rebuild the rpm DB by "rpm --rebuilddb -vv", then install the kernel
again by 
1. mkdir -p /tftpboot/node_root/var/lib/
2. rsync -a /var/lib/rpm /tftpboot/node_root/var/lib/
3. time rpm -ivh -vvv  --root /tftpboot/node_root/ --force --nodeps
--noscripts kernel-smp-2.6.8-1.521.i586.rpm

The time required is:
real    34m33.051s
user    21m35.107s
sys     12m37.675s

It seems like in the very beginning, the strace shows a lot of "(No
such file or directory)" in /lib/modules/2.6.8-1.521, but I actually I
run rpm with --root /tftpboot/node_root/, is that correct checking ?
The rpm program spent most of its time in the "(No such file or
directory)"... 
-----------------------
...
stat64("/lib/modules/2.6.8-1.521/build/arch", 0xbff92c90) = -1 ENOENT
(No such file or directory)
stat64("/lib/modules/2.6.8-1.521/build", 0xbff92c90) = -1 ENOENT (No
such file or directory)
stat64("/lib/modules/2.6.8-1.521", 0xbff92c90) = -1 ENOENT (No such
file or directory)
stat64("/lib/modules", 0xbff92c90)      = -1 ENOENT (No such file or
directory)
stat64("/lib", 0xbff92c90)              = -1 ENOENT (No such file or
directory)
stat64("/lib/modules/2.6.8-1.521/build/arch/mips/au1000", 0xbff92c90)
= -1 ENOENT (No such file or directory)
stat64("/lib/modules/2.6.8-1.521/build/arch/mips", 0xbff92c90) = -1
ENOENT (No such file or directory)
stat64("/lib/modules/2.6.8-1.521/build/arch", 0xbff92c90) = -1 ENOENT
(No such file or directory)
stat64("/lib/modules/2.6.8-1.521/build", 0xbff92c90) = -1 ENOENT (No
such file or directory)
stat64("/lib/modules/2.6.8-1.521", 0xbff92c90) = -1 ENOENT (No such
file or directory)
stat64("/lib/modules", 0xbff92c90)      = -1 ENOENT (No such file or
directory)
stat64("/lib", 0xbff92c90)              = -1 ENOENT (No such file or
directory)
stat64("/lib/modules/2.6.8-1.521/build/arch/mips/au1000/mtx-1",
0xbff92c90) = -1 ENOENT (No such file or directory)
stat64("/lib/modules/2.6.8-1.521/build/arch/mips/a
...


Comment 6 Steven Shiau 2004-10-11 09:16:03 UTC
BTW, my point is that if I run "rpm -ivh --root /tftpboot/node_root",
it takes a lot of time to install the kernel rpm in Fedora Core 2.
The key is "--root /tftpboot/node_root".
However, If I install kernel by "rpm -ivh" WITHOUT "--root
/tftpboot/node_root", the time spent maybe just 3-5 minutes.
Also, I tried to run "rpm -ivh --root /tftpboot/node_root" in FC1, it
works very well...

Comment 7 Jeff Johnson 2004-12-08 04:00:48 UTC
The code paths within rpm are almost identical for the two
cases you report, --root adds a chroot(2) call to enter and
exit the chroot, nothing else. So your perceived "slow"
behavior when using --root /tftpboot is likelier to be
related to kernel file system caching, not anything
within rpm.


Note You need to log in before you can comment on or make changes to this bug.