[Rpm-maint] [rpm-software-management/rpm] RPM Query behavior via sudo vs user (Discussion #2322)

gclair notifications at github.com
Fri Dec 9 23:14:11 UTC 2022


There seems to be a behavior difference when executing `rpm -qa` or `rpm -qa --qf %{NAME}` via sudo vs a non-privileged user.  When executing via sudo its been shown to error out with a bad DB:
 
```
hirpmdb: Thread/process 85454/140624466790144 failed: Thread died in Berkeley DB library
error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 -  (-30974)
error: cannot open Packages database in /var/lib/rpm
```

The issue is clear and the fix is known, however the same host (RedHat) without sudo, seems to work even with the db issue.

```
% sh -c 'printf hi; /bin/rpm -qa --qf %{NAME}\\n'
hikernel-headers
at
pkgconfig
nss-sysinit
```
The question is why is the behaviour different between the  command executing as root vs a regular user?  

I tried to search the code base but my knowledge is limited, and I'm guessing it has something to do with perhaps establishing a file or db lock or attempting to write to the db as root for some reason vs a pure read only as a user. 

Any ideas?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/discussions/2322
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/repo-discussions/2322 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20221209/88eb7025/attachment.html>


More information about the Rpm-maint mailing list