Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

When RPM goes bad........

Discussion in 'General Discussion' started by bhznat, Jun 25, 2005.

  1. bhznat

    bhznat Active Member

    Joined:
    Jun 2, 2004
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    151
    I have found this somewhere & it resolved my problem. I have posted in this thread, hope help others.

    recently I had a problem after updating apt and rpm that my rpm install got itsself all confused. It came back with the following error:
    [root@gateway /]# rpm -q spamassassin
    rpmdb: unable to join the environment
    error: db4 error(11) from dbenv->open: Resource temporarily unavailable
    error: cannot open Packages index using db3 - Resource temporarily unavailable (11)
    error: cannot open Packages database in /var/lib/rpm



    to fix this I had to do the following: rm /var/lib/rpm/__* && rpm --rebuilddb

    and then select to delete the 3 files I was prompted to delete.

    after this my rpm install was fine.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. haze

    haze Well-Known Member

    Joined:
    Dec 21, 2001
    Messages:
    1,550
    Likes Received:
    3
    Trophy Points:
    318
    Is this a legacy redhat machine ?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. bhznat

    bhznat Active Member

    Joined:
    Jun 2, 2004
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    151
    Yes & No. Actually my box running CentOS 3.5 now & this problem occurred when cpanel updated the machine from CentOS 3.4 to 3.5.

    I got this error:

    rpmdb: Program version 4.2 doesn't match environment version
    error: db4 error(22) from dbenv->open: Invalid argument
    error: cannot open Packages index using db3 - Invalid argument (22)
    error: cannot open Packages database in /var/lib/rpm
    Traceback (most recent call last):
    File "/usr/bin/yum", line 30, in ?
    yummain.main(sys.argv[1:])
    File "/usr/share/yum/yummain.py", line 163, in main
    (log, errorlog, filelog, conf, cmds) = parseCmdArgs(args)
    File "/usr/share/yum/yummain.py", line 75, in parseCmdArgs
    conf=yumconf(configfile=yumconffile)
    File "/usr/share/yum/config.py", line 155, in __init__
    self.yumvar['releasever'] = self._getsysver()
    File "/usr/share/yum/config.py", line 285, in _getsysver
    idx = ts.dbMatch('provides', self.distroverpkg)
    TypeError: rpmdb open failed

    Note that cPanel "Rebuild RPM Database" under "Software" cannot help you.

    The solution is simply doing:

    #rm -fr /var/lib/rpm/__*
    #rpm --rebuilddb

    Also chirpy suggests this:
    :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. brentp

    brentp Well-Known Member

    Joined:
    Mar 11, 2004
    Messages:
    324
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Ayr, North Queensland, Australia
    I got that quite a lot when doing 3.3-3.5 and 3.5-4.1, and for some weirdass reason it was the PublicKeys file making rpm crash.

    Regards,
    Brent
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. flipside

    flipside Registered

    Joined:
    Oct 17, 2004
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    151
    Hey,

    Yep, this has been happening with me on all new installs with CentOS 3.4 and cPanel.

    Nothing will install and I get all these errors such as:

    rpmdb: Program version 4.2 doesn't match environment version
    error: db4 error(22) from dbenv->open: invalid argument
    error: cannot open Packages index using db3 - invalid argument (22)
    error: cannot open Packages database in /var/lib/rpm
    (repeats listing specific packages).

    I'm trying the suggestions in above posts and we'll see what happens. Thanx.
     
  6. Snowman30

    Snowman30 Well-Known Member
    PartnerNOC

    Joined:
    Apr 7, 2002
    Messages:
    679
    Likes Received:
    0
    Trophy Points:
    316
    cPanel Access Level:
    DataCenter Provider
    Ive found one of my Centos 3.5 servers is missing the rpm list from within WHM

    Ive followe dchirpy's suggestion of rpm --rebuilddb -v -v and it seemed to do the trick but i go back into whm and the rpm list is still blank.

    anyone have any suggestions?
     
  7. brentp

    brentp Well-Known Member

    Joined:
    Mar 11, 2004
    Messages:
    324
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Ayr, North Queensland, Australia
    Ok, this is slightly off-topic. However, i recently had a RPM Database crash where all my installed rpms vanised (or most of them). RPM Writes to /var/log/rpmpkgs to show all the rpms it has installed.

    Code:
    cat /var/log/rpmpkgs | wc -l
    cat /var/log/rpmpkgs.2 | wc -l
    cat /var/log/rpmpkgs.3 | wc -l
    cat /var/log/rpmpkgs.4 | wc -l
    
    There are .1, .2 etc files because logrotate (luckily) backs them up.

    One box was a disaster zone:

    Code:
    root@178561 [/usr/src/rpmdbfix]# cat /var/log/rpmpkgs | wc -l
    134
    root@178561 [/usr/src/rpmdbfix]# cat /var/log/rpmpkgs.2 | wc -l
    66
    root@178561 [/usr/src/rpmdbfix]# cat /var/log/rpmpkgs.3 | wc -l
    25
    root@178561 [/usr/src/rpmdbfix]# cat /var/log/rpmpkgs.4 | wc -l
    69
    root@178561 [/usr/src/rpmdbfix]#
    
    Whichever file has the most rpms, get it and this simple perl script should fix it.

    Code:
    #!/usr/bin/perl
    # "Reinstall" rpms script by BrentP
    mkdir("/usr/src/rpmdbfix");
    chdir("/usr/src/rpmdbfix");
    open(VAR, "/var/log/rpmpkgs.NUMBERHERE");
    my @RPMPKGS = <VAR>;
    foreach my $line (@RPMPKGS) {
    system("wget","http://mirror.centos.org/centos/4/os/i386/CentOS/RPMS/$line");
    system("rpm","-iv","--nodeps", "--justdb","--noscripts","--force","--notriggers","$line");
    }
    close(VAR);
    
    That is obviously for a centos 4 box.

    Regards.
    Brent
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,480
    Likes Received:
    29
    Trophy Points:
    158
    cPanel Access Level:
    DataCenter Provider
    try

    export LD_ASSUME_KERNEL=2.4.1

    before running yum
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice