Bug 922 - "rpm -qa" can not run for non-root user: Permission denied
Summary: "rpm -qa" can not run for non-root user: Permission denied
Status: RESOLVED WORKSFORME
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Low normal
Target Milestone: Future
Assignee: Alexander Kanavin
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2011-03-22 00:49 UTC by Dexuan Cui
Modified: 2018-01-26 12:36 UTC (History)
10 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dexuan Cui 2011-03-22 00:49:21 UTC
The log is

$ rpm -qa
error: db_init:db3.c:994: dbenv->open(13): Permission denied
error: cannot open Packages(0) index: Permission denied(13)
        DB: Berkeley DB 5.1.19: (August 27, 2010)
error: cannot open Packages database in /var/lib/rpm


BTW: root can run the command successfully.
Comment 1 Dexuan Cui 2011-03-22 22:15:54 UTC
"opkg-cl list-installed" has the same issue for a non-root user:

$ opkg-cl list-installed
Collected errors:
 * opkg_conf_load: Could not create lock file /var/lib/opkg/lock: Permission denied.
Comment 2 Richard Purdie 2011-03-24 05:36:48 UTC
This is to be expected, you need to be root to run package management operations.
Comment 3 Jessica 2011-03-24 09:28:45 UTC
Actually this is a bug.. but it's low.  As Richard indicates you need root to
use the package management system.  But traditionally you can query the packages
available on the system as non-root. - Mark
Comment 4 Mark Hatle 2012-05-08 15:35:58 UTC
Most of the estimate time is required for testing the work, the change is likely fairly simple.
Comment 5 Jeff Johnson 2013-04-24 16:58:04 UTC
Running "rpm -qa" tries to create shared locks
in /var/lib/rpm. So a scheme with g+w permission
needs to be devised.

However "rpm -qa" skips the locking with some minor
risk of non-root segfaulting iof/when another rpm
install (not query) process is running.

However I believe that the permissions on /var/lib/rpm/Packages
are preventing the open here, likely because of umask settings.
Comment 6 Stephen K Jolley 2015-11-19 16:04:01 UTC
This was REOPENED
Comment 7 Mark Hatle 2015-11-19 16:08:22 UTC
I don't see that this was reopened.  We never solved the issue as it was low priority.
Comment 8 Madhusudhanan 2016-01-06 13:38:18 UTC
I would like to reassign to myself if this is still a issue.
Comment 9 Ross Burton 2018-01-25 15:56:36 UTC
Alex, next time you've an image with rpm on, can you verify this still happens with rpm v4?
Comment 10 Alexander Kanavin 2018-01-26 12:36:37 UTC
Just tried on core-image-sato as a 'nobody' user - rpm -qa works fine.