SUSE Support

Here When You Need Us

rpm command returns Error "error: no dbpath has been set error: cannot open Packages database in /%{_dbpath}"

This document (000021142) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 15
SUSE Linux Enterprise Server 12
SUSE Linux Enterprise Server for SAP Applications 15
SUSE Linux Enterprise Server for SAP Applications 12

Situation

# rpm -qa
error: no dbpath has been set
error: cannot open Packages database in /%{_dbpath}

Resolution

Note: SUSE always recommends to ensure that a working backup of the data is available before proceeding further with the following steps.
 
  1. Download rpm-<version>.rpm file ( Download the same rpm version which is installed on the system . Instructions to indentifying version are in "Additional Information section"). Just login to SCC.SUSE.COM, take the selection on the left for "Packages" and  select the product you are using and search for the 'rpm' package. Once found, the package can be clicked on and downloaded. Copy to the server having issue in  /tmp directory.                                                                                                                                                               
  2. First boot the system into Rescue Mode from the media. For best results use media that matches the version and service pack of the system.                                                                                                                                                  
  3. Once it's finished loading, log in as root.                                                                                                                                                                                                                                                                    
  4. Mount the root partition or logical volume to /mnt                                                                                                      
    mount /dev/<device name> /mnt
     If it's not known where the root file system is, it needs to be guessed until found by mounting each possibility and  checking its contents. Run the following command to list all available partitions                                               
    cat /proc/partitions
    List all available logical volumes with this command                                                                                                   
    lvdisplay
     After mounting each one check its contents by listing the mounted directory. For example if mounted to /mnt run: 
    ls /mnt
    Some directories that should be listed to verify it is a root file system are /root /boot and /home.                                                 
  5. Once mounted use the following for-loop to rbind the virtual file systems                                                                  
    for i in proc sys dev run ; do mount --rbind /$i /mnt/$i ; done
     Alternatively, mount them each separately rather than using the for-loop: 
    mount --rbind /proc /mnt/proc
    mount --rbind /sys /mnt/sys
    mount --rbind /dev /mnt/dev
    mount --rbind /run /mnt/run
    
                                                                                                                                                        
  6. Install the rpm package using the following command
    rpm --root /mnt --dbpath /mnt/var/lib/rpm -ihv --nodeps /mnt/tmp/rpm-<version>.rpm 
    
                                                                                                                                                                             
  7. After installation Boot the server back normally

Cause

This is situation can happen if the macros and other files were missing from /usr/lib/rpm.

Additional Information

Use the following steps to check the version of installed 'rpm' package
  • Go to the rpmdb backup directory
    cd /var/adm/backup/rpmdb
    
  • Extract the the latest rpmdb backupfile
    gunzip Packages-<date>.gz
    
  • use strings command on the extracted backup file 
    strings Packages-<date> |grep "^rpm-.*src.rpm$"
  • From the above command  output you will get the source package version of the rpm. This will help to correlate and download the specific rpm package from scc.suse.com

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000021142
  • Creation Date: 20-Jul-2023
  • Modified Date:14-Aug-2023
    • SUSE Linux Enterprise Server
    • SUSE Linux Enterprise Server for SAP Applications

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.