Description of problem: I'm trying to use libvirt-lxc to create containers with network namespaces. Libvirt tells me "System lacks NETNS support" but the system does support network namespaces. I'm running the standard f20 kernel which does have CONFIG_NET_NS=y, and I can manually create network namespaces using iproute. I looked at lxc_driver.c and I see that it executes "ip link set lo netns -1" in lxcCheckNetNsSupport() to determine if the system supports network namespaces. On the two f20 systems I tried this on, ip returns "RTNETLINK answers: No such process". Version-Release number of selected component (if applicable): libvirt-1.1.3.2-1.fc20.x86_64 libvirt-daemon-driver-lxc-1.1.3.2-1.fc20.x86_64 iproute-3.11.0-1.fc20.x86_64 kernel-3.12.6-300.fc20.x86_64 How reproducible: Always Steps to Reproduce: The easiest way to reproduce I've found is to use virt-sandbox-service create to create a new lxc domain. # virt-sandbox-service create -C -u httpd.service -N dhcp,source=default container1 It will output Created sandbox container dir /var/lib/libvirt/filesystems/container1 Created unit file /etc/systemd/system/container1_sandbox.service /bin/virt-sandbox-service: Failed to create domain: Requested operation is not valid: System lacks NETNS support Actual results: Expected results: The lxc domain will be created. Additional info:
Do you have Selinux in enforcing mode ? If so does switching to permissive mode help at all.
Hi Daniel, I was in enforcing mode, but I tried it also in permissive. # getenforce Enforcing # ip link set lo netns -1 RTNETLINK answers: No such process # setenforce 0 # getenforce Permissive # ip link set lo netns -1 RTNETLINK answers: No such process # virt-sandbox-service create -C -u httpd.service -N dhcp,source=default container1 Created sandbox container dir /var/lib/libvirt/filesystems/container1 Created unit file /etc/systemd/system/container1_sandbox.service /bin/virt-sandbox-service: Failed to create domain: Requested operation is not valid: System lacks NETNS support
Hi Daniel, I was testing incorrectly, and it seems I'm misleading myself by testing "ip link set lo netns -1" on the command line. I can get the container to create successfully when I've done setenforce 0 and then *restart* the libvirtd service. From the command line, "ip link..." still returns "No such process" but apparently it succeeds from within libvirtd. I'll turn off the selinux dontaudit and report back any AVCs.
Hi Daniel, Here are the log messages and AVCs I get in Permissive mode and restarting libvirtd: Jan 10 09:21:01 dali systemd[1]: Starting Virtualization daemon... Jan 10 09:21:01 dali systemd[1]: Started Virtualization daemon. Jan 10 09:21:01 dali kernel: type=1400 audit(1389374461.725:33): avc: denied { rlimitinh } for pid=12606 comm="libvirtd" scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tclass=process Jan 10 09:21:01 dali kernel: type=1400 audit(1389374461.725:34): avc: denied { noatsecure } for pid=12606 comm="libvirtd" scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tclass=process Jan 10 09:21:01 dali kernel: type=1400 audit(1389374461.920:35): avc: denied { rlimitinh } for pid=12618 comm="dnsmasq" scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:dnsmasq_t:s0-s0:c0.c1023 tclass=process Jan 10 09:21:01 dali kernel: type=1400 audit(1389374461.920:36): avc: denied { siginh } for pid=12618 comm="dnsmasq" scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:dnsmasq_t:s0-s0:c0.c1023 tclass=process Jan 10 09:21:01 dali kernel: type=1400 audit(1389374461.920:37): avc: denied { noatsecure } for pid=12618 comm="dnsmasq" scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:dnsmasq_t:s0-s0:c0.c1023 tclass=process Jan 10 09:21:02 dali kernel: type=1400 audit(1389374462.310:38): avc: denied { rlimitinh } for pid=12622 comm="iptables" scontext=system_u:system_r:firewalld_t:s0 tcontext=system_u:system_r:iptables_t:s0 tclass=process Jan 10 09:21:02 dali kernel: type=1400 audit(1389374462.310:39): avc: denied { siginh } for pid=12622 comm="iptables" scontext=system_u:system_r:firewalld_t:s0 tcontext=system_u:system_r:iptables_t:s0 tclass=process Jan 10 09:21:02 dali kernel: type=1400 audit(1389374462.310:40): avc: denied { noatsecure } for pid=12622 comm="iptables" scontext=system_u:system_r:firewalld_t:s0 tcontext=system_u:system_r:iptables_t:s0 tclass=process Jan 10 09:21:06 dali dnsmasq[21276]: read /etc/hosts - 3 addresses Jan 10 09:21:06 dali dnsmasq[21276]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses Jan 10 09:21:06 dali dnsmasq-dhcp[21276]: read /var/lib/libvirt/dnsmasq/default.hostsfile Jan 10 09:21:07 dali kernel: type=1400 audit(1389374467.237:41): avc: denied { rlimitinh } for pid=12699 comm="dmidecode" scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:dmidecode_t:s0-s0:c0.c1023 tclass=process Jan 10 09:21:07 dali kernel: type=1400 audit(1389374467.237:42): avc: denied { siginh } for pid=12699 comm="dmidecode" scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:dmidecode_t:s0-s0:c0.c1023 tclass=process Jan 10 09:21:07 dali kernel: type=1400 audit(1389374467.237:43): avc: denied { noatsecure } for pid=12699 comm="dmidecode" scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:dmidecode_t:s0-s0:c0.c1023 tclass=process Jan 10 09:21:09 dali kernel: SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs Jan 10 09:21:09 dali kernel: SELinux: initialized (dev proc, type proc), uses genfs_contexts Jan 10 09:21:09 dali libvirtd[12606]: libvirt version: 1.1.3.2, package: 1.fc20 (Fedora Project, 2013-12-14-21:11:12, buildvm-04.phx2.fedoraproject.org) Jan 10 09:21:09 dali libvirtd[12606]: internal error: End of file from monitor Jan 10 09:21:09 dali kernel: type=1400 audit(1389374469.276:44): avc: denied { rlimitinh } for pid=12812 comm="ip" scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:ifconfig_t:s0-s0:c0.c1023 tclass=process Jan 10 09:21:09 dali kernel: type=1400 audit(1389374469.276:45): avc: denied { siginh } for pid=12812 comm="ip" scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:ifconfig_t:s0-s0:c0.c1023 tclass=process Jan 10 09:21:09 dali kernel: type=1400 audit(1389374469.276:46): avc: denied { noatsecure } for pid=12812 comm="ip" scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:ifconfig_t:s0-s0:c0.c1023 tclass=process Jan 10 09:21:09 dali kernel: SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs Jan 10 09:21:09 dali kernel: SELinux: initialized (dev proc, type proc), uses genfs_contexts When I restart it in Enforcing mode I now see what the real failure is: it can't find the "ip" command in the first place! Jan 10 09:26:16 dali systemd[1]: Starting Virtualization daemon... [root@dali ~]# Jan 10 09:26:16 dali systemd[1]: Started Virtualization daemon. Jan 10 09:26:16 dali kernel: type=1400 audit(1389374776.535:53): avc: denied { rlimitinh } for pid=13008 comm="libvirtd" scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tclass=process Jan 10 09:26:16 dali kernel: type=1400 audit(1389374776.535:54): avc: denied { noatsecure } for pid=13008 comm="libvirtd" scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tclass=process Jan 10 09:26:16 dali kernel: type=1400 audit(1389374776.612:55): avc: denied { rlimitinh } for pid=13020 comm="dnsmasq" scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:dnsmasq_t:s0-s0:c0.c1023 tclass=process Jan 10 09:26:16 dali kernel: type=1400 audit(1389374776.613:56): avc: denied { siginh } for pid=13020 comm="dnsmasq" scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:dnsmasq_t:s0-s0:c0.c1023 tclass=process Jan 10 09:26:16 dali kernel: type=1400 audit(1389374776.613:57): avc: denied { noatsecure } for pid=13020 comm="dnsmasq" scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:dnsmasq_t:s0-s0:c0.c1023 tclass=process Jan 10 09:26:16 dali kernel: type=1400 audit(1389374776.615:58): avc: denied { rlimitinh } for pid=13021 comm="dnsmasq" scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:dnsmasq_t:s0-s0:c0.c1023 tclass=process Jan 10 09:26:18 dali kernel: audit_printk_skb: 78 callbacks suppressed Jan 10 09:26:18 dali kernel: type=1400 audit(1389374778.026:85): avc: denied { rlimitinh } for pid=13040 comm="iptables" scontext=system_u:system_r:firewalld_t:s0 tcontext=system_u:system_r:iptables_t:s0 tclass=process Jan 10 09:26:18 dali kernel: type=1400 audit(1389374778.026:86): avc: denied { siginh } for pid=13040 comm="iptables" scontext=system_u:system_r:firewalld_t:s0 tcontext=system_u:system_r:iptables_t:s0 tclass=process Jan 10 09:26:18 dali kernel: type=1400 audit(1389374778.026:87): avc: denied { noatsecure } for pid=13040 comm="iptables" scontext=system_u:system_r:firewalld_t:s0 tcontext=system_u:system_r:iptables_t:s0 tclass=process Jan 10 09:26:18 dali kernel: type=1400 audit(1389374778.173:88): avc: denied { rlimitinh } for pid=13042 comm="iptables" scontext=system_u:system_r:firewalld_t:s0 tcontext=system_u:system_r:iptables_t:s0 tclass=process Jan 10 09:26:18 dali kernel: type=1400 audit(1389374778.173:89): avc: denied { siginh } for pid=13042 comm="iptables" scontext=system_u:system_r:firewalld_t:s0 tcontext=system_u:system_r:iptables_t:s0 tclass=process Jan 10 09:26:18 dali kernel: type=1400 audit(1389374778.173:90): avc: denied { noatsecure } for pid=13042 comm="iptables" scontext=system_u:system_r:firewalld_t:s0 tcontext=system_u:system_r:iptables_t:s0 tclass=process Jan 10 09:26:18 dali kernel: type=1400 audit(1389374778.325:91): avc: denied { rlimitinh } for pid=13044 comm="iptables" scontext=system_u:system_r:firewalld_t:s0 tcontext=system_u:system_r:iptables_t:s0 tclass=process Jan 10 09:26:18 dali kernel: type=1400 audit(1389374778.325:92): avc: denied { siginh } for pid=13044 comm="iptables" scontext=system_u:system_r:firewalld_t:s0 tcontext=system_u:system_r:iptables_t:s0 tclass=process Jan 10 09:26:18 dali kernel: type=1400 audit(1389374778.325:93): avc: denied { noatsecure } for pid=13044 comm="iptables" scontext=system_u:system_r:firewalld_t:s0 tcontext=system_u:system_r:iptables_t:s0 tclass=process Jan 10 09:26:18 dali kernel: type=1400 audit(1389374778.470:94): avc: denied { rlimitinh } for pid=13046 comm="iptables" scontext=system_u:system_r:firewalld_t:s0 tcontext=system_u:system_r:iptables_t:s0 tclass=process Jan 10 09:26:21 dali dnsmasq[21276]: read /etc/hosts - 3 addresses Jan 10 09:26:21 dali dnsmasq[21276]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses Jan 10 09:26:21 dali dnsmasq-dhcp[21276]: read /var/lib/libvirt/dnsmasq/default.hostsfile Jan 10 09:26:22 dali libvirtd[13008]: libvirt version: 1.1.3.2, package: 1.fc20 (Fedora Project, 2013-12-14-21:11:12, buildvm-04.phx2.fedoraproject.org) Jan 10 09:26:22 dali libvirtd[13008]: internal error: Failed to find path for dmidecode binary Jan 10 09:26:22 dali libvirtd[13008]: internal error: Failed to find path for dmidecode binary Jan 10 09:26:24 dali kernel: SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs Jan 10 09:26:24 dali kernel: SELinux: initialized (dev proc, type proc), uses genfs_contexts Jan 10 09:26:24 dali libvirtd[13008]: internal error: End of file from monitor Jan 10 09:26:24 dali libvirtd[13008]: internal error: Failed to find path for dmidecode binary Jan 10 09:26:24 dali libvirtd[13008]: Cannot find 'ip' in path: No such file or directory I don't understand why it can't find IP, pid 13008's PATH looks good: # cat /proc/13008/environ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/binLANG=en_US.utf8LC_NUMERIC=en_US.UTF-8LC_TIME=en_US.UTF-8LC_MONETARY=en_US.UTF-8LC_PAPER=en_US.UTF-8LC_MEASUREMENT=en_US.UTF-8 # ls -la /usr/sbin/ip -rwxr-xr-x. 1 root root 301712 Oct 22 00:20 /usr/sbin/ip
Ok, this is a SELinux policy bug I believe.
We have this rule in rawhide #!!!! This avc is allowed in the current policy allow init_t virtd_t:process { rlimitinh noatsecure }; We should back port all of virt.* to F20. Also need a3f5ac8b13d4af1a800d80d4576c5ecb17c5acee from init.
#============= init_t ============== #!!!! This avc is allowed in the current policy allow init_t virtd_t:process { rlimitinh noatsecure } All changes for virt.te go also to F20/RHEL7.
selinux-policy-3.12.1-116.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-116.fc20
selinux-policy-3.12.1-116.fc20 has resolved my problem. Thanks!
Package selinux-policy-3.12.1-116.fc20: * should fix your issue, * was pushed to the Fedora 20 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing selinux-policy-3.12.1-116.fc20' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2014-0806/selinux-policy-3.12.1-116.fc20 then log in and leave karma (feedback).
selinux-policy-3.12.1-116.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.