Why does the error 'ValueError File context for /test is not defined' occurs while trying to delete the Selinux context of files/directories?

Solution Verified - Updated -

Issue

  • Unable to delete the Selinux context of a file/directory, below error occurs.
[root@rhel7 test]# ls -lZ /test
total 0
-rw-r--r--. 1 root root unconfined_u:object_r:default_t:s0 0 Jun 25 22:41 file.txt

[root@rhel7 test]# semanage fcontext -d /test
ValueError: File context for /test is not defined

Environment

  • Red Hat Enterprise Linux 7.

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content