pm2 - CENTOS 8 / SELinux 的 Pm2 启动问题
问题描述
请问,你知道如何解决这个问题吗?我到处寻找,没有找到。
06:45 SELinux is preventing systemd from open access on the file /root/.pm2/pm2.pid. For complete SELinux messages run: sealert -l d84a5a0b-cfcf-4cb9-918a-c0952bf70600 setroubleshoot
06:45 pm2-root.service: Can't convert PID files /root/.pm2/pm2.pid O_PATH file descriptor to proper file descriptor: Permission denied systemd 2
06:45 Failed to start PM2 process manager.
我已经执行了这个命令: sealert -l d84a5a0b-cfcf-4cb9-918a-c0952bf70600 setroubleshoot
Messages d'audit bruts
type=AVC msg=audit(1591498085.184:7731): avc: denied { open } for pid=1 comm="systemd" path="/root/.pm2/pm2.pid" dev="dm-0" ino=51695937 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:admin_home_t:s0 tclass=file permissive=0
PM2 版本:4.4.0 NODE 版本:12.18.0 CentOS 版本:8
我的系统服务:
[Unit]
Description=PM2 process manager
Documentation=https://pm2.keymetrics.io/
After=network.target
[Service]
Type=forking
User=root
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
Environment=PATH=/sbin:/bin:/usr/sbin:/usr/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
Environment=PM2_HOME=/root/.pm2
PIDFile=/root/.pm2/pm2.pid
Restart=on-failure
ExecStart=/usr/lib/node_modules/pm2/bin/pm2 resurrect
ExecReload=/usr/lib/node_modules/pm2/bin/pm2 reload all
ExecStop=/usr/lib/node_modules/pm2/bin/pm2 kill
[Install]
WantedBy=multi-user.target
谢谢
解决方案
正如评论中所说,我遇到了完全相同的问题。
要解决此问题,只需在尝试启动 PM2 服务后以 root 身份运行以下命令(在您的情况下,此启动尝试将是systemctl start pm2-root
)
ausearch -c 'systemd' --raw | audit2allow -M my-systemd
semodule -i my-systemd.pp
这看起来很通用,但它确实有效。这些行是 SELinux 本身提出的。为了得到它们,我必须journalctl -xe
在尝试启动服务后运行命令
推荐阅读
- firebase - 使用自定义的 uid 创建用户
- php - 如何在php中提交所有单选按钮的所有选定值?
- asp.net - ASP.NET Core 错误代码 = '0x80004005':80008082
- ipopt - 试图编译 HSL 以获得 IPOPT
- python - 如何使用openCV计算盒子的堆栈
- azure - 针对 Azure AD 的主动身份验证
- python - 将字典中的值匹配到数据框行值并将数据添加到该行
- reactjs - 钩子是简化你的代码还是只是一个口味问题?
- python - 如何从 Watson Speech-to-Text 输出重建对话?
- bash - 如何递归更新文件名