gpt4 book ai didi

CENTOS 8/SELinux 的 Pm2 启动问题

转载 作者:行者123 更新时间:2023-12-04 01:23:30 25 4
gpt4 key购买 nike

请问,你知道如何解决这个问题吗?
我到处找都没有找到。

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
节点版本: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

谢谢

最佳答案

正如评论中所说,我有 exact same issue .
要解决此问题,只需在尝试启动 PM2 服务后以 root 身份运行以下命令(在您的情况下,此启动尝试将是 systemctl start pm2-root )

ausearch -c 'systemd' --raw | audit2allow -M my-systemd
semodule -i my-systemd.pp
这看起来很一般,但确实有效。这些行是 SELinux 本身建议的。为了得到它们,我必须运行命令 journalctl -xe尝试启动服务后

关于CENTOS 8/SELinux 的 Pm2 启动问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62240348/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com