update problems/ zypp issue?

My system works, except it doesn’t recognize any of the installed rpm’s. When I try to set up online update I get the following error:
‘zypp::Exception’
what(): Failed to cache rpm database (139)
So anytime I try to install anything it reinstalls pretty much every package, except it really doesn’t install most things, only some. Weird beyond words.
Any help is greatly appreciated

parkerfilms wrote:

>
> My system works, except it doesn’t recognize any of the installed
> rpm’s. When I try to set up online update I get the following error:
> ‘zypp::Exception’
> what(): Failed to cache rpm database (139)
> So anytime I try to install anything it reinstalls pretty much every
> package, except it really doesn’t install most things, only some.
> Weird beyond words.
> Any help is greatly appreciated
>
>

have you tried ( as root ) typing in a console:

rpm rebuilddb

This will rebuild the rpm database which might solve your prob, sometimes the db gets a bit confused :slight_smile:

HTH


Mark…

Nil illegitimi carborundum

in a terminal as su

rpmdb --rebuilddb

then

zypper refresh

if you want to update

zypper up

I have the same problem after a memory failure and applying the above commands doesn’t help. Rebuilding the RPM DB doesn’t bring up any error, but zypper isn’t able to gather it anyway:
linux:~ # rpm --rebuilddb
linux:~ # zypper ref
Target initialization failed:
Failed to cache rpm database (139).

Try to remove the zypp cache as well:

sudo rm -r /var/cache/zypp

Unfortunately even removing the zypper cache didn’t help:


rkrell:/var/cache # rm -rf zypp*
rkrell:/var/cache # rpm --rebuilddb
rkrell:/var/cache # zypper ref
Target initialization failed:
Failed to cache rpm database (139).

OS: OpenSUSE 13.1

Hm, does something like this work?

rpm -q aaa_base

As you say you rebuilt the RPM database already, there shouldn’t be any problem with it.

Probably this can also be caused by problems with a repo, so try to disable all of them (in YaST->Software Repositories f.e.).
Does “zypper ref” work then? (shouldn’t do much then of course)
If yes, try to enable the repos one by one and call “zypper ref” again each time, to find out which repo causes the problem.

On 2014-02-20 12:16, wolfi323 wrote:

> As you say you rebuilt the RPM database already, there shouldn’t be any
> problem with it.

Sometimes this does not work at all.

There is a backup of the rpm database on /var/adm/backup/rpmdb. Looking
at mine here, I have 5 copies, done with 5 about days separation each.
After that, they are erased.

You have to replace the current /var/lib/rpm/Packages file with an
expanded backup, delete the rest of the rpmdatabases, run rebuild, and
try. If it doesn’t work, pick the following older backup… till one
works. If it does.

This is an emergency procedure, leave that till the end. But make sure
the backups are not cycled out before you want to try them.


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

Right, but that rpm -q command should give an error message then as well I’d think.

There is a backup of the rpm database on /var/adm/backup/rpmdb. Looking
at mine here, I have 5 copies, done with 5 about days separation each.
After that, they are erased.

Ah, I nearly forgot about that. I haven’t needed it ever yet.

This is done by the cronjob /etc/cron.daily/suse.de-backup-rpmdb.
This is run daily and by default keeps a maximum of 5 backups (but that can be configured in /etc/sysconfig/backup).

I haven’t found any problem querying the RPM database.
It doesn’t seem to depend on the zypper/YaST repositories. I refreshed all enabled repos in YaST and there was no problem in rebuilding the caches. I just can’t see any information on installed packages in the YaST installation, for the given reason, accessing the RPM database, which seems to appear as first step in ‘zypper ref’ is still broken.

That’s it. I tried the backup and found the most recent one before the hardware failure and disk corruption.
Doing so, removing all databases in /var/lib/rpm, unpacking /var/adm/backup/rpmdb/Packages-20140218.gz as /var/lib/rpm/Packages and doing ‘rpm --rebuilddb’ did the job.
All runs fine now.

Thank you all for your help.

On 2014-02-20 16:26, renekrell wrote:

>
> That’s it. I tried the backup and found the most recent one before the
> hardware failure and disk corruption.
> Doing so, removing all databases in /var/lib/rpm, unpacking
> /var/adm/backup/rpmdb/Packages-20140218.gz as /var/lib/rpm/Packages and
> doing ‘rpm --rebuilddb’ did the job.
> All runs fine now.

Wow.
One of those rare bad events. :open_mouth:

You will now have to run updates. Anything that you installed or updated
after that backup, YaST will know nothing about them and will want to
reinstall them. Just allow it.

> Thank you all for your help.

Welcome.


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

Of course. I use rpm for installing just in rare cases directly, and YaST software installation didn’t work due to the discussed problem. So there hasn’t been any change of installed files against the restored rpm database. What a luck :slight_smile: