首页 > 代码库 > kvm与selinux

kvm与selinux

 

 Desktop virsh start 16lnmperror: Failed to start domain 16lnmperror: unsupported configuration: Unable to find security driver for label selinux查看看selinux是关闭的:?  Desktop grep -i ^selinux /etc/sysconfig/selinuxSELINUX=disabledSELINUXTYPE=targeted 

查看libvirtd的启动日志:

?  Desktop tailf /var/log/libvirt/libvirtd.log2016-09-11 22:38:33.812+0000: 3579: error : virSecurityManagerGenLabel:376 : unsupported configuration: Unable to find security driver for label selinux2016-09-11 22:38:33.812+0000: 3579: error : qemuRemoveCgroup:824 : internal error Unable to find cgroup for 16lnmp2016-09-11 22:38:33.812+0000: 3579: warning : qemuProcessStop:4617 : Failed to remove cgroup for 16lnmp2016-09-11 22:38:33.813+0000: 3579: warning : qemuDomainObjStart:6252 : Unable to restore from managed state /var/lib/libvirt/qemu/save/16lnmp.save. Maybe the file is corrupted?

造成这个错误的原因是:

由于机器开机状态时,将SElinux的状态信息save在虚拟机中,导致SElinux关闭之后,虚拟找不到对应的label,从而导致vm启动失败。

如果配置配置文件中有selinux相关的配置,将其删除,如果没有,则可能已经保存在vm状态中,将原有的状态删除即可(对应路径/var/lib/libvirt/qemu/save),如下:

 ~ ls /var/lib/libvirt/qemu/save 13svn.save  14git.save  15samba.save  16lnmp.save  26svn.save  centos7.save?  ~ rm /var/lib/libvirt/qemu/save/16lnmp.save ?  ~ virsh start 16lnmpDomain 16lnmp started#启动成功!!!

 

kvm与selinux