How to create one rpm package which only contains specified directory?

Florian Festi ffesti at redhat.com
Fri May 22 10:33:17 UTC 2009


He Yunlong-B20256 wrote:
> Hi, Experts,
>  
>     I have one directory like this (about 300M, over 50000 files):
>  
>             /opt/xxx/usr/local/gcc-4.3-binutils-2.18
>  
>     I want to create one rpm package for it, when installing the rpm
> package, it should extract the files and put it to the same location
> (/opt/xxx/usr/local/gcc-4.3-binutils-2.18)
>  
>     finally I got the package, but when installing the rpm, it hangs
> with only printing out "preparing...", then I have to kill it manually
>  
>         [sstims at harry_rh52 ~]$ sudo rpm -Uvh --nodeps --nofiles
> --noscript --nomd5 cs-xxx.rpm
>         Preparing...                Killed
> 
>     with help of strace, it hangs with mmap2 system call
>  
>          #sudo strace rpm -ivh cs-xxx.rpm 
>         ...
>         mremap(0x545a6000, 1616502784, 1616506880, MREMAP_MAYMOVE) =
> 0x545a6000
>         pread64(6,
> "\0\0\0\0\1\0\0\0\363\1\0\0\0\0\0\0\0\0\0\0\214\0a\7\0\2\367\17\356\17\3
> 46\17"..., 4096, 2043904) = 4096
>         mmap2(NULL, 1077669888, PROT_READ|PROT_WRITE,
> MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x141e7000
>         Killed
> 
>     I restart the machine and run "sudo rpm --rebuilddb", but still
> failed.
>  
>     If I package it with fewer files, it can be installed, but still
> very slow.  The most strange issue is that it need much memory when
> installing the rpm package, about 800M is used, but finally hang.
>  
>     Can you help to have a look on this issue? 
>  
>                 I build the rpm package with rpm 4.0.4, and install the
> package with rpm 4.4.2
>                 I failed to create the rpm package with rpm 4.4.2,
> segment fault occured.

This is a known problem of rpm < 4.7. Huge amount of files - especially with 
the same basename (which shouldn't be the case here if I understood you 
right) - lead to intermediate data and rpmdb requests of #files square size. 
This can easily lead to memory usage beyond the 2GB address space or the 
memory of even a good equipped 64bit machine. Unfortunately removing the 
package takes even about double the memory... Runtime usage also gets out of 
hand as you are experiencing.

Your only chance is trying a more recent rpm version which has this problem 
fixed.

Florian


More information about the Rpm-list mailing list