Permission denie occurs when CentOS 7 is started.
Linux: CentOS 7
Use virt-manager in CentOS 7 to add a virtual machine. After the configuration is successful, the following prompt appears when starting the virtual machine:
Qemu-kvm:-drive file =/var/lib/libvirt/images/AloeCCnode_v2.1.qcow2, if = none, id = drive-ide0-0-0, format = qcow2: cocould not open disk image/var/lib/libvirt/images/AloeCCnode_v2.1.qcow2: cocould not open file: Permission denied
The VM cannot be created successfully.
View image file permissions:
[Root @ localhost log] # ll/var/lib/libvirt/images/
Total 30410756
-Rw-r --. 1 qemu 31132352512 Aug 13 16:02 AloeCCnode_v2.1.qcow2
The File Permission qemu is available.
View libmongod log information:
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 response-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 serial SerialPort, 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: cocould not open disk image/var/lib/libvirt/images/AloeCCnode_v2.1.qcow2: cocould not open file: Permission denied
This error is caused by the selinux control permission when a network query is found.
Disable system selinux and set it to disable.
# Setenforce 0
# Sed-I '/^ SELINUX/s/enforcing/disabled/'/etc/selinux/config
Restart the libmongod service.
Start the VM again.
This article permanently updates the link address: