Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run as a service #62

Open
gunar opened this issue Feb 2, 2021 · 6 comments · May be fixed by #225
Open

Run as a service #62

gunar opened this issue Feb 2, 2021 · 6 comments · May be fixed by #225

Comments

@gunar
Copy link

gunar commented Feb 2, 2021

Hi,

How can I set up the snap packge to start bitcoind automatically? I'm having trouble running bitcoin-core.daemon as a service on CentOS. It seems snap (i.e. SELinux) won't let systemd read the binary file bitcoin-daemon that lives inside the snap container. Please find logs and service file below. Any help is greatly appreciated.

Also, I've just learned there's a thing called a "snap services" (docs). Perhaps that'd be the best way to move forward? In that case, perhaps we should consider adding a service configuration to this repo?

Thanks in advance.

journalctl -xe
setroubleshoot[3079]: AnalyzeThread.run(): Set alarm timeout to 10
setroubleshoot[3079]: AnalyzeThread.run(): Cancel pending alarm
setroubleshoot[3079]: failed to retrieve rpm info for /var/lib/snapd/snap/bin/bitcoin-core.daemon
setroubleshoot[3079]: SELinux is preventing /usr/lib/systemd/systemd from read access on the lnk_file /var/lib/snapd/snap>

                      *****  Plugin catchall (100. confidence) suggests   **************************

                      If you believe that systemd should be allowed read access on the bitcoin-core.daemon lnk_file by de>
                      Then you should report this as a bug.
                      You can generate a local policy module to allow this access.
                      Do
                      allow this access for now by executing:
                      # ausearch -c '(e.daemon)' --raw | audit2allow -M my-edaemon
                      # semodule -X 300 -i my-edaemon.pp

/etc/systemd/system/bitcoind.service
[Unit]
Description=Bitcoin daemon
After=network.target

[Service]
ExecStart=/var/lib/snapd/snap/bin/bitcoin-core.daemon -daemon -pid=/home/bitcoin/.bitcoin/bitcoind.pid -conf=/home/bitcoin/.bitcoin/bitcoin.conf -datadir=/home/bitcoin/.bitcoin

# Make sure the config directory is readable by the service user
ExecStartPre=+/bin/chgrp bitcoin /home/bitcoin/.bitcoin

# Process management
####################

Type=forking
PIDFile=/home/bitcoin/.bitcoin/bitcoind.pid
Restart=on-failure
TimeoutStopSec=600

# Directory creation and permissions
####################################

# Run as bitcoin:bitcoin
User=bitcoin
Group=bitcoin

[Install]
WantedBy=multi-user.target
@BadCo-NZ
Copy link

Did you get this figured out? I am currently running into this problem, running the snap as a service.

@twkonefal
Copy link

I think the snaps aren't made correctly, but this is just a guess: Snap Service Management Docs

I expected a "snap services" output showing bitcoin-core, but it's not there in spite of "snap list" showing bitcoin-core as installed. To me this means there is no service support with snaps. I hope I'm wrong :)

@242617
Copy link

242617 commented Apr 18, 2024

I have the same question. It's weird that no answer was given for such popular topic.

@BadCo-NZ
Copy link

I have the same question. It's weird that no answer was given for such popular topic.

I ended up just using Umbrel in a VM, which also has built in Tor.

@gunar
Copy link
Author

gunar commented Apr 18, 2024

Did you get this figured out?

Nope, I've moved to https://github.com/fort-nix/nix-bitcoin

@achow101 achow101 linked a pull request Apr 18, 2024 that will close this issue
@achow101
Copy link
Member

I don't think any of the people who work on Bitcoin Core use snaps or are particularly familiar with them. While we provide a snap as a courtesy, they are not particularly well maintained and doing anything more advanced than simply making the binaries available to be run is unlikely to happen. #225 is an attempt at making a snap service, but it may not work as I also do not use snaps nor am I well versed in how they work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants