k3tan172 / ubuntu-node-box Goto Github PK
View Code? Open in Web Editor NEWBuild a bitcoin node box from a fresh installation of Ubuntu 18.04
Build a bitcoin node box from a fresh installation of Ubuntu 18.04
First, thanks a ton, @k3tan172, for this and the YouTube series; hugely valuable.
All has gone smoothly for me with the exception of the init script for btc-rpc-explorer
under Pop_OS/Ubuntu 19.10. I'm seeing the following:
shawn@ceres ~ ❯❯❯ sudo systemctl start btc-rpc-explorer
[sudo] password for shawn:
Job for btc-rpc-explorer.service failed because of unavailable resources or another system error.
See "systemctl status btc-rpc-explorer.service" and "journalctl -xe" for details.
Here's my init script:
[Unit]
Description=btc-rpc-explorer
After=bitcoind.service
Requires=bitcoind.service
[Service]
EnvironmentFile=/home/shawn/.confg/btc-rpc-explorer.env
ExecStart=/usr/bin/btc-rpc-explorer
RuntimeDirectory=btc-rpc-explorer
PIDFile=/run/btc-rpc-explorer/explorer.pid
User=shawn
Group=shawn
Type=simple
KillMode=process
Restart=on-failure
RestartSec=60
# Hardening measures
####################
# Provide a private /tmp and /var/tmp.
PrivateTmp=true
# Mount /usr, /boot/ and /etc read-only for the process.
ProtectSystem=full
# 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
[Install]
WantedBy=bitcoind.service
Unfortunately, journalactl -xe
provides no insights.
I am able to execute btc-rpc-explorer
successfully outside of the init script.
I've managed to get a bitcoind service running, but I cannot use bitcoin-cli
commands to query or manage the service as I get an
error: Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set. See -rpcpassword and -stdinrpcpass. Configuration file: (/home/<username>/.bitcoin/bitcoin.conf)
There are two differences between my build and your node box, the first being a tor-only bitcoind setup, the second that instead of an ssd for the OS I'm running the OS and node in a 3 disk raid5 setup.
Here is the top of my bitcoind.service
file:
Description=Bitcoin daemon
After=network.target
[Service]
ExecStart=/usr/local/bin/bitcoind -daemon \
-pid=/run/bitcoind/bitcoind.pid \
-conf=/home/<username>/.bitcoind/bitcoin.conf \
-datadir=/home/<username>/.bitcoind
# Make sure the config directory is readable by the service user
PermissionsStartOnly=true
ExecStartPre=/bin/chgrp <username> /etc/bitcoin
# Process management
####################
Type=forking
PIDFile=/run/bitcoind/bitcoind.pid
Restart=on-failure
TimeoutStopSec=600
# Directory creation and permissions
####################################
# Run as bitcoin:bitcoin -> changed to debian-tor:<username>
User=<username>
Group=debian-tor
my bitcoin.conf
file looks like this:
onlynet=onion
maxconnections=20
proxy=127.0.0.1:9050
#listen=1
# [core]
# run in the background as a daemon and accept commands
daemon=1
bind=127.0.0.1
dbcache=100
maxmempool=100
par=3
Excellent!
I started a repo with some ansible scripts to automatically set up a full node (and more) on a box, see https://github.com/Furunodo/sovbox
It's early stage, currently sets up full node plus ElectrumX.
I'll probably check this guide to add more tech to the sovbox stack.
Hi!
I am trying to set the bitcoind.service working and apparently I am not capable to do so.
Different as your tutorial I am using the same HDD where linux is installed so my datadir is
home/lunaticoin/.bitcoin
I then modified the bitcoind.service as you explain but I kept the same datadir (-datadir=/var/lib/bitcoind) as the referenced file states.
When I do so and I run
sudo systemctl daemon-reload
sudo systemctl start bitcoind
Nothing appears. Bu when y run:
sudo systemctl status bitcoind.service
I get the following error
● bitcoind.service - Bitcoin daemon
Loaded: loaded (/etc/systemd/system/bitcoind.service; enabled; vendor preset: enabled)
Active: **failed** (Result: exit-code) since Sun 2019-11-10 15:15:04 CET; 3min 54s ago
Process: 2426 ExecStart=/usr/local/bin/bitcoind -daemon -pid=/run/bitcoind/bitcoind.pid -conf=/home/lunaticoin/.bitcoin/bitcoin.conf -datadir=/var/lib/bitcoind (code=exited, status=0/SUCCESS)
Process: 2425 ExecStartPre=/bin/chgrp lunaticoin /etc/bitcoin (code=exited, status=0/SUCCESS)
Main PID: 2427 (code=exited, status=1/**FAILURE**)
nov 10 15:15:04 LunaBase systemd[1]: bitcoind.service: Service hold-off time over, scheduling restart.
nov 10 15:15:04 LunaBase systemd[1]: bitcoind.service: Scheduled restart job, restart counter is at 5.
nov 10 15:15:04 LunaBase systemd[1]: Stopped Bitcoin daemon.
nov 10 15:15:04 LunaBase systemd[1]: bitcoind.service: Start request repeated too quickly.
Any Idea what is wrong?
I also tried to modify the datadir in the bitcoind.service to /home/lunaticoin/.bitcoin
but then it gives already an error when I execture sudo systemctl start bitcoind
Job for bitcoind.service failed because the control process exited with error code.
See "systemctl status bitcoind.service" and "journalctl -xe" for details.
Hi,
I have a problem installing c-lightning, you mention that a .lightning folder should be created after compiling and installing, but i didnt get that folder created automatically... sudo make and sudo make install ends with no errors... Should i just create the folder manually?
Hello,
I am having issues with the bitcoin.service file. The only difference is I installed bitcoin core from the ppa, everything else is identical as far a folder structure is concerned.
I get this error when executing:
sudo systemctl start bitcoind
Job for bitcoind.service failed because the control process exited with error code. See "systemctl status bitcoind.service" and "journalctl -xe" for details.
I then execute journalctl -xe
And get:
-- The error number returned by this process is 2.`
Please any help would be greatly appreciated! I have trouble-shot it like crazy and no luck.
I've been struggling with the electrum personal server for a while not getting it to connect.
Staring very hard today I realised it was trying to connect to testnet.
I removed the 2 on teh port number and everything worked great, I'd suggest a note to make this obvious as this is a great guide for noob and this is a simple mistake!
Hi, im following your guide and having a weird problem, bitcoin daemon sometimes auto-starts but sometimes it doesnt... When it doesnt autostarts after a reboot, the error message is the following:
wae@node:~$ sudo systemctl status bitcoind
● bitcoind.service - Bitcoin daemon
Loaded: loaded (/etc/systemd/system/bitcoind.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2019-11-14 17:44:15 -04; 2h 40min ago
Process: 804 ExecStart=/usr/local/bin/bitcoind -daemon -pid=/run/bitcoind/bitcoind.pid -conf=/home/wae/.bitcoin/bitcoin.conf -datadir=/mnt/1TBHDD/Bit
Process: 799 ExecStartPre=/bin/chgrp wae /etc/bitcoin (code=exited, status=0/SUCCESS)
nov 14 17:44:15 node systemd[1]: Starting Bitcoin daemon...
nov 14 17:44:15 node systemd[1]: bitcoind.service: Control process exited, code=exited status=1
nov 14 17:44:15 node systemd[1]: bitcoind.service: Failed with result 'exit-code'.
nov 14 17:44:15 node systemd[1]: Failed to start Bitcoin daemon.
nov 14 17:44:15 node systemd[1]: bitcoind.service: Service hold-off time over, scheduling restart.
nov 14 17:44:15 node systemd[1]: bitcoind.service: Scheduled restart job, restart counter is at 5.
nov 14 17:44:15 node systemd[1]: Stopped Bitcoin daemon.
nov 14 17:44:15 node systemd[1]: bitcoind.service: Start request repeated too quickly.
nov 14 17:44:15 node systemd[1]: bitcoind.service: Failed with result 'exit-code'.
nov 14 17:44:15 node systemd[1]: Failed to start Bitcoin daemon.
My bitcoind.service is this:
[Unit]
Description=Bitcoin daemon
After=network.target
[Service]
ExecStart=/usr/local/bin/bitcoind -daemon
-pid=/run/bitcoind/bitcoind.pid
-conf=/home/wae/.bitcoin/bitcoin.conf
-datadir=/mnt/1TBHDD/Bitcoin
PermissionsStartOnly=true
ExecStartPre=/bin/chgrp wae /etc/bitcoin
Type=forking
PIDFile=/run/bitcoind/bitcoind.pid
Restart=always
User=wae
Group=wae
RuntimeDirectory=bitcoind
RuntimeDirectoryMode=0710
ConfigurationDirectory=bitcoin
ConfigurationDirectoryMode=0710
StateDirectory=bitcoind
StateDirectoryMode=0710
PrivateTmp=true
ProtectSystem=full
ProtectHome=false
NoNewPrivileges=true
PrivateDevices=true
MemoryDenyWriteExecute=true
[Install]
WantedBy=multi-user.target
Hope you can help me! Thanks!
Hi, I finally managed to start bitcoind on boot using systemd service file, but i got a very weird issue, bitcoind is running but bitcoin-cli commands are not working... The outputs from the terminal are these:
wae@node:~$ sudo systemctl status bitcoind
● bitcoind.service - Bitcoin daemon
Loaded: loaded (/etc/systemd/system/bitcoind.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-01-15 09:31:38 -04; 3min 24s ago
Process: 803 ExecStart=/usr/local/bin/bitcoind -daemon -pid=/run/bitcoind/bitcoind.pid -conf=/home/wae/.bitcoin/bitcoin.conf -datadir=/mnt/1TBHDD/Bitcoin (code=exited,
Process: 756 ExecStartPre=/bin/chgrp wae /etc/bitcoin (code=exited, status=0/SUCCESS)
Main PID: 861 (bitcoind)
Tasks: 8 (limit: 3389)
CGroup: /system.slice/bitcoind.service
└─861 /usr/local/bin/bitcoind -daemon -pid=/run/bitcoind/bitcoind.pid -conf=/home/wae/.bitcoin/bitcoin.conf -datadir=/mnt/1TBHDD/Bitcoin
ene 15 09:31:33 node systemd[1]: Starting Bitcoin daemon...
ene 15 09:31:38 node systemd[1]: bitcoind.service: Can't open PID file /run/bitcoind/bitcoind.pid (yet?) after start: No such file or directory
ene 15 09:31:38 node systemd[1]: Started Bitcoin daemon.
wae@node:~$ bitcoin-cli getblockchaininfo
error: Could not connect to the server 127.0.0.1:8332
Make sure the bitcoind server is running and that you are connecting to the correct RPC port.
wae@node:~$ bitcoin-qt
Error: Cannot obtain a lock on data directory /mnt/1TBHDD/Bitcoin. Bitcoin Core is probably already running.
If I stop the bitcoind service, and start it again with bitcoind -daemon, everything works well... Hop you can help me!
Hello, as i said in the other issue, im having problems now with the btc-rpc-explorer service file, my service file is as follow:
[Unit]
Description=btc-rpc-explorer
After=bitcoind.service
Requires=bitcoind.service
[Service]
EnvironmentFile=/home/wae/.config/btc-rpc-explorer.env
ExecStart=/home/wae/.nvm/versions/node/v13.3.0/bin/btc-rpc-explorer
RuntimeDirectory=btc-rpc-explorer
PIDFile=/run/btc-rpc-explorer/explorer.pid
User=wae
Group=wae
Type=simple
KillMode=process
Restart=on-failure
RestartSec=60
PrivateTmp=true
ProtectSystem=full
NoNewPrivileges=true
PrivateDevices=true
[Install]
WantedBy=bitcoind.service
And the ouput from the terminal is this:
wae@node:~/.config$ sudo systemctl status btc-rpc-explorer.service
● btc-rpc-explorer.service - btc-rpc-explorer
Loaded: loaded (/etc/systemd/system/btc-rpc-explorer.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2020-01-15 22:00:12 -04; 51s ago
Process: 3453 ExecStart=/home/wae/.nvm/versions/node/v13.3.0/bin/btc-rpc-explorer (code=exited, status=127)
Main PID: 3453 (code=exited, status=127)
ene 15 22:00:12 node systemd[1]: btc-rpc-explorer.service: Main process exited, code=exited, status=127/n/a
ene 15 22:00:12 node systemd[1]: btc-rpc-explorer.service: Failed with result 'exit-code'.
If i type btc-rpc-explorer on the terminal the explorer works ok in the browser, i googled about code 127 on systemd and it said that was something related to ExecStart was not a executable file...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.