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. [LeetCode] Binary Tree Postorder Traversal dfs,深度搜索

    Given a binary tree, return the postorder traversal of its nodes' values. For example:Given binary t ...

  2. 八、 Java程序初始化的顺序(一)

    今天在写构造器方法的时候,遇到了一个小问题,由这个问题引发了一连串的思考,在一个Java类中变量与类的初始化执行顺序是什么样的呢?## 发现问题 class Student{ private Stri ...

  3. 2016百度之星资格赛 Round1(2,3,4题)

    Problem B Accepts: 2515 Submissions: 9216 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536 ...

  4. 静态变量(static)的特点

    静态变量(static):有局部变量,也有全局变量. 静态局部变量:在函数体内用static说明的变量称为静态局部变量,属于静态类别. 特点: (1)它占据一个永久性的存储单元.随着文件的存在而存在. ...

  5. LeetCode OJ-- Recover Binary Search Tree ***@

    https://oj.leetcode.com/problems/recover-binary-search-tree/ 一棵二叉搜索树,二叉搜索树的特征是,中根遍历的话,得到的序列是递增的 题目中, ...

  6. springBoot 打成jar包

    1.一种方式通过cmd 窗口进行打包 配置maven 环境变量 进入到项目中  运行 mvn clean 然后运行mvn package 进行打包 2.通过idea 进行打包 (1)pom 中安装打包 ...

  7. Codeforces 777D Cloud of Hashtags(贪心)

    题目链接 Cloud of Hashtags 题目还是比较简单的,直接贪心,但是因为我有两个细节没注意,所以FST了: 1.用了cin读入,但是没有加 std::ios::sync_with_stdi ...

  8. JMeter进行http接口测试

    Jmter工具设计之初是用于做性能测试的,它在实现对各种接口的调用方面已经做的比较成熟,因此,本次直接使用Jmeter工具来完成对Http接口的测试. 一.开发接口测试案例的整体方案: 第一步:我们要 ...

  9. Light oj 1095 - Arrange the Numbers (组合数学+递推)

    题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1095 题意: 给你包含1~n的排列,初始位置1,2,3...,n,问你刚好固定 ...

  10. Longest Increasing Subsequence - LeetCode

    Given an unsorted array of integers, find the length of longest increasing subsequence. For example, ...