Hi everyone,
I am using OpenSUSE 12.3 and I have accidentally deleted /var/lib/rpm/Packages . Is there a way to rebuild or to retrieve it.
Thanks.
Hi everyone,
I am using OpenSUSE 12.3 and I have accidentally deleted /var/lib/rpm/Packages . Is there a way to rebuild or to retrieve it.
Thanks.
rpm --rebuildd
valeria:~ #
valeria:~ # rm /var/lib/rpm/Packages
valeria:~ # l /var/lib/rpm/Packages
ls: cannot access /var/lib/rpm/Packages: No such file or directory
valeria:~ # rpm --rebuilddb
valeria:~ # l /var/lib/rpm/Packages
-rw-r--r-- 1 root root 12K Apr 23 19:14 /var/lib/rpm/Packages
valeria:~ #
I’m afraid you’re wrong and have actually killed your RPM database now as well.
rpm --rebuilddb CANNOT recreate /var/lib/rpm/Packages, it can only recreate the other files in /var/lib/rpm/ out of “Packages”.
Have a look at the size, your RPM database is actually empty now. 12K is way too small, mine has 369MiB!
The only way to get back /var/lib/rpm/Packages is from one of the regular backups in /var/adm/backup/rpmdb/.
Thank you VERY much. As it happens there was a /var/adm/backup/rpmdb/Packages-20140423.gz created only 2 hours before my madness, so the recovery was painless, if humiliating.
Actually my /var/adm/backup/ folder is empty and rpm --rebuild created Packages but “rpm -qa” returns nothing.
As I said, “rpm --rebuilddb” cannot recreate Packages when it is missing, so it creates just an empty one. (how should it know which packages have been installed, when the information it keeps about this is deleted?)
If /var/adm/backup is indeed empty, then you’re out of luck, unfortunately.
You would have to re-install all packages that have been installed, to get back the information in the RPM database.
But please have a look at /var/adm/backup again. You can only access it as root, not user. So maybe it isn’t empty, but you only had insufficient permissions to view it?
What’s the output of:
sudo ls /var/adm/backup /var/adm/backup/rpmdb
If it is really empty, please have a look at /etc/sysconfig/backup (variable “RPMDB_BACKUP_DIR”), maybe a different directory is configured there on your system? (but /var/adm/backup/rpmdb is the default)
On 2014-04-24 13:46, wolfi323 wrote:
> If /var/adm/backup is indeed empty, then you’re out of luck,
> unfortunately.
Yep. If there is an external backup…
Otherwise, perhaps install another openSUSE somewhere (do not update
it), and copy the file over. :-?
Or, install the distro from the full DVD on the existing partition,
making sure it is NOT formatted again.
Of course, the system would have things installed that YaST doesn’t know
about. Like having something installed but not listed, or listed and not
installed, or different version installed.
And of course, automatic updates for non-listed packages would not happen.
> You would have to re-install all packages that have been installed, to
> get back the information in the RPM database.
It is possible to tell rpm to fake the installation of a package
updating only the database.
> But please have a look at /var/adm/backup again. You can only access it
> as root, not user. So maybe it isn’t empty, but you only had
> insufficient permissions to view it?
That’s a possibility and a hope
> If it is really empty, please have a look at /etc/sysconfig/backup
> (variable “RPMDB_BACKUP_DIR”), maybe a different directory is configured
> there on your system? (but /var/adm/backup/rpmdb is the default)
Assuming that this is a standard install. Maybe it is a customized
thing, like one of those on hosted sites?
–
Cheers / Saludos,
Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)