Bug 1593821

Summary: SELinux is preventing upowerd from 'write' accesses on the directory /var/lib/upower.
Product: [Fedora] Fedora Reporter: Mikhail <mikhail.v.gavrilov>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 29CC: angelapuget, dwalsh, flast, franco.geller, gibraltarsrock, lvrabec, mgrepl, pbirkbeck214, plautrba, pmoore, renault, vondruch
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:f3e2fffb18861fc168c669d743a99d57f036f5b0c3dffa0c7c04276f890319d9;VARIANT_ID=workstation;
Fixed In Version: selinux-policy-3.14.2-34.fc29 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-09-12 02:57:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mikhail 2018-06-21 15:48:12 UTC
Description of problem:
SELinux is preventing upowerd from 'write' accesses on the directory /var/lib/upower.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that upowerd should be allowed write access on the upower directory by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'upowerd' --raw | audit2allow -M my-upowerd
# semodule -X 300 -i my-upowerd.pp

Additional Information:
Source Context                system_u:system_r:init_t:s0
Target Context                system_u:object_r:devicekit_var_lib_t:s0
Target Objects                /var/lib/upower [ dir ]
Source                        upowerd
Source Path                   upowerd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           upower-0.99.8-1.fc29.x86_64
Policy RPM                    selinux-policy-3.14.2-25.fc29.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.18.0-0.rc0.git9.1.fc29.x86_64 #1
                              SMP Thu Jun 14 18:07:49 UTC 2018 x86_64 x86_64
Alert Count                   1
First Seen                    2018-06-21 20:45:57 +05
Last Seen                     2018-06-21 20:45:57 +05
Local ID                      c73367b8-2016-4a9f-9292-ae12de4a80f9

Raw Audit Messages
type=AVC msg=audit(1529595957.728:273): avc:  denied  { write } for  pid=1193 comm="upowerd" name="upower" dev="sda1" ino=6160594 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:devicekit_var_lib_t:s0 tclass=dir permissive=0


Hash: upowerd,init_t,devicekit_var_lib_t,dir,write

Version-Release number of selected component:
selinux-policy-3.14.2-25.fc29.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.9.5
hashmarkername: setroubleshoot
kernel:         4.18.0-0.rc0.git9.1.fc29.x86_64
type:           libreport

Potential duplicate: bug 1593496

Comment 1 Franco Geller 2018-06-27 17:15:22 UTC
Same problem here, since 4.17.2-100.fc27.x86_64 kernel update.
The upower.service throws the following log:

upowerd[1216]: failed to get data: Failed to open file “/var/lib/upower/history-rate-ASUS_Battery-56.dat”: Permission denied
upowerd[1216]: failed to get data: Failed to open file “/var/lib/upower/history-charge-ASUS_Battery-56.dat”: Permission denied
upowerd[1216]: failed to get data: Failed to open file “/var/lib/upower/history-time-full-ASUS_Battery-56.dat”: Permission denied
upowerd[1216]: failed to get data: Failed to open file “/var/lib/upower/history-time-empty-ASUS_Battery-56.dat”: Permission denied
upowerd[1216]: cannot open '/dev/input/event0': Permission denied
systemd[1]: Started Daemon for power management.
upowerd[1216]: Failed to create object manager for BlueZ: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: An SELinux policy prevents this sender from sending this message to this recipie
upowerd[1216]: failed to set data: Failed to create file “/var/lib/upower/history-rate-ASUS_Battery-56.dat.YG3MLZ”: Permission denied
upowerd[1216]: failed to set data: Failed to create file “/var/lib/upower/history-rate-ASUS_Battery-56.dat.MUMMLZ”: Permission denied
upowerd[1216]: failed to set data: Failed to create file “/var/lib/upower/history-rate-ASUS_Battery-56.dat.AI59KZ”: Permission denied

Comment 2 alfredm 2018-07-24 21:31:57 UTC
*** Bug 1608061 has been marked as a duplicate of this bug. ***

Comment 3 Jan Kurik 2018-08-14 11:18:06 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 29 development cycle.
Changing version to '29'.

Comment 4 Fedora Update System 2018-09-11 12:51:25 UTC
selinux-policy-3.14.2-34.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2018-db240a1726

Comment 5 Fedora Update System 2018-09-12 02:57:45 UTC
selinux-policy-3.14.2-34.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.