Changing KVM default storage location to other location on fedora with selinux context

Hi…

Is there any way to change default storage location to other locations with selinux context in KVM on fedora…when i am trying to change the selinux context of new storage location directory with virt_image_t… but it doesn’t changing…

commands is used… :point_down:-

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

still it doesn’t changes the context of a new directory…

Follow this article

first article not worked and second article also not worked… even after selinux in permissive mode the context not changed…

If selinux is in permissive mode, then selinux is probably not your issue.

What does it say if you expand the details there?

Also, are you still trying to use an NTFS filesystem here?

Doesn’t seems like selinux is the issue can you see if other distros also have that same issue.

Yeah first i tried in Ntfs it gives error… so i created ext4 fs and tried with in ext4 also but the same problem coming in ext4 what i got previous error in ntfs…

In my laptop also fedora only and no available space to check and test…

yeah its selinux issue only because now i checked in permissive mode it creates vm storage in ntfs partition without any error…
but what will happen after installation completed in vm if i set to enforce mode…!!

but my issue is i mentioned in my question that it doesn’t changing context to virt_image_t of any directory not only ntfs mount point…

yeah its selinux issue only because now i checked in permissive mode it creates vm storage in ntfs partition without any error…
but what will happen after installation completed in vm if i set to enforce mode…!!

but my issue is i mentioned in my question that it doesn’t changing context to virt_image_t of any directory not only ntfs mount point…

You can mount it with contexts, 4.9. Mounting File Systems Red Hat Enterprise Linux 7 | Red Hat Customer Portal

Have you tried using chcon to set the context?

1 Like

no i didn’t tried with chcon

i tried this but it didn’t change context…

sudo umount /dev/sda2

sudo mount /dev/sda2 /Data1 -o defcontext="system_u:object_r:virt_image_t:s0"

sudo chcon system_u:object_r:virt_image_t:s0 /Data1/VM_Storage/
chcon: failed to change context of '/Data1/VM_Storage/' to ‘system_u:object_r:virt_image_t:s0’: Operation not supported

If you haven’t already, please try with just context.
sudo mount /dev/sda2 /Data1 -o context="system_u:object_r:virt_image_t:s0"

TBH, this may just be an issue with using NTFS for this.

1 Like