在Ubuntu20.04LTS上,我为bitcoind创建了一个服务/ systemd单元,但是当我启动它时,我会得到以下错误:
Can't open PID file /run/bitcoind/bitcoind.pid (yet?) after start: Operation not permitted
哪一个听起来像是权限问题(?),但我的理解是,包含它的PID文件和/或文件夹是短暂的,就像只在服务运行时才出现一样,那么您将如何为来来往往的东西分配持久的权限呢?此外,似乎还需要为此修改权限。我该怎么做才能让这个单位正常运转?
● bitcoind.service - Bitcoin daemon
     Loaded: loaded (/etc/systemd/system/bitcoind.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sun 2021-06-20 09:46:57 CDT; 14s ago
    Process: 104861 ExecStart=/usr/local/bin/bitcoind -daemon -pid=/run/bitcoind/bitcoind.pid -conf=/home/first/.bitcoin/bitcoin.conf -datadir=/blockchain/.bitcoin/data (code=exited, status=0/SUCCESS)
   Main PID: 104866 (code=exited, status=1/FAILURE)
Jun 20 09:46:57 server systemd[1]: Starting Bitcoin daemon...
Jun 20 09:46:57 server systemd[1]: bitcoind.service: Can't open PID file /run/bitcoind/bitcoind.pid (yet?) after start: Operation not permitted
Jun 20 09:46:57 server systemd[1]: Started Bitcoin daemon.
Jun 20 09:46:57 server systemd[1]: bitcoind.service: Main process exited, code=exited, status=1/FAILURE
Jun 20 09:46:57 server systemd[1]: bitcoind.service: Failed with result 'exit-code'.我正在使用这个bitcoind.service文件,该文件来自于斯塔迪克斯拉斯皮波特安装指南:
# RaspiBolt: systemd unit for bitcoind
# /etc/systemd/system/bitcoind.service
[Unit]
Description=Bitcoin daemon
After=network.target
[Service]
# Service execution
###################
ExecStart=/usr/local/bin/bitcoind -daemon \
                                  -pid=/run/bitcoind/bitcoind.pid \
                                  -conf=/home/first/.bitcoin/bitcoin.conf \
                                  -datadir=/blockchain/.bitcoin/data
# Process management
####################
Type=forking
PIDFile=/run/bitcoind/bitcoind.pid
#ExecStartPost=/bin/sh -c 'chown first:first /run/bitcoind/bitcoind.pid'
#Restart=on-failure
#TimeoutSec=300
#RestartSec=30
# Directory creation and permissions
####################################
# Run as bitcoin:bitcoin
User=first
Group=first
# /run/bitcoind
RuntimeDirectory=bitcoind
RuntimeDirectoryMode=0710
# Hardening measures
####################
# Provide a private /tmp and /var/tmp.
PrivateTmp=true
# Mount /usr, /boot/ and /etc read-only for the process.
ProtectSystem=full
# Deny access to /home, /root and /run/user
ProtectHome=true
# Disallow the process and all of its children to gain
# new privileges through execve().
NoNewPrivileges=true
# Use a new /dev namespace only populated with API pseudo devices
# such as /dev/null, /dev/zero and /dev/random.
PrivateDevices=true
# Deny the creation of writable and executable memory mappings.
MemoryDenyWriteExecute=true
[Install]
WantedBy=multi-user.target您可以看到,我尝试将其添加到bitcoind.service文件中:
ExecStartPost=/bin/sh -c 'chown first:first /run/bitcoind/bitcoind.pid'但是它没有工作,似乎是在bitcoind.pid文件存在之前执行的。
发布于 2021-06-20 18:49:49
两项调查结果:
# Deny access to /home, /root and /run/user
ProtectHome=true/home/.位币是我拥有bitcoin.conf文件的地方,所以这就是问题所在。将bitcoin.conf重新定位到其他地方,或者禁用ProtectHome,可以在这种特殊情况下成功启动服务。
Can't open PID file /run/bitcoind/bitcoind.pid (yet?) after start: Operation not permitted这个消息是偶尔出现的,即使在服务正常启动时也是如此,因此,显然,在这种情况下,它根本不是一个问题。
发布于 2021-07-26 11:38:39
无法打开PID文件/运行/bitcoind/bitcoind.pid
/run、/run/bitcoid或/run/bitcoind/bitcoind.pid不存在,如果存在,则不属于需要它的组的用户。
User=first将假设用户是“第一”,当pid文件被另一个用户(/group)拥有时,然后"first“,您也会得到一个”拒绝的权限“。
以比特币形式运行的:比特币User=first Group=first
请注意,该条规定:
以比特币形式运行的:比特币User=bitcoin Group=bitcoin
而不是“先”。
https://askubuntu.com/questions/1347064
复制相似问题