KVM Selinux error On fedora

If i set SELINUX in permissive mode and then try to create vm with storage location ntfs parttion also then kvm didn’t giving this :point_down: :point_down:error or any other error…now job done.

Unable to complete install: 'internal error: process exited while connecting to monitor: 2022-01-17T11:41:25.919215Z qemu-system-x86_64: -blockdev {"driver":"file","filename":"/hdd1/VM_Storage/rhel7.0.qcow2","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}: Could not open '/hdd1/VM_Storage/rhel7.0.qcow2': Permission denied'

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 65, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/createvm.py", line 2001, in _do_async_install
    installer.start_install(guest, meter=meter)
  File "/usr/share/virt-manager/virtinst/install/installer.py", line 701, in start_install
    domain = self._create_guest(
  File "/usr/share/virt-manager/virtinst/install/installer.py", line 649, in _create_guest
    domain = self.conn.createXML(install_xml or final_xml, 0)
  File "/usr/lib64/python3.10/site-packages/libvirt.py", line 4393, in createXML
    raise libvirtError('virDomainCreateXML() failed')
libvirt.libvirtError: internal error: process exited while connecting to monitor: 2022-01-17T11:41:25.919215Z qemu-system-x86_64: -blockdev {"driver":"file","filename":"/hdd1/VM_Storage/rhel7.0.qcow2","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}: Could not open '/hdd1/VM_Storage/rhel7.0.qcow2': Permission denied

But my problem is i can’t put selinux always in permissive mode
So i want to change the context of storage location to virt_image_t

But the serious problem starts now.
when i am going to change the context of vm storage location to virt_image_t
but it doesn’t changing after applying this commands also…

sudo semanage fcontext -a -t virt_image_t "/path/path(/.*)?"
sudo restorecon -Rv /path/path

Now what…???

… To provide some context, Changing KVM default storage location to other location on fedora with selinux context

got no solution on this…

Note from the previous thread that selinux does not manage any permissions on ntfs and thus when in enforcing mode it always will block access.

If you insist on using storage on ntfs then you will be limited to having selinux disabled or only in permissive mode. OTOH, should you use a standard linux file system it should work easily.

1 Like

How do you know is an SELinux problem?

I don’t see your sealert in your post.

1 Like

How i know…!
Because when i set selinux in permissive mode then it installing VMS any where without any errors…

But in enforce mode kvm throwing error…

But, Do you have Setroubleshoot server installed?

Because sealert says what do you have to do to solve the issues.