装了fedora23后定时关机:sudo shutdown -h +60

  弹出如下信息后立刻就关机了:

Failed to call ScheduleShutdown in logind, proceeding with immediate shutdown: Access denied
  
  
  Google一下,问题出在selinux。看下日志:
journalctl | grep -i avc

  找到问题所在:

Nov  :: RedBase audit[]: AVC avc:  denied  { create } for  pid= comm="systemd-logind" name=".#scheduledKNqxuo" scontext=system_u:system_r:systemd_logind_t:s0 tcontext=system_u:object_r:init_var_run_t:s0 tclass=file permissive=

  在/var/log/audit/audit.log中也找到相应信息:

# sudo audit2why < /var/log/audit/audit.log
type=AVC msg=audit(1448512017.541:): avc:  denied  { create } for  pid= comm="systemd-logind" name=".#scheduledKNqxuo" scontext=system_u:system_r:systemd_logind_t:s0 tcontext=system_u:object_r:init_var_run_t:s0 tclass=file permissive=

    Was caused by:
Missing type enforcement (TE) allow rule. You can use audit2allow to generate a loadable module to allow this access.

  那我们就使用audit2allow来生成相应模块来解决这个问题吧:

# cd /etc/selinux/targeted/policy
# grep systemd-logind /var/log/audit/audit.log | audit2allow -M mypol
# sudo semodule -i mypol.pp

  搞定,这样在当前目录下就生成了两个文件:mypol.pp  mypol.te,看看:

# vim mypol.te

#============= systemd_logind_t ==============
allow systemd_logind_t init_var_run_t:file create;

  试验一下:

# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version:
# shutdown -h +
Shutdown scheduled for Mon -- :: CST, use 'shutdown -c' to cancel.

  Bingo!这样以后晚上工作没完成时,就可以让我的电脑多加一下班啦 :)

Failed to call ScheduleShutdown in logind, proceeding with immediate shutdown: Access denied的更多相关文章

  1. CDbConnection failed to open the DB connection: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: YES)

    连接mysql出错:CDbConnection failed to open the DB connection: SQLSTATE[28000] [1045] Access denied for u ...

  2. mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using password: YES)'

    就当作自己忘记Mysql密码把,忘记密码的解决方法 一.mysql登录错误mysqladmin: connect to server at 'localhost' failederror: 'Acce ...

  3. TortoiseGit拉取或推送,输入账号密码后提示 HTTP Basic: Access denied fatal: Authentication failed 解决方案

    TortoiseGit拉取或推送项目,输入账号密码后,提示 HTTP Basic: Access denied fatal: Authentication failed. 大体意思是,HTTP基本认证 ...

  4. git Remote: HTTP Basic: Access denied Git failed with a fatal error.

    解决方案: git clone 项目失败,报下面的错误信息: $ git clone http://192.168.0.141/xxxx.git Cloning into 'appEnterprise ...

  5. service mysqld start,Failed to start mysqld.service: Access denied

    service mysqld start 然后报: ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===Authentic ...

  6. 三星笔记本安装系统时报错:image failed to verify with * access denied* press any key to continue.

    安装系统从光盘启动报错: 出现黑屏,并且有一个提示框image failed to verify with *access denied*press any key to continue 原因:三星 ...

  7. TortoiseGit拉取或推送项目提示 HTTP Basic: Access denied fatal: Authentication failed.

      TortoiseGit拉取或推送项目提示 HTTP Basic: Access denied fatal: Authentication failed. 大体意思是,HTTP基本认证失败,访问被拒 ...

  8. xamarin调试android部署到模拟器错误记录:Deployment failed Mono.AndroidTools.InstallFailedException: Unexpected install output: Error: Could not access the Package Manager. Is the system running?

    问题记录: 1.生成 ok. 2.昨天也是能部署到模拟器的. 但是今天部署的时候就报了这样的一个错误 Deployment failed Mono.AndroidTools.InstallFailed ...

  9. remote: http basic: access denied fatal: authentication failed for '‘解决办法

    问题描述 由于这个项目代码使用https 进行clone,为什么?因为代码库ssh有问题!fuck! 导致在push代码的时候出现了 remote: http basic: access denied ...

随机推荐

  1. PE格式第五讲,手工添加节表

    PE格式第五讲,手工添加节表 作者:IBinary出处:http://www.cnblogs.com/iBinary/版权所有,欢迎保留原文链接进行转载:) 首先我们要用汇编编写一段汇编代码,用来生成 ...

  2. 【特效】hover图片立体翻转

    hover图片翻转效果二::绕Y轴旋转90度,注意父层要加透视属性perspective,这样才能看出立体效果 html: <ul class="list-img"> ...

  3. 简单说下C#变量的作用域

    变量的作用域分为局部变量和全局变量举个小例子 class Program { int i = 3;//这个变量i 需要实例化Program才能使用 static void Main(string[] ...

  4. PHP中header的作用

    1.跳转: //若等待时间为0,则与header("location:")等效.  //Header("Location:http://localhost//sessio ...

  5. Caused by: java.lang.IllegalArgumentException: 'dataSource' or 'jdbcTemplate' is required

    概述 看到异常 一般就知道 在使用JdbcTemplate 需要购入数据源, 购入数据源的方式有两种,一种是xml 配置 在DAO层注入数据源, 另一种是在xml 中 配置模版JdbcTemplate ...

  6. 【转】RAM 大全-DRAM, SRAM, SDRAM的关系与区别

    http://blog.csdn.net/huleide/article/details/5506698 ROM和RAM指的都是半导体存储器,ROM是Read Only Memory的缩写,RAM是R ...

  7. GTK主题黑边问题

    Linux就是这样,上游一出点什么奇怪的变动,下游程序就要受影响..最近滚了一下后,不知道mesa还是xf86-intel-video哪个玩了什么新花样,所有gtk应用[主要是gnome组件]全部自带 ...

  8. iOS 之GCD串行和并发队列的理解

    dispatch_queue_t serialQueue = dispatch_queue_create("com.lai.www", DISPATCH_QUEUE_SERIAL) ...

  9. bug:未考虑实际使用场景

    最近bug比较多,汗颜. 1.需求背景 (1)app活动页面,用户参与并完成能够以1分钱价格购买指定商品(2)这个页面可分享至app以外的渠道,如微信.QQ等 2.这个bug的表现形式:用户在第三方渠 ...

  10. Linux替换命令

    :s/^.*$/\L&/100 ##将100行内的小写转换成大写 vi/vim 中可以使用 :s 命令来替换字符串. :s/vivian/sky/ 替换当前行第一个 vivian 为 sky ...