感谢支持
我们一直在努力

CentOS 7 虚拟机启动出现 Permission denie

Linux操作系统:CentOS 7

在CentOS 7 下使用virt-manager增加虚拟机,配置成功后,启动虚拟机时,出现一下提示:

qemu-kvm: -drive file=/var/lib/libvirt/images/AloeCCnode_v2.1.qcow2,if=none,id=drive-ide0-0-0,format=qcow2: could not open disk image /var/lib/libvirt/images/AloeCCnode_v2.1.qcow2: Could not open file: Permission denied

导致虚拟机无法成功创建。

查看镜像文件权限:

[root@localhost log]# ll /var/lib/libvirt/images/
total 30410756
-rw-r–r–. 1 qemu qemu 31132352512 Aug 13 16:02 AloeCCnode_v2.1.qcow2

发现文件权限qemu可访问。

查看libvirtd日志信息:

2015-08-13 03:03:54.679+0000: starting up

LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin QEMU_AUDIO_DRV=spice /usr/libexec/qemu-kvm -name AloeCCnode -S -machine pc-i440fx-rhel7.0.0,accel=kvm,usb=off -cpu Haswell -m 8192 -realtime mlock=off -smp 4,sockets=4,cores=1,threads=1 -uuid 078f6d2d-0cde-4e7c-956c-179bfd62993a -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/AloeCCnode.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard -no-hpet -no-reboot -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x5.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x5.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x5.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 -drive file=/var/lib/libvirt/images/AloeCCnode_v2.1.qcow2,if=none,id=drive-ide0-0-0,format=qcow2 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=2 -drive file=/var/lib/libvirt/images/AloeCCnode_v2.1.qcow2,if=none,id=drive-ide0-0-1,readonly=on,format=qcow2 -device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1,bootindex=1 -netdev tap,fd=23,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:9d:e0:20,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.RedHat.spice.0 -spice port=5900,addr=127.0.0.1,disable-ticketing,seamless-migration=on -vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=67108864 -global qxl-vga.vgamem_mb=16 -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0 -chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7 -msg timestamp=on
char device redirected to /dev/pts/3 (label charserial0)

2015-08-13T03:03:54.712819Z qemu-kvm: -drive file=/var/lib/libvirt/images/AloeCCnode_v2.1.qcow2,if=none,id=drive-ide0-0-0,format=qcow2: could not open disk image /var/lib/libvirt/images/AloeCCnode_v2.1.qcow2: Could not open file: Permission denied

经过网络查询发现时selinux 控制权限导致。

关闭系统selinux,并设置为disable。

# setenforce 0

# sed -i ‘/^SELINUX/s/enforcing/disabled/’ /etc/selinux/config

重启libvirtd服务。

再次启动虚拟机,即可成功启动。

本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-08/121657.htm

赞(0) 打赏
转载请注明出处:服务器评测 » CentOS 7 虚拟机启动出现 Permission denie
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏