Bug 246792 - net-p2p/bitcoin-daemon default rc.d script permissions error
Summary: net-p2p/bitcoin-daemon default rc.d script permissions error
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: Kevin Bowling
Depends on:
Reported: 2020-05-28 00:36 UTC by Seth
Modified: 2020-08-07 05:41 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (kbowling)


Note You need to log in before you can comment on or make changes to this bug.
Description Seth 2020-05-28 00:36:06 UTC
The bitcoin-daemon package's default rc.d script has a permissions error.

To duplicate:
# pkg install bitcoin-daemon
# sysrc bitcoind_enable="YES"
# service bitcoind start
# Error: Unable to create the PID file '/var/db/bitcoin/bitcoind.pid': Permission denied

To fix, edit /usr/local/etc/rc.d/bitcoind:
remove line pidfile="${bitcoind_data_dir}/bitcoind.pid"
uncomment #pidfile="/var/run/${name}.pid"
Comment 1 Kevin Bowling freebsd_committer 2020-08-07 01:56:06 UTC
I need some more information.  If you look at the rc.d script, it is supposed to create /var/db/bitcoin and set it to the correct user as part of the precmd.  Can you ls -al /var/db and see what is going on with that?
Comment 2 Seth 2020-08-07 05:41:00 UTC
(In reply to Kevin Bowling from comment #1)

Spin up a fresh 11.3 jail on FreeNAS and install as above.

# service bitcoind start

results in nothing happening, 

# ps aux 

reveals that the daemon is not running. To run the rc.d script verbose, I ommit the -f flag:

# /usr/sbin/daemon -u bitcoin -p /var/db/bitcoin/bitcoind.pid /usr/local/bin/bitcoind -conf=/usr/local/etc/bitcoin.conf -datadir=/var/db/bitcoin

Which results in the following output:

root@btc:~ # Error: Unable to create the PID file '/var/db/bitcoin/bitcoind.pid': Permission denied

Result of ls -la on /var/db:

drwxr-xr-x   3 bitcoin   bitcoin         4 Aug  7 00:26 bitcoin

If you change the pid location to /var/run/bitcoind.pid and run ls-la:

-rw-------   1 root  wheel      5 Aug  7 00:39 bitcoind.pid