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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • c语言里void什么作用,C语言中void是什么意思?

    c语言里void什么作用,C语言中void是什么意思?C语言中void是什么意思?C语言中“void”表示为无类型,相应的“void*”为无类型指针,常用在程序编写中对定义函数的参数类型、返回值、函数中指针类型进行声明,其作用是对函数返回和参数的进行限定。C语言关键字auto:声明自动变量break:跳出当前循环case:开关语句分支char:声明字符型变量或函数返回值类型const:声明只读变量continue:结束当前循环,开始下一轮循环…

    2022年5月12日
    54
  • SIGPIPE的设计意图

    SIGPIPE的设计意图SIGPIPE的设计意图SIGPIPE是为以下这种情况设计的:grep“pattern”<reallyhugefile|headgrep可能会输出成千上万行文本,但head只会读取前10行然后就退出。一旦head退出,grep就会收到SIGPIPE,然后被杀死。这样grep就不至于一直没完没了的输出没用的内容。如果你不想让你的程序因此被杀死,你可以自行处理SIGPIPE。这样的话你就会遇到writeerror,errno等于EPIPE。原文链接:SIGPIPEand

    2022年5月7日
    36
  • 1.MySql驱动的jar包下载「建议收藏」

    1.MySql驱动的jar包下载「建议收藏」文章目录1.下载MySql驱动的jar包1.下载MySql驱动的jar包1)官网:http://dev.mysql.com/downloads/connector/2)点击右边的Connetor/J3)点击Archives4)ProductVersion为MySql驱动版本,可以根据需要版本安装。查找MySql数据库版本语句:SELECTVERSION();5)点击PlatformIndependent6)选择第二个好了,MySql驱动到此就安装好了…

    2022年5月11日
    33
  • no debuggable processes_no port for remote debugger

    no debuggable processes_no port for remote debuggerAlwaysusethedebugruntimeduringthedevelopmentcycleUsethereleaseversionduringthedevelopmentphasetomeasuretheperformance/CPUutilizationoftheapplicationInstallan

    2022年10月11日
    4
  • Django(15)外键和表关系[通俗易懂]

    Django(15)外键和表关系[通俗易懂]外键删除操作如果一个模型使用了外键。那么在对方那个模型被删掉后,该进行什么样的操作。可以通过on_delete来指定。可以指定的类型如下:CASCADE:级联操作。如果外键对应的那条数据被删除了,

    2022年7月28日
    4
  • 本地Linux配置ip地址的方法

    本地Linux配置ip地址的方法登录后使用ifconfig命令查询IP地址如果没有ip显示则接着使用ifconfigeth0ip地址来主动给虚拟机配置ip要注意这里是eth0而不是ehto

    2022年6月2日
    33

发表回复

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

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