Bug 1373435 - SELinux exception on 'vagrant up'
Summary: SELinux exception on 'vagrant up'
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-06 09:35 UTC by Stephen Finucane
Modified: 2017-08-08 17:02 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-08 17:02:50 UTC
Type: Bug


Attachments (Terms of Use)

Description Stephen Finucane 2016-09-06 09:35:28 UTC
Description of problem:

If I try to run 'vagrant up', I get an SELinux policy denial:

    $ vagrant up
    Bringing machine 'default' up with 'libvirt' provider...
    ==> default: Starting domain.
    There was an error talking to Libvirt. The error message is shown
    below:
    
    Call to virDomainCreateWithFlags failed: SELinux policy denies access.

Looking at 'audit.log', it seems the KVM process is the one that's being halted:

    $ sudo grep res=failed /var/log/audit/audit.log | tail -1
    type=VIRT_CONTROL msg=audit(1473154019.172:534): pid=1878 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 msg='virt=kvm op=start reason=booted vm="vagrant-devstack_default" uuid=2b40753b-f2ac-43a3-a9de-804d39e26439 vm-pid=-1 exe="/usr/sbin/libvirtd" hostname=? addr=? terminal=? res=failed'

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

* vagrant-libvirt 0.0.32 (2.fc24)
* vagrant 1.8.1 (3.fc24)
* libvirt 1.3.3.2 (1.fc24)
* qemu 2.6.1 (1.fc24)

How reproducible:

Always

Steps to Reproduce:

1. Add user to the 'libvirt' and 'vagrant' user groups (to avoid sudo need)
2. Create a Vagrantfile using a libvirt-based image, like 'fedora/24-cloud-base'
3. Run 'vagrant up'

Actual results:

Vagrant fails to bring the machine up

    Bringing machine 'default' up with 'libvirt' provider...
    ==> default: Starting domain.
    There was an error talking to Libvirt. The error message is shown
    below:

Expected results:

Machine boots

Additional info:

This may be a trivial fix, but SELinux is tough to get started with. If possible, the required "context" or whatnot should be added at install time or documented somewhere.

Comment 1 Vít Ondruch 2016-09-06 10:05:24 UTC
Not sure what I should do about it. Lets move this to selinux guys.

Comment 2 Stephen Finucane 2016-09-06 10:29:03 UTC
To clarify for anyone who finds this pre-resolution, temporarily putting SELinux into permissive mode allows the VM to boot. This isn't a long term strategy, but it'll get you going:

    $ setenforce permissive

Comment 3 Daniel Walsh 2016-09-06 12:49:08 UTC
What is the output of 
ausearch -m avc -ts recent 
after this happens.

Comment 4 Stephen Finucane 2016-09-07 09:05:56 UTC
There are no matches:

    $ vagrant up
    Bringing machine 'default' up with 'libvirt' provider...
    ==> default: Starting domain.
    There was an error talking to Libvirt. The error message is shown
    below:

    Call to virDomainCreateWithFlags failed: SELinux policy denies access.
    $ ausearch -m avc -ts recent 
    Error opening config file (Permission denied)
    NOTE - using built-in logs: /var/log/audit/audit.log
    Error opening /var/log/audit/audit.log (Permission denied)
    $ sudo ausearch -m avc -ts recent 
    <no matches>

(I included full logs in case what user I run 'ausearch' as matter. I doubt it, but still...)

Comment 5 Petr Lautrbach 2016-09-07 09:13:39 UTC
Please look for USER_AVC as well:

sudo ausearch -m avc,user_avc -ts recent

Comment 6 Stephen Finucane 2016-09-07 09:32:58 UTC
That's more like it

    $ sudo ausearch -m avc,user_avc -ts recent
    ----
    time->Wed Sep  7 10:32:15 2016
    type=USER_AVC msg=audit(1473240735.873:403): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { start } for auid=n/a uid=0 gid=0 cmdline="/usr/lib/systemd/systemd-machined" scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=system  exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'

Comment 7 Fedora Admin XMLRPC Client 2016-09-27 15:10:24 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 8 Fedora End Of Life 2017-07-25 22:51:06 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 9 Fedora End Of Life 2017-08-08 17:02:50 UTC
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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