Results 1 to 7 of 7

Thread: /var/lib/rpm/Packages missing

  1. #1
    Join Date
    Oct 2012
    Location
    India
    Posts
    332

    Default /var/lib/rpm/Packages missing

    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.

  2. #2
    Join Date
    Oct 2008
    Location
    Glasgow, Scotland
    Posts
    1,145

    Default Re: /var/lib/rpm/Packages missing

    rpm --rebuildd
    Code:
    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:~ #
    ~Thank you for sharing an interesting problem.
    --
    slàinte mhath,
    rayH

  3. #3

    Default AW: Re: /var/lib/rpm/Packages missing

    Quote Originally Posted by eng-int View Post
    rpm --rebuildd
    Code:
    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/.

  4. #4
    Join Date
    Oct 2008
    Location
    Glasgow, Scotland
    Posts
    1,145

    Default Re: AW: Re: /var/lib/rpm/Packages missing

    Quote Originally Posted by wolfi323 View Post
    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.
    ~Thank you for sharing an interesting problem.
    --
    slàinte mhath,
    rayH

  5. #5
    Join Date
    Oct 2012
    Location
    India
    Posts
    332

    Default Re: AW: Re: /var/lib/rpm/Packages missing

    Quote Originally Posted by wolfi323 View Post
    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/.
    Actually my /var/adm/backup/ folder is empty and rpm --rebuild created Packages but "rpm -qa" returns nothing.

  6. #6

    Default AW: Re: AW: Re: /var/lib/rpm/Packages missing

    Quote Originally Posted by nishanth9042 View Post
    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:
    Code:
    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)

  7. #7
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: /var/lib/rpm/Packages missing

    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •