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


相关推荐

  • 通过bindservice方法开启的服务,通过什么方法解绑_controller调用多个service

    通过bindservice方法开启的服务,通过什么方法解绑_controller调用多个service绑定本地服务AndroidManifest.xml中声明服务:&lt;serviceandroid:name=".TestLocalService"&gt;&lt;intent-filter&gt;&lt;actionandroid:name="maureen.intent.action.BIND_LOCAL…

    2026年1月16日
    3
  • 开机出现DISK BOOT FAILURE,INSERT SYSTEM DISK AND PRESS ENTER「建议收藏」

    开机出现DISK BOOT FAILURE,INSERT SYSTEM DISK AND PRESS ENTER「建议收藏」开机就出现DISKBOOTFAILURE,INSERTSYSTEMDISKANDPRESSENTER我的第一引导是从光驱,第二是从硬盘。以前是可以正常从硬盘启动的,突然发现这种现象。光驱里面没有光盘,为什么不能从硬盘启动了呢?开机滴的一声,应该是自检正常啊。打开BIOS查看了一下,好像也没动什么数据,打开机箱,把几个插头插紧了一下,(不记得做了哪些操作,反正没动内存

    2022年7月13日
    42
  • 少儿编程网站有哪些(少儿编程哪家好)

    20个热门少儿编程网站【2019】转载之本文链接:https://blog.csdn.net/shebao3333/article/details/85317936少儿编程是新的文化潮流,它涵盖了儿童学习的方方面面:逻辑思维训练、系统化思考训练、问题解决能力训练、团队协作、创造性思维培养…你可以利用我们整理的这些得到广泛认可的少儿编程网站教孩子学会编程,例如code.org、tynker.c…

    2022年4月18日
    40
  • labelme使用教程_labelme和labelimg区别

    labelme使用教程_labelme和labelimg区别LabelMe可用于实例分割,语义分割,目标检测,分类任务的数据集标注工作。在线标注版本:http://labelme2.csail.mit.edu/Release3.0/index.php?message=1python版本:https://github.com/wkentaro/labelme分类标注:Classification目标检测标注:ObjectDetection语义分割标注:SemanticSegmentation实例分割标注:InstanceSegmentation视频

    2025年11月1日
    4
  • SpringBoot实战第六章-Spring Boot核心

    SpringBoot实战第六章-Spring Boot核心

    2021年5月16日
    114
  • 电脑爱好者2012年5-12期「建议收藏」

    电脑爱好者2012年5-12期「建议收藏」电脑爱好者2012年第05期全彩高清PDF免费高速下载.pdf电脑爱好者2012年第06期全彩高清PDF免费高速下载.pdf电脑爱好者2012年第07期全彩高清PDF免费高速下载.pdf电脑爱好者201…

    2022年6月14日
    34

发表回复

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

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