minibolt-guide / minibolt

A step-by-step guide to building a Bitcoin & Lightning node and other stuff on a personal computer
https://minibolt.info
MIT License
72 stars 36 forks source link

[SUPPORT] Assign read permission to the Bitcoin group users for electrs #77

Closed smartm0use closed 10 months ago

smartm0use commented 1 year ago

electrs doesn't launch at startup using systemd service.

To start it I have first to run chmod g+r /home/bitcoin/.bitcoin/.cookie and then sudo systemctl start electrs.

For bitcoin-core you fixed the same issue with startupnotify=chmod g+r /home/bitcoin/.bitcoin/.cookie row in bitcoin.conf file.

How to reach the same for electrs?

twofaktor commented 1 year ago

I don't understand you, bitcoind creates the .cookie file and assigns read permission at startup for the group members can read it (i.e electrs) what are you suggesting?

smartm0use commented 12 months ago

I'm trying to figure out what's the issue. On every startup electrs doesn't start automatically and when I run it manually I get an error related to .cookie file. Then if i run chmod g+r /home/bitcoin/.bitcoin/.cookie and then run again electrs it works.

User electrs already belong to bitcoin group:

electrs@<my-machine>:~$ groups
electrs bitcoin

What could be the issue in my case?

twofaktor commented 12 months ago

I'm trying to figure out what's the issue. On every startup electrs doesn't start automatically and when I run it manually I get an error related to .cookie file. Then if i run chmod g+r /home/bitcoin/.bitcoin/.cookie and then run again electrs it works.

User electrs already belong to bitcoin group:

electrs@<my-machine>:~$ groups
electrs bitcoin

What could be the issue in my case?

I don't know, but shouldn't be like that, startupnotify=chmod g+r /home/bitcoin/.bitcoin/.cookie is defined on bitcoin.conf to automatically assign the permission at startup Bitcoin Core https://v2.minibolt.info/bitcoin/bitcoin/bitcoin-client#configuration

imagen

smartm0use commented 12 months ago

Yes, it the configuration line I wrote in my first message... that doens't work with electrs. Weird...

st3b1t commented 12 months ago

I have similar behavior... In my node v24 startupnotify command is executed after about 10/15 seconds after bitcoin service is started. .cookie file is created immediately but... the chmod applied after some seconds.. you can monitor it with:

/home/bitcoin# watch -n1 ls -l .bitcoin/.cookie
twofaktor commented 12 months ago

I think is possible to sleep electrs for seconds before startup, to give time to bitcoind start, but I'm not sure how do it

st3b1t commented 12 months ago

@twofaktor I created this script to check permissions: https://gist.github.com/st3b1t/e99d7a8f7a55b221a3d69da881318d5b

could be added in the docker command or in the Electrs startup script

twofaktor commented 11 months ago

@twofaktor I created this script to check permissions: https://gist.github.com/st3b1t/e99d7a8f7a55b221a3d69da881318d5b

could be added in the docker command or in the Electrs startup script

I think we should find another solution, docker and scripts are not allowed on RaspiBolt/MiniBolt guides

I think should be possible to use some service parameters or maybe the Electrs dev include this fix directly on the code (ideal), which could be requested opening an issue https://github.com/romanz/electrs/issues