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


相关推荐

  • 查看Linux内核版本的命令_查看redhat版本命令

    查看Linux内核版本的命令_查看redhat版本命令有朋友在使用Linux的过程中要查看Linux的内核版本号,这要怎么看呢?也有朋友文要怎么查看linux系统版本信息呢?下面和小编一起了解一下吧。一、查看linux内核版本号1:登录linux,在终端输入cat/proc/version2:登录linux,在终端输入uname-a即列出linux的内核版本号。二、查看linux系统版本信息1:登录到linux服务器执行lsb_rele…

    2022年10月13日
    4
  • @RequestMapping拦截多个请求

    @RequestMapping拦截多个请求

    2021年7月19日
    98
  • 通俗讲解 同步、异步、阻塞、非阻塞 编程

    通俗讲解 同步、异步、阻塞、非阻塞 编程#真正意义上的异步IO是说内核直接将数据拷贝至用户态的内存单元,再通知程序直接去读取数据。#select/poll/epoll都是同步IO的多路复用模式1.同步和异步#同步和异步关注的是消息通信机制#所谓同步,就是在发出一个*调用*时,没得到结果之前,该*调用*就不返回。但是一旦调用返回就得到返回值了,*调用者*主动等待这个*调用*的结果#所谓异步,就是在发出一个*调用*时,这个*调用*就直接返回了,不管返回有没有结果。当一个异步过程调用发出后,*被调用者*.

    2022年6月1日
    38
  • 页面浮动广告举例_html向下浮动代码

    页面浮动广告举例_html向下浮动代码今天做网页两侧浮动广告图片,用js代码是实现,下面是一个*.js文件,在需要用到的网页加一句代码language=”javascript”src=”*.js”>即可使用,我可弄好的,分享给有需要朋友。leftcode1=”href=’http://www.dizhu88.com/’target=’_blank’>src=’http://www.dizhu88.com/images/xibao…

    2025年12月10日
    8
  • OpenClaw Windows 安装完全指南(2026 最新版)

    OpenClaw Windows 安装完全指南(2026 最新版)

    2026年3月13日
    4
  • 湖北第二师范学院计算机学院考研率,22考研全面数据解析你报考的地区到底有多难?…

    湖北第二师范学院计算机学院考研率,22考研全面数据解析你报考的地区到底有多难?…原标题:22考研全面数据解析你报考的地区到底有多难?我国的硕士研究生报考人数年年激增,屡创新高,2019年达到290万人,2020年首次突破300万人,达到341万人,按照这样的考研趋势,2021年报考人数突破400万人也是极有可能的。从历年的数据来看,自2015年起,报名人数的增长率都在不断增大,2020年的增长率相对2019年降低了4.21%,但是报名人数实际上都是增加了50多万。考研热度每…

    2022年5月6日
    312

发表回复

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

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