Bug 113224 - rpm -e linuxconf segfaults
rpm -e linuxconf segfaults
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
8.0
i586 Linux
medium Severity medium
: ---
: ---
Assigned To: Paul Nasrat
Mike McLean
http://dogod.com/~matthew/rpmdb.tar.gz
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-01-09 16:28 EST by Matthew Kleinmann
Modified: 2007-04-18 13:01 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-04-19 14:39:37 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Matthew Kleinmann 2004-01-09 16:28:27 EST
Description of problem:rpm -e linuxconf segfaults.
Followed procedure at:

http://www.geocrawler.com/mail/msg.php3?msg_id=7971730&list=87


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

How reproducible:
every time, 100%

Steps to Reproduce:
1.run rpm -e linuxconf
2.
3.
  
Actual results:
root@dogod 16:25:56 # rpm -e linuxconf
Segmentation fault
root@dogod 16:26:06 # rpm -e linuxconf
Segmentation fault
root@dogod 16:26:08 # rpm -e linuxconf
Segmentation fault
root@dogod 16:26:09 # rpm -e linuxconf
Segmentation fault
root@dogod 16:26:10 #

You get the idea...


Expected results:
root@dogod 16:27:56 # rpm -e star
root@dogod 16:28:02 #


Additional info:

I am sure there is something messed up inside of the db.  Often RPM -
Uvh will hang.  I need to nuke the __db* files and rpm --rebuilddb 
way too often.  rpm -Va will segfault, in fact I think it dies at 
liuxconf.  Something about that record.  From the above mentioned URL 
I atempted to echo the debug info onto the /etc/rpm/macros file and 
run the rpm -qa with no joy, (it ran fine w no debug output) I also 
ran rpm -e linuxconf and it segfaulted with no output.

Jeff, can you help?

73's Matthew  KG2LH
Comment 1 Jeff Johnson 2004-01-10 14:15:25 EST
Upgrade to rpm-4.1.1 from ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.1.x
recommended.

To install, try
    rm -f /var/lib/rpm/__db*
before installing. If that doesn't work, reopen the
bug and I'll tell you how to manually upgrade using rpm2cpio.
Comment 2 Matthew Kleinmann 2004-01-12 16:08:30 EST
Hello, and thank you very much for the reply.  I downloaded the suite 
of packages, installed them, and the probem persists.  Here is a log 
of my actions:

root@dogod 16:00:27 # ls *.rpm
popt-1.7.1-1.8x.i386.rpm  rpm-build-4.1.1-1.8x.i386.rpm
rpm-4.1.1-1.8x.i386.rpm   rpm-python-4.1.1-1.8x.i386.rpm

root@dogod 16:04:26 # rpm -Uvh *.rpm
warning: popt-1.7.1-1.8x.i386.rpm: V3 DSA signature: NOKEY, key ID 
2039b291
Preparing...                
########################################### [100%]
   1:popt                   
########################################### [ 25%]
   2:rpm                    
########################################### [ 50%]
   3:rpm-build              
########################################### [ 75%]
   4:rpm-python             
########################################### [100%]
root@dogod 16:04:51 #


root@dogod 16:05:20 # ls /var/lib/rpm
Basenames     __db.003  Installtid  Providename     Requireversion
Conflictname  Dirnames  Name        Provideversion  Sha1header
__db.001      Filemd5s  NOISE       Pubkeys         Sigmd5
__db.002      Group     Packages    Requirename     Triggername
root@dogod 16:05:28 # rpm -e linuxconf
Segmentation fault
root@dogod 16:05:41 #


root@dogod 16:05:41 # rm /var/lib/rpm/__db.00*
root@dogod 16:06:18 # rpm --rebuilddb
root@dogod 16:07:22 #


root@dogod 16:07:22 # rpm -e linuxconf
Segmentation fault
root@dogod 16:07:49 #


root@dogod 16:07:49 # rpm -vv -e linuxconf
D: unshared posix mutexes found(38), adding DB_PRIVATE, using fcntl 
lock
D: opening  db environment /var/lib/rpm/Packages 
create:cdb:mpool:private
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#     102 Header sanity check: OK
D: ========== --- linuxconf-1.24r2-10 i386/linux 0x0
D: opening  db index       /var/lib/rpm/Requirename rdonly mode=0x0
Segmentation fault
root@dogod 16:08:09 #
Comment 3 Jeff Johnson 2004-01-12 20:25:54 EST
OK. Try
    rm -f /var/lib/rpm/Pubkeys
and repeat the --erase command.

If that fixes, try
    rpm --rebuilddb -vv

There's a problem fixed in rpm-4.2.2-0.6 that has the above symptoms.
Comment 4 Matthew Kleinmann 2004-01-13 07:34:07 EST
Hi Jeff, 

Still no joy.

root@dogod 07:35:42 # rm -f /var/lib/rpm/Pubkeys
root@dogod 07:35:46 # rpm -e linuxconf
Segmentation fault
root@dogod 07:35:55 #
Comment 5 Jeff Johnson 2004-01-15 07:51:01 EST
OK, time to remove the hard way.

Run rpm -qavv and take note of the header instance
for linuxconf:
    D:  read h#    2686 Header ...

Download ftp://people.redhat.com/jbj/t38454.c, edit in
the header instance number, compile, and run to erase
the linuxconf header from the database.

The "38454" refers to the bugzilla number which caused
program to be written. There should be (somewhat sated)
instructions on how to compile and use there.

You will need to do rpm --rebuilddb -vv afetrwards.

Comment 6 Matthew Kleinmann 2004-01-15 15:03:56 EST
What package is the db.h headder in?  I am having compile errors:

root@dogod 14:57:50 # cc -o t38454 t38454.c -ldb-3.1
t38454.c:3:20: db3/db.h: No such file or directory
t38454.c: In function `main':
t38454.c:15: `DB' undeclared (first use in this function)
t38454.c:15: (Each undeclared identifier is reported only once
t38454.c:15: for each function it appears in.)
t38454.c:15: `dbp' undeclared (first use in this function)
t38454.c:16: `DBT' undeclared (first use in this function)
t38454.c:16: parse error before "key"
t38454.c:25: `DB_HASH' undeclared (first use in this function)
t38454.c:25: `DB_CREATE' undeclared (first use in this function)
t38454.c:32: `key' undeclared (first use in this function)
t38454.c:33: `data' undeclared (first use in this function)
t38454.c:48: `DB_NOTFOUND' undeclared (first use in this function)
root@dogod 15:01:33 # 

I will keep digging at this in the meantime...  Thanks for your help 
so far..
Comment 7 Matthew Kleinmann 2004-01-15 15:17:51 EST
...

Ok, I am running RH8 so I have db4.  I fixed the line in the program, 
and it compiled w/o any errors.  I ran the program, and rebuild the 
db and....

root@dogod 15:17:50 # rpm -q linuxconf
linuxconf-1.24r2-10
root@dogod 15:18:03 # rpm -e linuxconf
Segmentation fault
root@dogod 15:18:15 #

This is the output from the first rpm -qavv where I got the headder 
number for liuxconf:

linuxconf-1.24r2-10
D:  read h#     104 Header V3 DSA signature: NOKEY, key ID db42a60e

That is number 104 correct?  That is the number I stuck into the 
program.
Comment 8 Jeff Johnson 2004-01-15 15:22:17 EST
Hmmm, look for /usr/include/db4/db.h, that's probably
what you want.

The include should be in the db4-devel package. That can be
installed manually, poke me and I'll tell you what to do if
not installed.

-ldb-3.1 will need change too, probably to -ldb4.1 or -ldb-4.0

Sorry for not explaining more carefully. I forget sometimes ...

Hmmm, i just noticed your database in the URL. Lemme see if I can
fix here ... hang on ...


Does that compile t38454.c?
Comment 9 Jeff Johnson 2004-01-15 15:23:00 EST
Yes, 104 is the header instance number.
Comment 10 Jeff Johnson 2004-01-15 15:24:18 EST
BTW, the header instance number can/will change after --rebuilddb,
so don't do --rebuilddb after extracting the number.
Comment 11 Matthew Kleinmann 2004-01-15 15:32:52 EST
No problem on the db number.  I ran into that one before.  I did 
forget to cahnge the -l on the compile linhe though.  I am sort of 
surprised it did not make any noise about that.  It looks like I have 
the 4.0 version of the libs.

I need to go back and get the errent headder number out and try yet 
again.

One other q.  Afer I run the program to remove the errent headder 
from the db, should I remove the __db* files before doing a 
rebuilddb?  I did not do that last time, and that sort of bothered 
me, being so used to doing that before a rebuild...
Comment 12 Jeff Johnson 2004-01-16 00:34:46 EST
Remove the __db* or not, there will be warning/error if you need to
remove.
Comment 13 Matthew Kleinmann 2004-01-16 14:52:33 EST
Did you ever feel like you where cursed?

Ok, after messing up compileing the toy program with the wrong -l 
option on the command line, things got a bit odd.  I also went back 
and re-visited the origional bug report.  One thing I had not done 
was to run my Packages file through the db_dump | db_load pipe.  When 
I attempted that it made noise at me of an unknown hash type.  I then 
extracted the Packages file from my backup to /tmp and tried the same 
pipe, and it ran fine on that.  I am assuming that I somehow managed 
to mangle the Packages file with the abbarent toy.  

So.., I backed up my current /var/lib/rpm and then removed it and 
restored the origional one I had backed up.  I was then able to do 
the packages thing, and then got the headder number (212 this time..) 
and compiled the toy with that value in it.  When I ran the toy this 
time it came back and said it had removed those headders.  This was 
the first time it had done that, so that seemed good.  After that I 
followed the recomendation in the origional bug report and ran rpm -
qa followed by rpm -rebuilddb -vv and that ran fine.  Interestingly 
after I was done with this:

root@dogod 14:44:47 # rpm -qa | grep linuxconf
error: rpmdbNextIterator: skipping h#      94 Header V3 DSA 
signature: BAD, key ID db42a60e
linuxconf-1.24r2-10
root@dogod 14:45:10 # rpm -e linuxconf
Segmentation fault
root@dogod 14:45:17 #

Aarg.  Any more thoughts.  Something is really not right here.

Thanks for all your help so far..

--Matthew
Comment 14 Matthew Kleinmann 2004-01-16 15:09:11 EST
I tried this:
root@dogod 15:06:58 # rpm -qa > /dev/null
error: rpmdbNextIterator: skipping h#      89 Header V3 DSA 
signature: BAD, key ID db42a60e
root@dogod 15:08:19 #

and found another messed up entery, so I went back and edited the toy 
for headder 89 and re-compiled it..

root@dogod 15:06:35 # rm t38454
root@dogod 15:06:41 # cc -o t38454 t38454.c -ldb-4.0
root@dogod 15:06:55 # ./t38454
/var/lib/rpm/Packages: Invalid argument

This is what I was getting the last time, if I go to /var/lib/rpm and 
do a db_dump on Packages I get this:

root@dogod 15:08:19 # ls -l /var/lib/rpm/Packages
-rw-rw-r--    1 root     root      7180288 Jan 16 
14:38 /var/lib/rpm/Packages
root@dogod 15:10:53 # db_dump /var/lib/rpm/Packages
db_dump: /var/lib/rpm/Packages: unsupported hash version: 8
db_dump: open: /var/lib/rpm/Packages: Invalid argument
root@dogod 15:11:05 #

FYI, I have also removed (rpm -e --nodeps) the db4 and db4-devel 
packages just incase they where corrupt.  I am really at a loss as to 
what is going on here.
Comment 15 Jeff Johnson 2004-01-16 19:41:37 EST
unsupported hash is form access db-4.1.25 format database w db-4.0.14
tools.

There were just two bugs against rpm today that have procedure for fix.

A signature BAD can be due to eith broken pubkey or damaged data.

rm -f /var/lib/rpm/Pubkeys will eliminate the broken pubkey aspect,
anything else is data error.

You might try /usr/lib/rpm/rpmdb_dump instead of db_dump. There
is full set of db4-utils in /usr/lib/rpm that should match
the db version used by rpm.

Sanity: What does /usr/lib/rpm/rpmdb_verify /var/lib/rpm/Packages say
right now?
Comment 16 Matthew Kleinmann 2004-01-19 08:46:27 EST
What package do the /usr/lib/rpm/ versions of the db tools come in?  
I do not have them.

matthew@dogod 08:50:00 $ ls /usr/lib/rpm/
athlon-linux              find-lang.sh        javadeps        rpme
athlon-redhat-linux       find-provides       macros          rpmi
brp-compress              find-provides.perl  magic           rpmk
brp-redhat                find-prov.pl        magic.mgc       rpm.log
brp-sparc64-linux         find-req.pl         magic.mime      rpmpopt-
4.1
brp-strip                 find-requires       magic.mime.mgc  rpmq
brp-strip-comment-note    find-requires.perl  magic.prov      rpmrc
brp-strip-shared          get_magic.pl        magic.req       rpmt
brp-strip-static-archive  getpo.sh            mkinstalldirs   rpmu
check-files               http.req            noarch-linux    rpmv
check-prereqs             i386-linux          perldeps.pl     
rpm.xinetd
config.guess              i386-redhat-linux   perl.prov       tgpg
config.site               i486-linux          perl.req        trpm
config.sub                i486-redhat-linux   rpm2cpio.sh     u_pkg.sh
convertrpmrc.sh           i586-linux          rpmb            vpkg-
provides2.sh
cross-build               i586-redhat-linux   rpmd            vpkg-
provides.sh
debugedit                 i686-linux          rpm.daily
find-debuginfo.sh         i686-redhat-linux   rpmdeps
matthew@dogod 08:50:03 $
Comment 17 Jeff Johnson 2004-02-11 01:49:24 EST
If you don't have the tools in /usr/lib/rpm, then
use those in the db4-utils package.

Comment 18 Jeremy Katz 2005-04-19 14:39:37 EDT
Closing due to inactivity.  If this issue still occurs with current releases,
please reopen and set the release in which you've encountered the problem.

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