2021-05-12 14:32:11
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
相關文章