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>