From: https://www.rootusers.com/how-to-fix-mariadb-10-0-29-selinux-update-failure/

安装mysql 10.0.29后,启动mysql失败:

[root@server centos]# systemctl status mysql
â mysql.service - LSB: start and stop MySQL
Loaded: loaded (/etc/rc.d/init.d/mysql; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat -- :: UTC; 4s ago
Docs: man:systemd-sysv-generator()
Process: ExecStop=/etc/rc.d/init.d/mysql stop (code=exited, status=/SUCCESS)
Process: ExecStart=/etc/rc.d/init.d/mysql start (code=exited, status=/FAILURE) Jan :: server systemd[]: Starting LSB: start and stop MySQL...
Jan :: server mysql[]: Starting MySQL. :: mysqld_safe Logging to '/var/lib/mysql/server.err'.
Jan :: server mysql[]: :: mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Jan :: server mysql[]: /usr/bin/mysqld_safe_helper: Cannot change uid/gid (errno: )
Jan :: server mysql[]: ERROR!
Jan :: server systemd[]: mysql.service: control process exited, code=exited status=
Jan :: server systemd[]: Failed to start LSB: start and stop MySQL.
Jan :: server systemd[]: Unit mysql.service entered failed state.
Jan :: server systemd[]: mysql.service failed.

可以看到,myql服务状态是down。错误显示mysqld_safe_helper 试图更改UID/GID:

Jan  :: server mysql[]: /usr/bin/mysqld_safe_helper: Cannot change uid/gid (errno: )

根据错误提示,执行 journalctl -xe命令:

[root@server mysql]# journalctl -xe
Jan :: server setroubleshoot[]: SELinux is preventing /usr/bin/mysqld_safe_helper from using the setgid capability. For complete SELinux messages. run sealert -l 640a7d54-35ab-43b5--db6f159e1449
Jan :: server python[]: SELinux is preventing /usr/bin/mysqld_safe_helper from using the setgid capability. ***** Plugin catchall (. confidence) suggests ************************** If you believe that mysqld_safe_helper should have the setgid capability by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'mysqld_safe_hel' --raw | audit2allow -M my-mysqldsafehel
# semodule -i my-mysqldsafehel.pp

通过以上日志可以看出SELinux阻止了mysqld_safe_helper 的行为,因此mysql服务启动失败是因为SELinux的权限问题。

为了获取更多信息,执行以下命令:

[root@server mysql]# sealert -a /var/log/audit/audit.log
SELinux is preventing /usr/bin/mysqld_safe_helper from using the setuid capability. ***** Plugin catchall (. confidence) suggests ************************** If you believe that mysqld_safe_helper should have the setuid capability by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'mysqld_safe_hel' --raw | audit2allow -M my-mysqldsafehel
# semodule -i my-mysqldsafehel.pp Additional Information:
Source Context system_u:system_r:mysqld_safe_t:s0
Target Context system_u:system_r:mysqld_safe_t:s0
Target Objects Unknown [ capability ]
Source mysqld_safe_hel
Source Path /usr/bin/mysqld_safe_helper
Port
Host
Source RPM Packages MariaDB-server-10.0.-.el7.centos.x86_64
Target RPM Packages
Policy RPM selinux-policy-3.13.-.el7_3..noarch
Selinux Enabled True
Policy Type targeted
Enforcing Mode Enforcing
Host Name server
Platform Linux server
3.10.-514.2..el7.x86_64 # SMP Tue Dec
:: UTC x86_64 x86_64
Alert Count
First Seen -- :: UTC
Last Seen -- :: UTC
Local ID f3462d4b-ed6b-4e94--7ab0970c0af0 Raw Audit Messages
type=AVC msg=audit(1484389402.769:): avc: denied { setuid } for pid= comm="mysqld_safe_hel" capability= scontext=system_u:system_r:mysqld_safe_t:s0 tcontext=system_u:system_r:mysqld_safe_t:s0 tclass=capability type=SYSCALL msg=audit(1484389402.769:): arch=x86_64 syscall=setuid success=no exit=EPERM a0=3e4 a1=3e4 a2=7f2c90e772e0 a3=7f2c90e772e0 items= ppid= pid= auid= uid= gid= euid= suid= fsuid= egid= sgid= fsgid= tty=(none) ses= comm=mysqld_safe_hel exe=/usr/bin/mysqld_safe_helper subj=system_u:system_r:mysqld_safe_t:s0 key=(null) Hash: mysqld_safe_hel,mysqld_safe_t,mysqld_safe_t,capability,setuid

根据以上建议,执行建议中的命令创建本地策略:

ausearch -c 'mysqld_safe_hel' --raw | audit2allow -M my-mysqldsafehel
semodule -i my-mysqldsafehel.pp

再次启动mysql服务,仍然失败。查看错误信息,仍是关于SELinux的:

SELinux is preventing /usr/bin/mysqld_safe_helper from using the setgid capability.

仍然按照以上步骤,执行建议命令。然后,再次重启mysql服务:

[root@server ~]# systemctl restart mysql
[root@server ~]# systemctl status mysql.service -l
â mysql.service - LSB: start and stop MySQL
Loaded: loaded (/etc/rc.d/init.d/mysql; bad; vendor preset: disabled)
Active: active (running) since Sat -- :: UTC; 29min ago

当然我们可以通过执行以下命令,通过临时关闭SELinux,解决这个问题:

setenforce 

但是如果想要永久解决该问题,并保证系统的安全,还是建议通过添加SELinux策略的方式解决启动服务失败的问题。

/usr/bin/mysqld_safe_helper: Cannot change uid/gid (errno: 1) (转)的更多相关文章

  1. 安装Pod时提示ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/pod

    环境:OSX EI 10.11.1 昨天切换gem源后,招待pod安装没有任何问题,也可以正常用$ gem sources --add https://ruby.taobao.org/ --remov ...

  2. ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/pod

    因为突然要用到cocospod,突然发现在使用pod install的时候出现 -bash: pod: command not found 我去-不知道为什么,然后我就想重新安装下cocospod,在 ...

  3. sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set 的解决办法

    Linux新建用户 ,sudo报错: sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set 解决办法:重置一下s ...

  4. 解决普通用户sudo时出现/usr/bin/sudo must be owned by uid 0 and have the setuid bit set

    一:因为之前误操作使用sudo chmod -R 777 /usr命令修改了usr文件的所有者导致了此问题: 二:网上说需要进入recovery mode,经过自己的测试是不需要的: 三:步骤(只需登 ...

  5. sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

    使用root 登录,然后执行: chown root:root /usr/bin/sudo chmod 4755 /usr/bin/sudo reboot

  6. #!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby

    #!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby # This script installs to ...

  7. 解决Ubuntu sudo apt-get install遇到的E: Sub-process /usr/bin/dpkg returned an error code (1)问题

    如题,本人在安装samba等软件的时候,在命令行敲入: sudo apt-get install samba4命令的时候,系统在下载之后报错,大致内容如下: ~$ sudo apt-get insta ...

  8. 【问题】/usr/bin/env: php: 没有那个文件或目录

    php不是默认安装的,在使用symfony创建新项目时,出现这个提示. [root@localhost html]# symfony demo /usr/bin/env: php: 没有那个文件或目录 ...

  9. /usr/bin/expect介绍

    /usr/bin/expect介绍 http://blog.csdn.net/zhu_tianwei/article/details/44180637 概述 我们通过Shell可以实现简单的控制流功能 ...

随机推荐

  1. UnionFind(PYthon实现)

    UnionFind用于解决图的连通性问题,不需要给出具体路径的情况,可用来计算连通分支数 参考链接: https://blog.csdn.net/dm_vincent/article/details/ ...

  2. LeetCode OJ-- Distinct Subsequences ** 递推

    https://oj.leetcode.com/problems/distinct-subsequences/ 对于string S 和 T求,T 是 S的几种子串. 首先想到了递归方法,列出递归公式 ...

  3. Codeforces Gym101063 C.Sleep Buddies (2016 USP-ICMC)

    C.Sleep Buddies It is nighttime in the Earth Colony on Mars and everyone is getting ready to sleep. ...

  4. 设计模式(1)---Factory Pattern

    针对的问题:定义一个创建对象的接口,让其子类自己决定实例化哪一个工厂类,工厂模式使其创建过程延迟到子类进行. 第一步:创建接口 //创建一个接口 public interface Shape { pu ...

  5. 设置ListView的item不能点击

    写了一个ListView结合volley的demo ListView只是用来展示数据,所以不需要点击效果. 网上搜索了下: 可以禁用ListView ListView.setEnabled(false ...

  6. 从int 3探索Windows应用程序调试原理

    http://www.cnblogs.com/xuanyuan/p/3998408.html

  7. ArcGIS 10.2 二次开发,兼容Visual Studio 2012二次开发,完美安装教程

    GIS 经常安装是常有的事,每次重装系统都要浪费大半天去安装这个.所以凑这一次安装,把这个软件重新安装的步骤整理了一下,希望对大家有所帮助.这次整理的内容的关键优点是,对常见的出错内容进行了归纳整理. ...

  8. iOS 给三方日历加上农历

    首先创建一个农历文件 LunarCalendar.h // // LunarCalendar.h // Hnair4iPhone // // Created by yingkong1987 on 13 ...

  9. 【2048小游戏】——CSS/原生js爬坑之纯CSS模态对话框&游戏结束

    引言:2048小游戏的结束界面,使用纯CSS制作模态对话框,一般做模态对话框都会使用BootStrap自带的模态对话框组件方便使用,但在制作要运行在移动端的小项目时,就不能使用BootStrap,因为 ...

  10. AAuto如何设置字体大小

    在代码视图中(按钮呈现的是设计视图,你再按一下就切换成代码视图了)可以设置缩放比率,右下角也可以设置字体大小   如果你的"设计视图"是灰色不可点击,那是因为你的代码根本没有按钮, ...