SELinux: Could not downgrade policy file

举报
lxw1844912514 发表于 2022/03/27 03:24:46 2022/03/27
【摘要】 在配置nfs服务器,设定selinux时,碰到了SELinux: Could not downgrade policy file的错误提示,下文是其解决方案。 一、故障现象 [root@system1 ~]# semanage fcontext -a -t 'public_content_t' '/protecte...

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

一、故障现象


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

 二、解决方案


    
  1. 从故障的提示来看,说不能够降级策略文件,以及找不到policy.29这个文件
  2. [root@system1 ~]# more /etc/redhat-release
  3. Red Hat Enterprise Linux Server release 7.0 (Maipo)
  4. [root@system1 ~]# uname -r
  5. 3.10.0-123.el7.x86_64
  6. ###下面查看selinux配置,如下,为disabled状态
  7. [root@system1 ~]# sestatus
  8. SELinux status: disabled
  9. [root@system1 ~]# getenforce
  10. Disabled
  11. [root@system1 ~]# rpm -q libsepol libsemanage libselinux
  12. libsepol-2.1.9-3.el7.x86_64
  13. libsemanage-2.1.10-16.el7.x86_64
  14. libselinux-2.2.2-6.el7.x86_64
  15. ### 临时修改selinux 配置
  16. [root@system1 ~]# setenforce 1 ###尝试设置为1,依旧提示关闭
  17. setenforce: SELinux is disabled
  18. [root@system1 ~]# getenforce
  19. Disabled
  20. ### 查看enforce配置文件
  21. [root@system1 ~]# more /etc/sysconfig/selinux
  22. # This file controls the state of SELinux on the system.
  23. # SELINUX= can take one of these three values:
  24. # enforcing - SELinux security policy is enforced.
  25. # permissive - SELinux prints warnings instead of enforcing.
  26. # disabled - No SELinux policy is loaded.
  27. #SELINUX=permissive
  28. SELINUX=disabled
  29. # SELINUXTYPE= can take one of these two values:
  30. # targeted - Targeted processes are protected,
  31. # minimum - Modification of targeted policy. Only selected processes are protected.
  32. # mls - Multi Level Security protection.
  33. SELINUXTYPE=targeted
  34. ### 手工修改配置文件
  35. [root@system1 ~]# vi /etc/sysconfig/selinux
  36. SELINUX=enforce
  37. [root@system1 ~]# getenforce ###依旧为关闭
  38. Disabled
  39. ###不知道什么原因导致配置修改无法生效,于是尝试重启Linux
  40. [root@system1 ~]# reboot
  41. ### 再次修改和执行都OK
  42. [root@system1 ~]# getenforce
  43. Permissive
  44. [root@system1 ~]#
  45. [root@system1 ~]#
  46. [root@system1 ~]# setenforce 1
  47. [root@system1 ~]#
  48. [root@system1 ~]# getenforce
  49. Enforcing
  50. ### 再次执行semanage成功
  51. [root@system1 ~]# semanage fcontext -a -t 'public_content_t' '/protected(/.*)?'
  52. [root@system1 ~]#

 

文章来源: blog.csdn.net,作者:lxw1844912514,版权归原作者所有,如需转载,请联系作者。

原文链接:blog.csdn.net/lxw1844912514/article/details/100028467

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。