Bug 9348

Summary: Opkg requires root privileges for all operations
Product: [Yocto Project Subprojects] opkg Reporter: Alejandro del Castillo <alejandro.delcastillo>
Component: opkgAssignee: Alejandro del Castillo <alejandro.delcastillo>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: Undecided CC: lpapp
Version: 0.3.2   
Target Milestone: 0.4.4   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)

Description Alejandro del Castillo 2016-03-25 20:10:29 UTC
Opkg is creating it's lock file under /var/run, which has drwxr-xr-x root-root permissions. Any opkg operation under an unprivilged user will throw:

Collected errors:
 * opkg_lock: Could not create lock file /var/run/opkg.lock: Permission denied.

A better place for lock file is /var/run/lock (maps to /run/lock). If writes can be made atomic (via a tmpfile), then reads shouldn't need a lock and an unprivileged user should be able to do any operations than only requires reads. Since any user can create files in /var/run/lock, opkg will need to make sure that the user is root when creating the lock.
Comment 1 Alejandro del Castillo 2016-05-02 22:16:18 UTC
*** Bug 8174 has been marked as a duplicate of this bug. ***
Comment 2 Alejandro del Castillo 2020-10-30 07:40:32 UTC
/var/run/lock permissions are too open, left lock on /var/run. 

Commit feb40ec55c07aabe7a925f0338156f71582041a5 removed the need to be root for read-only operations.