Bug 921967 - [virt-sandbox-service] container start with chronyd.service failure
Summary: [virt-sandbox-service] container start with chronyd.service failure
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: libvirt-sandbox
Version: 19
Hardware: x86_64
OS: Linux
medium
high
Target Milestone: ---
Assignee: Daniel Berrangé
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-03-15 10:49 UTC by Wayne Sun
Modified: 2013-04-29 17:26 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-04-29 17:26:36 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Wayne Sun 2013-03-15 10:49:15 UTC
Description of problem:
container started with failed at chronyd.service


Version-Release number of selected component (if applicable):
# rpm -q libvirt-sandbox httpd chrony kernel
libvirt-sandbox-0.1.0-1.fc18.x86_64
httpd-2.4.3-15.fc18.x86_64
chrony-1.27-0.5.pre1.git1ca844.fc18.x86_64
kernel-3.8.2-206.fc18.x86_64


How reproducible:
always

Steps to Reproduce:
1. create a httpd sandbox
# virt-sandbox-service -c lxc:/// create -C -u httpd.service -l s0:c1,c2 apache10
Created sandbox container dir /var/lib/libvirt/filesystems/apache10
Created sandbox config /etc/libvirt-sandbox/services/apache10.sandbox
Created unit file /etc/systemd/system/httpd

2. start the container
# virt-sandbox-service start apache10
systemd 197 running in system mode. (+PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ)
Detected virtualization 'lxc-libvirt'.

Welcome to Fedora 18 (Spherical Cow)!

Set hostname to <ibm-x3850x5-08.qe.lab.eng.nay.redhat.com>.
[  OK  ] Listening on Delayed Shutdown Socket.
[  OK  ] Reached target Swap.
[  OK  ] Reached target Local File Systems.
[  OK  ] Listening on Journal Socket.
         Starting Recreate Volatile Files and Directories...
         Starting Journal Service...
[  OK  ] Started Journal Service.
[  OK  ] Started Recreate Volatile Files and Directories.
[  OK  ] Reached target System Initialization.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Basic System.
         Starting The Apache HTTP Server...
[  OK  ] Started The Apache HTTP Server.
[  OK  ] Reached target Sandbox target.
Failed to issue method call: Unit chronyd.service is not loaded.


3.
  
Actual results:
fail load chronyd.service

Expected results:
should succss

Additional info:

Comment 1 dyuan 2013-03-21 08:43:23 UTC
Can't reproduce the failure in comment 0 with libvirt-sandbox-0.1.2-1.fc19.x86_64.

But failed on httpd service.

         Starting The Apache HTTP Server...
         Starting D-Bus System Message Bus...
[  OK  ] Started D-Bus System Message Bus.
httpd.service: main process exited, code=exited, status=1/FAILURE
httpd.service: control process exited, code=exited status=1
[FAILED] Failed to start The Apache HTTP Server.
See 'systemctl status httpd.service' for details.
Unit httpd.service entered failed state
[  OK  ] Reached target Sandbox multi-user target.

==> Check the httpd service in container:

# virt-sandbox-service connect apache
Connected to apache.
Type 'Ctrl + ]' to detach from the console.

sh-4.2# systemctl status httpd.service
httpd.service - The Apache HTTP Server
	  Loaded: loaded (/etc/systemd/system/httpd.service; enabled)
	  Active: failed (Result: exit-code) since Thu 2013-03-21 16:38:47 CST; 2min 51s ago
	 Process: 46 ExecStop=/usr/sbin/httpd $OPTIONS -k graceful-stop (code=exited, status=1/FAILURE)
	 Process: 35 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)

Mar 21 16:38:47 apache httpd[35]: AH00534: httpd: Configuration error: No M...d.
Mar 21 16:38:47 apache httpd[46]: AH00534: httpd: Configuration error: No M...d.

Comment 2 Alex Jia 2013-03-21 10:02:30 UTC
(In reply to comment #1)
> But failed on httpd service.
> 
>          Starting The Apache HTTP Server...
>          Starting D-Bus System Message Bus...
> [  OK  ] Started D-Bus System Message Bus.
> httpd.service: main process exited, code=exited, status=1/FAILURE
> httpd.service: control process exited, code=exited status=1
> [FAILED] Failed to start The Apache HTTP Server.
> See 'systemctl status httpd.service' for details.
> Unit httpd.service entered failed state
> [  OK  ] Reached target Sandbox multi-user target.
> 


It may be introduced by selinux issue:

Additional Information:
Source Context                system_u:system_r:svirt_t:s0:c0.c1023
Target Context                system_u:object_r:systemd_systemctl_exec_t:s0
Target Objects                /usr/bin/systemctl [ file ]
Source                        systemctl
Source Path                   /usr/bin/systemctl
Port                          <Unknown>
Host                          dell-op790-03.qe.lab.eng.nay.redhat.com
Source RPM Packages           systemd-198-3.fc19.x86_64
Target RPM Packages           systemd-198-3.fc19.x86_64
Policy RPM                    selinux-policy-3.12.1-20.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     dell-op790-03.qe.lab.eng.nay.redhat.com
Platform                      Linux dell-op790-03.qe.lab.eng.nay.redhat.com
                              3.6.10-4.fc18.x86_64 #1 SMP Tue Dec 11 18:01:27
                              UTC 2012 x86_64 x86_64
Alert Count                   240
First Seen                    2013-03-14 16:05:31 CST
Last Seen                     2013-03-21 17:55:25 CST
Local ID                      8ad429f7-78e9-48fd-a9e6-1d7b24222267

Raw Audit Messages
type=AVC msg=audit(1363859725.725:6978): avc:  denied  { open } for  pid=15384 comm="chrony-helper" path="/usr/bin/systemctl" dev="dm-1" ino=1844533 scontext=system_u:system_r:svirt_t:s0:c0.c1023 tcontext=system_u:object_r:systemd_systemctl_exec_t:s0 tclass=file


type=AVC msg=audit(1363859725.725:6978): avc:  denied  { execute_no_trans } for  pid=15384 comm="chrony-helper" path="/usr/bin/systemctl" dev="dm-1" ino=1844533 scontext=system_u:system_r:svirt_t:s0:c0.c1023 tcontext=system_u:object_r:systemd_systemctl_exec_t:s0 tclass=file


type=SYSCALL msg=audit(1363859725.725:6978): arch=x86_64 syscall=execve success=yes exit=0 a0=a44510 a1=a3a2e0 a2=a449c0 a3=2 items=0 ppid=15854 pid=15384 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=systemctl exe=/usr/bin/systemctl subj=system_u:system_r:svirt_t:s0:c0.c1023 key=(null)

Hash: systemctl,svirt_t,systemd_systemctl_exec_t,file,open

audit2allow

#============= svirt_t ==============
#!!!! This avc is allowed in the current policy

allow svirt_t systemd_systemctl_exec_t:file { open execute_no_trans };

audit2allow -R
require {
	type svirt_t;
}

#============= svirt_t ==============
systemd_exec_systemctl(svirt_t)

Comment 3 Alex Jia 2013-03-21 10:04:00 UTC
(In reply to comment #2)

# rpm -q selinux-policy
selinux-policy-3.12.1-20.fc19.noarch

Comment 4 Daniel Walsh 2013-04-01 17:53:30 UTC
The problem here is the container was running with the svirt_t label rather then the svirt_lxc_net_t label.  

THis should be fixed in 

libvirt-sandbox-0.1.2-1.fc19.x86_64


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