kvm啟動(dòng)報(bào)錯(cuò)與selinux的設(shè)置相關(guān)解決方法
技術(shù)支持服務(wù)電話:15308000360 【7x24提供運(yùn)維服務(wù),解決各類系統(tǒng)/軟硬件疑難技術(shù)問題】
1.問題說明
由于kvm所在的機(jī)器啟用了SELINUX,后來將之關(guān)閉,關(guān)閉之后,發(fā)現(xiàn)kvm的虛擬機(jī)無法啟動(dòng),啟動(dòng)過程中的報(bào)錯(cuò)信息如下:
[root@ESRoller ~]# virsh start zabbix
error: Failed to start domain zabbix
error: unsupported configuration: Unable to find security driver for label selinux
libvirt中的日志也提示報(bào)錯(cuò):
[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.造成原因
由于機(jī)器開機(jī)狀態(tài)時(shí),將SElinux的狀態(tài)信息save在虛擬機(jī)中,導(dǎo)致SElinux關(guān)閉之后,虛擬找不到對應(yīng)的label,從而導(dǎo)致vm啟動(dòng)失敗。
3.解決方法
virsh edit domain_name查看虛擬機(jī)的配置文件中,是否有selinux標(biāo)簽的相關(guān)設(shè)置,如果有,則將其刪除,再啟動(dòng)vm。如果沒有,則可能已經(jīng)保存在vm狀態(tài)中,將原有的狀態(tài)刪除即可(對應(yīng)路徑/var/lib/libvirt/qemu/save),如下:
[root@ESRoller ~]# virsh managedsave-remove zabbix
Removed managedsave image for domain zabbix
[root@ESRoller ~]# virsh start zabbix
Domain zabbix started
[root@ESRoller ~]# virsh list
Id Name State
----------------------------------------------------
4 zabbix running
如果配置配置文件中有selinux相關(guān)的配置,將其刪除,期配置類似于:
<seclabel type=‘dynamic‘ model=‘selinux‘ relabel=‘yes‘>
<label>system_u:system_r:svirt_t:s0:c625,c859</label>
<imagelabel>system_u:object_r:svirt_image_t:s0:c625,c859</imagelabel>
</seclabel>