Page 1 of 1

Centos 7: Could not open kernel policy /etc/selinux/targeted/active/policy.kern for reading. (No such file or directory)

Posted: 2023 May 03, 20:08
by Mihai
The operating system is restarted and in the boot menu the E key is pressed (to edit the settings).
Add the parameter selinux=0 to the end of the line that begins with the following syntax: linux16.
Press Ctrl+x to save the settings.
After booting, run the reinstall command for selinux-policy-targeted

Code: Select all

[root @ CentOS ~]$ yum reinstall selinux-policy-targeted -y
If selinux policy targeted is not installed, the command to install it is executed

Code: Select all

[root @ CentOS ~]$ yum install selinux-policy-targeted -y
After installing the selinux-policy-targeted package, run the command

Code: Select all

[root @ CentOS ~]$ touch /.autorelabel
Reboot the server

Code: Select all

[root @ CentOS ~]$ reboot -h now
After rebooting the server, execute the command: sestatus, which will print the following output

Code: Select all

[root @ CentOS ~]$ sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      31
NOTE: After executing the reboot command, it will take a longer time for the operating system to reinitialize