Bitcoin Forum
May 12, 2024, 10:50:23 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoind immediately getting shutdown signal on systemd  (Read 128 times)
NotATether (OP)
Legendary
*
Offline Offline

Activity: 1596
Merit: 6739


bitcoincleanup.com / bitmixlist.org


View Profile WWW
March 29, 2022, 03:06:33 PM
Merited by Welsh (3), ABCbits (1), PawGo (1)
 #1

I have just force restarted my unresponsive server with Bitcoind running on it, and because it wasn't running as a service automatically before, I have created a systemd service for it which I have enabled and activated, but for some reason, something is constantly shutting it down (cleanly), and restarting it in an infinite loop!

Bitcoin Core version: 22.0
OS: Ubuntu 20.04 LTS

My bitcoin.conf:

Code:
rpcuser=#erased
rpcpassword=#erased
daemon=1
rpcallowip=0.0.0.0
whitebind=127.0.0.1:8332
whitebind=127.0.0.1:8333

My Bitcoind unit file:

Code:
[Unit]
Description=Bitcoin Core service
After=network.target
StartLimitIntervalSec=0

[Service]
User=root # don't ask (the rest of BTCPayServer is also running as root)
Type=simple
Restart=always
RestartSec=1
ExecStart=/opt/bitcoin-22.0/bin/bitcoind

[Install]
WantedBy=multi-user.target

Debug.log entries:

Code:
2022-03-29T15:05:21Z Bitcoin Core version v22.0.0 (release build)
2022-03-29T15:05:21Z InitParameterInteraction: parameter interaction: -whitebind set -> setting -listen=1
2022-03-29T15:05:21Z Assuming ancestors of block 00000000000000000008a89e854d57e5667df88f1cdef6fde2fbca1de5b639ad have valid signatures.
2022-03-29T15:05:21Z Setting nMinimumChainWork=00000000000000000000000000000000000000001fa4663bbbe19f82de910280
2022-03-29T15:05:21Z Using the 'sse4(1way),sse41(4way)' SHA256 implementation
2022-03-29T15:05:21Z Default data directory /root/.bitcoin
2022-03-29T15:05:21Z Using data directory /root/.bitcoin
2022-03-29T15:05:21Z Config file: /root/.bitcoin/bitcoin.conf
2022-03-29T15:05:21Z Config file arg: daemon="1"
2022-03-29T15:05:21Z Config file arg: rpcallowip="0.0.0.0"
2022-03-29T15:05:21Z Config file arg: rpcpassword=****
2022-03-29T15:05:21Z Config file arg: rpcuser=****
2022-03-29T15:05:21Z Config file arg: whitebind="127.0.0.1:8332"
2022-03-29T15:05:21Z Config file arg: whitebind="127.0.0.1:8333"
2022-03-29T15:05:21Z Using at most 125 automatic connections (1024 file descriptors available)
2022-03-29T15:05:21Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2022-03-29T15:05:21Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2022-03-29T15:05:21Z Script verification uses 7 additional threads
2022-03-29T15:05:21Z scheduler thread start
2022-03-29T15:05:21Z WARNING: option -rpcallowip was specified without -rpcbind; this doesn't usually make sense
2022-03-29T15:05:21Z HTTP: creating work queue of depth 16
2022-03-29T15:05:21Z Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation.
2022-03-29T15:05:21Z HTTP: starting 4 worker threads
2022-03-29T15:05:21Z Using wallet directory /root/.bitcoin/wallets
2022-03-29T15:05:21Z init message: Verifying wallet(s)…
2022-03-29T15:05:21Z init message: Loading banlist…
2022-03-29T15:05:21Z SetNetworkActive: true
2022-03-29T15:05:21Z Using /16 prefix for IP bucketing
2022-03-29T15:05:21Z Cache configuration:
2022-03-29T15:05:21Z * Using 2.0 MiB for block index database
2022-03-29T15:05:21Z * Using 8.0 MiB for chain state database
2022-03-29T15:05:21Z * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
2022-03-29T15:05:21Z Shutdown requested. Exiting.
2022-03-29T15:05:21Z Shutdown: In progress...
2022-03-29T15:05:21Z scheduler thread exit
2022-03-29T15:05:21Z Shutdown: done

The about log message occurs in a loop ever 1 second, presumably because systemd is trying to restart it again. There is no obvious error in the logs, but a strange request to shut down as soon as I type systemctl start bitcoind.service.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
You get merit points when someone likes your post enough to give you some. And for every 2 merit points you receive, you can send 1 merit point to someone else!
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715554223
Hero Member
*
Offline Offline

Posts: 1715554223

View Profile Personal Message (Offline)

Ignore
1715554223
Reply with quote  #2

1715554223
Report to moderator
1715554223
Hero Member
*
Offline Offline

Posts: 1715554223

View Profile Personal Message (Offline)

Ignore
1715554223
Reply with quote  #2

1715554223
Report to moderator
1715554223
Hero Member
*
Offline Offline

Posts: 1715554223

View Profile Personal Message (Offline)

Ignore
1715554223
Reply with quote  #2

1715554223
Report to moderator
vv181
Legendary
*
Offline Offline

Activity: 1932
Merit: 1273


View Profile
March 29, 2022, 03:17:12 PM
Last edit: March 29, 2022, 03:35:41 PM by vv181
 #2

Have you tried to increase the restart and limit interval settings?

Or maybe it's likely because you set the Restart=always. Try to change it to other settings like on-failure.

EDIT:

I'm trying to replicate the config, systemd manpage shows

Code:
If set to always, the service will be restarted regardless of whether it exited cleanly or not, got terminated abnormally by a signal, or hit a timeout.

Read more at: https://www.commandlinux.com/man-page/man5/systemd.service.5.html

With the systemd config you used, the bitcoind run successfully but only if I've configured the PIDfile. If it doesn't exists, I could reproduce your issues. I'm not sure where it's wrong, but I believe there is something to do with it.
NotATether (OP)
Legendary
*
Offline Offline

Activity: 1596
Merit: 6739


bitcoincleanup.com / bitmixlist.org


View Profile WWW
March 31, 2022, 02:17:46 PM
Merited by Welsh (2)
 #3

Apparently, Bitcoind hates running as root and that's what was causing the shutdown, as with the default systemd unit file settings, it can't even find its home folder. Kind of strange how no error is printed for it though.

I could've ran it as an unprivileged user, which I did as well as c-lightning without problems, but then running BTCPayServer as unprivileged made stupid .NET path not found errors when trying to access the store, making it effectively useless.

Time to go hunting for bargain dedi servers - I blew too much money on VPSs to continue with those again.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
WhyFhy
Hero Member
*****
Offline Offline

Activity: 1430
Merit: 513



View Profile
March 31, 2022, 11:35:53 PM
 #4

Apparently, Bitcoind hates running as root and that's what was causing the shutdown, as with the default systemd unit file settings, it can't even find its home folder. Kind of strange how no error is printed for it though.

I could've ran it as an unprivileged user, which I did as well as c-lightning without problems, but then running BTCPayServer as unprivileged made stupid .NET path not found errors when trying to access the store, making it effectively useless.

Time to go hunting for bargain dedi servers - I blew too much money on VPSs to continue with those again.

Might I interest you in this?

Perfect node system for just about all use case scenarios.
i5-6440EQ @2.7GHZ Quadcore (505e3)
32gb DDR4L ram
wifi+bluetooth (worlwide)
sim slot
x2 oldschool pci slots
2x sata/power connectors
Nic1+Nic2
x4 com ports  IRQ3,4,5&7 (RS232,RS422,RS485)
GPIO 8 In and out with mapping in bios.
4x 2.0 usb, x4 3.0 usb
1x VGA, 2x DP, 1x HDMI (Intel HD)
No passwords, OROM,SGX
Fanless the whole unit is a heatsink.
Looks like this.
Make offers, open to trades?

  BTC
.
BTC
.
 BTC
.
BTC
/]..[banned mixer]..
██
██
██
██
██
██
██

██

██

██

██
/]YOUR OPPORTUNITY TO
HAVE BITCOIN BUSINESS

██
██
██
██
██
██
██

██

██

██

██
.
  BTC
. BTC
.
.
 
BTC
  BTC
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!