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 12
SUSE Linux Enterprise Server for SAP Applications 15
SUSE Linux Enterprise Server for SAP Applications 12
Situation
error: no dbpath has been set
error: cannot open Packages database in /%{_dbpath}
Resolution
- 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.
- 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.
- Once it's finished loading, log in as root.
- 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 partitionscat /proc/partitions
List all available logical volumes with this commandlvdisplay
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. - 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
- Install the rpm package using the following command
rpm --root /mnt --dbpath /mnt/var/lib/rpm -ihv --nodeps /mnt/tmp/rpm-<version>.rpm
- After installation Boot the server back normally
Cause
Additional Information
- 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
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com