LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   rpm --initdb error: cannot open Packages index using db3 (https://www.linuxquestions.org/questions/linux-software-2/rpm-initdb-error-cannot-open-packages-index-using-db3-637112/)

powah 04-22-2008 03:37 PM

rpm --initdb error: cannot open Packages index using db3
 
# rpm --initdb
error: cannot open Packages index using db3 - No such file or directory (2)

# rpm --rebuilddb
error: cannot open Packages index

How to fix this problem?

jailbait 04-22-2008 06:19 PM

The first thing to do is to check what files exist in your rpm data base. Look in the /var/lib/rpm directory. You should have about 15 or 20 files in that directory, one of them named Packages.

---------------
Steve Stites

powah 04-23-2008 04:35 PM

Quote:

Originally Posted by jailbait (Post 3129572)
The first thing to do is to check what files exist in your rpm data base. Look in the /var/lib/rpm directory. You should have about 15 or 20 files in that directory, one of them named Packages.

---------------
Steve Stites

The old problem is solved but another problem appeared.
# make
...
error: cannot open Providename index using db3 - No such file or directory (2)
error: cannot open Name index using db3 - No such file or directory (2)
error: cannot open Basenames index using db3 - No such file or directory (2)
error: cannot open Conflictname index using db3 - No such file or directory (2)
error: failed build dependencies:
perl is needed by app_server-4.9.9-9
openssl-devel is needed by app_server-4.9.9-9
sharutils is needed by app_server-4.9.9-9
tcp_wrappers is needed by app_server-4.9.9-9
/bin/login is needed by app_server-4.9.9-9
glibc-devel is needed by app_server-4.9.9-9
pam is needed by app_server-4.9.9-9
make: *** [linux_rpm_server] Error 1

jailbait 04-23-2008 04:42 PM

Quote:

Originally Posted by powah (Post 3130729)

The old problem is solved

What was the solution?

-------------------
Steve Stites

powah 04-24-2008 03:31 PM

Quote:

Originally Posted by jailbait (Post 3130735)
What was the solution?

-------------------
Steve Stites

mkdir /var/lib/rpm
rpm --initdb

unSpawn 04-24-2008 04:45 PM

Quote:

Originally Posted by powah (Post 3130729)
error: cannot open Providename index using db3 - No such file or directory (2)
error: cannot open Name index using db3 - No such file or directory (2)
error: cannot open Basenames index using db3 - No such file or directory (2)
error: cannot open Conflictname index using db3 - No such file or directory (2)
error: failed build dependencies:

What user do you build this package as (permissions)? Whats the command (no obfuscation please)? And what does 'rpm -q perl openssl-devel tcp_wrappers glibc-devel pam' return?

powah 04-25-2008 09:26 AM

Quote:

Originally Posted by unSpawn (Post 3131902)
What user do you build this package as (permissions)? Whats the command (no obfuscation please)? And what does 'rpm -q perl openssl-devel tcp_wrappers glibc-devel pam' return?

I login as root and build this package as root.

# rpm -q perl openssl-devel tcp_wrappers glibc-devel pam
error: cannot open Name index using db3 - No such file or directory (2)
package perl is not installed
package openssl-devel is not installed
package tcp_wrappers is not installed
package glibc-devel is not installed
package pam is not installed

However, perl is installed but rpm cannot see it.

unSpawn 04-26-2008 04:54 AM

First of all you shouldn't be building RPMs as root. It's not necessary, any unprivileged user account should do. Because of your "mkdir /var/lib/rpm; rpm --initdb" creating a new RPM database structure, the RPMDB is empty. Where on earth did you get those instructions from? Now if you have the /etc/cron\..*/rpm cronjob (the one that does "/bin/rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}.rpm\n' 2>&1 | /bin/sort > /var/log/rpmpkgs"), then there is a possibility to kind of restore the RPMDB in a semi-automatic way. You need to download the installed packages (like with "yum --download-only") and then install them with 'rpm' using "--justdb --noscripts". This could require the use of "--force". I'd like to understand what lead to this. Can you tell us what commands you executed that caused this problem where you had to rebuild the RPMDB?

powah 04-29-2008 03:50 PM

Quote:

Originally Posted by unSpawn (Post 3133423)
First of all you shouldn't be building RPMs as root. It's not necessary, any unprivileged user account should do. Because of your "mkdir /var/lib/rpm; rpm --initdb" creating a new RPM database structure, the RPMDB is empty. Where on earth did you get those instructions from? Now if you have the /etc/cron\..*/rpm cronjob (the one that does "/bin/rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}.rpm\n' 2>&1 | /bin/sort > /var/log/rpmpkgs"), then there is a possibility to kind of restore the RPMDB in a semi-automatic way. You need to download the installed packages (like with "yum --download-only") and then install them with 'rpm' using "--justdb --noscripts". This could require the use of "--force". I'd like to understand what lead to this. Can you tell us what commands you executed that caused this problem where you had to rebuild the RPMDB?

I got those (wrong) instructions from another newsgroup.
Please explain more about:
/etc/cron\..*/rpm cronjob (the one that does "/bin/rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}.rpm\n' 2>&1 | /bin/sort > /var/log/rpmpkgs")

I am just one of the users using that computer, I do not know which commands caused this problem.

unSpawn 04-30-2008 10:18 AM

The default Fedora/RHEL/CentOS/.* /etc/cron.daily/rpm cronjob lists (command as shown) installed packages and dumps them in /var/log/rpmpkgs. Ergo, if you do not have a complete RPMDB but you have /var/log/rpmpkgs, then you can find most packages on your install CDs or download them from the official repos.


All times are GMT -5. The time now is 01:07 AM.