Bug 1514880 - selinux preventing systemd-mount creating directory in /run/media/system/ folder
Summary: selinux preventing systemd-mount creating directory in /run/media/system/ folder
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted
Version: 27
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-19 08:00 UTC by matthew.shunshin
Modified: 2017-11-28 23:55 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-11-28 23:55:05 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description matthew.shunshin 2017-11-19 08:00:38 UTC
Description of problem:

As root, unable to mount devices by using:

systemd-mount /dev/sd#

 - prevented by SELinux.

It works if you have created a directory and run:

systemd-mount /dev/sd# /mnt/temp-mount

 but should make a temporary one in /run/media/system



Version-Release number of selected component (if applicable): Fedora 27


How reproducible:




Steps to Reproduce:
1. Plug in usb hard disk
2. systemd-mount /dev/sd#
3. Fails

Actual results:
Nov 18 16:22:46 tank audit[1]: AVC avc:  denied  { create } for  pid=1 comm="systemd" name="media" scontext=system_u:system_r:i
Nov 18 16:22:46 tank systemd[1]: Started File System Check on /dev/sdd.
Nov 18 16:22:46 tank systemd[1]: run-media-system-Backup\x2dMedia.mount: Failed to check directory /run/media/system/Backup-Med
Nov 18 16:22:46 tank systemd[1]: Mounting Elements_10A8 Backup-Media...
Nov 18 16:22:46 tank systemd[1]: run-media-system-Backup\x2dMedia.mount: Mount process exited, code=exited status=32
Nov 18 16:22:46 tank systemd[1]: Failed to mount Elements_10A8 Backup-Media.
Nov 18 16:22:46 tank systemd[1]: run-media-system-Backup\x2dMedia.mount: Unit entered failed state.

Expected results:

Mounted drive in /run/media/system


Additional info:

ausearch + audit2allow works to fix.

Comment 1 Zbigniew Jędrzejewski-Szmek 2017-11-19 09:55:50 UTC
Yeah, systemd needs to be able to create directories.
I think the AVC is truncated in what is pasted here, but it's easy to recreate:

AVC avc:  denied  { create } for  pid=1 comm="systemd" name="media" scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:mnt_t:s0 tclass=dir permissive=1

Comment 2 Fedora Update System 2017-11-22 08:56:55 UTC
selinux-policy-3.13.1-283.17.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-d05b1a2ab9

Comment 3 Fedora Update System 2017-11-22 21:42:14 UTC
selinux-policy-3.13.1-283.17.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-d05b1a2ab9

Comment 4 Fedora Update System 2017-11-28 23:55:05 UTC
selinux-policy-3.13.1-283.17.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.