1.背景说明linux
因为kvm所在的机器启用了SELINUX,后来将之关闭,关闭以后,发现kvm的虚拟机没法启动,启动过程当中的报错信息以下:dom
[root@ESRoller ~]# virsh start zabbix error: Failed to start domain zabbix error: unsupported configuration: Unable to find security driver for label selinux
libvirt中的日志也提示报错:ide
[root@ESRoller ~]# tail -f /var/log/libvirt/libvirtd.log 2016-06-20 09:54:41.724+0000: 2388: error : qemuRemoveCgroup:754 : internal error Unable to find cgroup for zabbix 2016-06-20 09:54:41.724+0000: 2388: warning : qemuProcessStop:4403 : Failed to remove cgroup for zabbix 2016-06-20 09:54:41.725+0000: 2388: error : qemuAutostartDomain:284 : Failed to autostart VM 'zabbix': unsupported configuration: Unable to find security driver for label selinux 2016-06-20 09:54:41.734+0000: 2388: error : virSecurityManagerGenLabel:376 : unsupported configuration: Unable to find security driver for label selinux 2016-06-20 09:54:41.741+0000: 2388: error : qemuRemoveCgroup:754 : internal error Unable to find cgroup for roller 2016-06-20 09:54:41.741+0000: 2388: warning : qemuProcessStop:4403 : Failed to remove cgroup for roller 2016-06-20 09:54:41.742+0000: 2388: error : qemuAutostartDomain:284 : Failed to autostart VM 'roller': unsupported configuration: Unable to find security driver for label selinux 2016-06-20 09:59:07.548+0000: 2378: error : virSecurityManagerGenLabel:376 : unsupported configuration: Unable to find security driver for label selinux 2016-06-20 09:59:07.561+0000: 2378: error : qemuRemoveCgroup:754 : internal error Unable to find cgroup for zabbix 2016-06-20 09:59:07.561+0000: 2378: warning : qemuProcessStop:4403 : Failed to remove cgroup for zabbix
2.形成缘由spa
因为机器开机状态时,将SElinux的状态信息save在虚拟机中,致使SElinux关闭以后,虚拟找不到对应的label,从而致使vm启动失败。日志
3.解决方法rem
virsh edit domain_name查看虚拟机的配置文件中,是否有selinux标签的相关设置,若是有,则将其删除,再启动vm。若是没有,则可能已经保存在vm状态中,将原有的状态删除便可(对应路径/var/lib/libvirt/qemu/save),以下:虚拟机
[root@ESRoller ~]# virsh managedsave-remove zabbix Removed managedsave p_w_picpath for domain zabbix [root@ESRoller ~]# virsh start zabbix Domain zabbix started [root@ESRoller ~]# virsh list Id Name State ---------------------------------------------------- 4 zabbix running
若是配置配置文件中有selinux相关的配置,将其删除,期配置相似于:it
<seclabel type='dynamic' model='selinux' relabel='yes'> <label>system_u:system_r:svirt_t:s0:c625,c859</label> <p_w_picpathlabel>system_u:object_r:svirt_p_w_picpath_t:s0:c625,c859</p_w_picpathlabel> </seclabel>