SELinux: Could not downgrade policy file

SELinux: Could not downgrade policy file

在配置nfs服务器,设定selinux时,碰到了SELinux: Could not downgrade policy file的错误提示,下文是其解决方案。

一、故障现象

[root@system1 ~]# semanage fcontext -a -t 'public_content_t' '/protected(/.*)?'
SELinux: Could not downgrade policy file /etc/selinux/targeted/policy/policy.29, searching for an older version.
SELinux: Could not open policy file <= /etc/selinux/targeted/policy/policy.29: No such file or directory
/sbin/load_policy: Can't load policy: No such file or directory
libsemanage.semanage_reload_policy: load_policy returned error code 2.
SELinux: Could not downgrade policy file /etc/selinux/targeted/policy/policy.29, searching for an older version.
SELinux: Could not open policy file <= /etc/selinux/targeted/policy/policy.29: No such file or directory
/sbin/load_policy: Can't load policy: No such file or directory
libsemanage.semanage_reload_policy: load_policy returned error code 2.
ValueError: Could not commit semanage transaction

 二、解决方案

从故障的提示来看,说不能够降级策略文件,以及找不到policy.29这个文件

[root@system1 ~]# more /etc/redhat-release
Red Hat Enterprise Linux Server release 7.0 (Maipo)
[root@system1 ~]# uname -r
3.10.0-123.el7.x86_64

###下面查看selinux配置,如下,为disabled状态

[root@system1 ~]# sestatus
SELinux status: disabled

[root@system1 ~]# getenforce
Disabled

[root@system1 ~]# rpm -q libsepol libsemanage libselinux
libsepol-2.1.9-3.el7.x86_64
libsemanage-2.1.10-16.el7.x86_64
libselinux-2.2.2-6.el7.x86_64

### 临时修改selinux 配置
[root@system1 ~]# setenforce 1 ###尝试设置为1,依旧提示关闭
setenforce: SELinux is disabled

[root@system1 ~]# getenforce
Disabled

### 查看enforce配置文件
[root@system1 ~]# more /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
#SELINUX=permissive
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

### 手工修改配置文件

[root@system1 ~]# vi /etc/sysconfig/selinux

SELINUX=enforce

[root@system1 ~]# getenforce ###依旧为关闭
Disabled

###不知道什么原因导致配置修改无法生效,于是尝试重启Linux

[root@system1 ~]# reboot

### 再次修改和执行都OK
[root@system1 ~]# getenforce
Permissive
[root@system1 ~]#
[root@system1 ~]#
[root@system1 ~]# setenforce 1
[root@system1 ~]#
[root@system1 ~]# getenforce
Enforcing

### 再次执行semanage成功
[root@system1 ~]# semanage fcontext -a -t 'public_content_t' '/protected(/.*)?'
[root@system1 ~]#

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/113418.html原文链接:https://javaforall.net

(0)
上一篇 2021年10月18日 下午3:00
下一篇 2021年10月18日 下午4:00


相关推荐

  • 隶属度函数绘制

    隶属度函数绘制建立 pi 型隶属度函数 1 x 1 0 1 10 y pimf x 14510 plot x y xlabel 函数输入值 ylabel 函数输出值 grinon2 建立双边高斯型隶属度函数 gauss2mfx 0 0 1 10 y1 gauss2mf x 2418 4 和 8 是最高值 2 和 1 是宽度 2 是左边的宽度 1 是右边的宽度 y2 gauss2mf x 251

    2026年3月18日
    2
  • MATLAB学习笔记:数值积分

    MATLAB学习笔记:数值积分当 1 被积函数的原函数不能用初等函数表示 2 被积函数难以用公式表示 而是用图形或表格给出的 就应该建立定积分的近似计算方法 数值积分方法 梯形法 z trapz x y x 0 0 5 1 y exp x 2 z trapz x y z 0 7314x 0 0 05 1

    2026年3月17日
    4
  • 理解 sudo 和 sudoers[通俗易懂]

    理解 sudo 和 sudoers[通俗易懂]在Linux上,只有root用户可以执行任何命令,其他用户必须使用sudo才可执行特殊的命令.sudo是通过sudoers进行配置的.默认配置/etc/sudoers:##ThisfileMUSTbeeditedwiththe’visudo’commandasroot.##Pleaseconsideraddinglocalcontentin/etc/sudoers.d/insteadof#directlymodifying

    2022年6月20日
    33
  • Java 匿名类(通俗易懂)

    Java 匿名类(通俗易懂)匿名类有两种 1 与子类有关的匿名类 2 与接口有关的匿名类 1 与子类有关的匿名类 packagecom 与子类有关的匿名类 publicclassD publicstatic Stringargs Testtest newTest Personperson newBoy test

    2026年3月16日
    2
  • 将博客搬至CSDN

    将博客搬至CSDN

    2020年11月20日
    222
  • 优秀ASP.NET程序员修炼之路

    初级的程序员或经验不足的程序员往往只意识到自己的程序是写给计算机的,而不会在意程序其实也是写给人的,或在意得不够、不全面。写给机器的程序,往往追求的是运行正确、执行效率能满足要求。但程序员的任务仅仅

    2021年12月25日
    48

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号