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
Add systemd service to bitcoind in debian package #12769
Conversation
@ctp-tsteenholdt Please remember to squash/rebase. |
@randolf That makes total sense. My apologies - looking into it right now... |
We already have a |
@randolf The pull request should look better now - please let me know if I'm missing something. |
@laanwj I'm completely with you on that question, but I don't think we can feasibly avoid multiple versions of a file like this. The different versions of the Also, building a package for Ubuntu or Debian requires a full copy of the It think distro-specific files are probably better maintained within distro specific folders such as To underline that the Please let me know what you think. |
@ctp-tsteenholdt If it is intentional, then IMO it's not a problem. Arguably the debian-specific file is easier to maintain because at least it aims for a specific environment and can be tested there, not 'all distributions in general', which has made the file under |
@laanwj That's exactly right. |
Would be good to have an ACK from @TheBlueMatt here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, though I didnt test any of it.
contrib/debian/bitcoind.postrm
Outdated
echo "# The bitcoin user (${BCUSER}) and data dir (${BCHOME})" | ||
echo "# were left intact." | ||
echo "#" | ||
echo "# After backing up all vital data, cleanup can be completed" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make it explicit that they should check /var/lib/bitcoin for things like wallets?
contrib/debian/bitcoind.service
Outdated
After=network.target | ||
|
||
[Service] | ||
ExecStart=/usr/bin/bitcoind -daemon -conf=/etc/bitcoin/bitcoin.conf -pid=/run/bitcoind/bitcoind.pid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be nice to make the datadir explicit so that we dont have /var/lib/bitcoin/.bitcoin and instead just put stuff in /var/lib/bitcoin?
|
||
override_dh_auto_clean: | ||
if [ -f Makefile ]; then $(MAKE) distclean; fi | ||
rm -rf Makefile.in aclocal.m4 configure src/Makefile.in src/bitcoin-config.h.in src/build-aux src/qt/Makefile.in src/qt/test/Makefile.in src/test/Makefile.in | ||
|
||
QT=$(shell dpkg-vendor --derives-from Ubuntu && echo qt4 || echo qt5) | ||
# qt4 is very broken on arm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you pull the backporting of existing debian/ contents out into a separate commit to make it easier to track?
Thanks @TheBlueMatt. Each of your comments make perfect sense and I'll have them all addressed. |
I've addressed the suggestions made by @TheBlueMatt, run a test dpkg-buildpackage using the updated The commits have been updated to reflect the changes. |
@TheBlueMatt can you take another look? |
Hmm, if you're gonna pull some of the debian changes upstream, can you just pull all of them? Especially getting the changelog and other stuff out of sync seems not ideal. |
if [ "$1" = "configure" ]; then | ||
|
||
# Add bitcoin user/group - this will gracefully abort if the user already exists. | ||
# A homedir is never created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not create the directory? If its empty it will be deleted on uninstall, but if ther user ever tries to use the service things will simply fail to start, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for this approach is that, if for whatever reason the user has changed ownership or permissions on the /var/lib/bitcoin
directory, we don't want to mess with that on operations like reconfigure, update etc.
adduser
does not let me specify custom homedir permissions, so I'm using --no-create-home
to work around that. A missing home directory becomes a stable indicator that this is a fresh install, making it safe for me to create the directory and set the restrictive default permissions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I misread the script, sorry.
@TheBlueMatt I'm not sure what you mean by: Hmm, if you're gonna pull some of the debian changes upstream, can you just pull all of them? Especially getting the changelog and other stuff out of sync seems not ideal. Upstream in this case would essentially be your PPA right? Or is there somewhere else? I can certainly take a look at any other differences between this tree and yours and see if it makes sense to include in this PR or create a separate one for getting those in sync? Is this what you mean? |
Yea, just pull the stuff from the PPA's debian tar. |
Alright - I'm looking in to it... |
@TheBlueMatt so I took all the changes from your upstream PPA debian tar and committed them as a single commit. After that, I committed the Systemd changes in a separate commit. As a precaution I've run a local build and made sure that things still work as expected. |
contrib/debian/bitcoin-qt.desktop
Outdated
@@ -10,5 +10,4 @@ Terminal=false | |||
Type=Application | |||
Icon=bitcoin128 | |||
MimeType=x-scheme-handler/bitcoin; | |||
Categories=Office;Finance;P2P;Network;Qt; | |||
StartupWMClass=Bitcoin-qt | |||
Categories=Office;Finance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These additional categories were just added in #12854
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fanquake thanks. I'll get that sorted out here...
Adding systemd service for bitcoind, to provide for a simpler out-of-the-box experience. Configuration file is /etc/bitcoin/bitcoin.conf. This file is a copy of the sample configuration file. The service user 'bitcoin' is added during install. Its homedir is in '/var/lib/bitcoin'. bitcoind.service is disabled by default to allow the user to configure it, before starting it the first time. On package purge, the 'bitcoin' user as well as its homedir is left intact, to not accidentally remove a wallet or something of equal importance. Instead the user is presented with information on how to perform the cleanup manually, after making sure all important data has been backed up.
@TheBlueMatt is this now ready for merge? |
Just tested on Ubuntu 18.04, with no issues related to this PR. There is an unrelated issue with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good modulo the one restart question I had.
# Restart after upgrade | ||
override_dh_systemd_start: | ||
dh_systemd_start \ | ||
--restart-after-upgrade |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? I dont think anyone would be surprised by their bitcoind going down prior to upgrade instead of only being restarted, and this could break eg a lxc VM as you'll get a text file busy error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TheBlueMatt, good point.
--restart-after-upgrade
is default in dh_systemd_start
from compat level 10, so the reason is perhaps best described as emulating modern defaults. I agree that for bitcoind, there should not be any real issues with using the defaults.
I don't quite follow the problems you mention though. As far as I can tell, an upgrade should work perfectly, even when leaving the daemon running during the upgrade. Nothing runtime related is touched during the package upgrade, only the new bitcoind
and bitcoin-cli
binaries are put into place, making them ready for the late restart. Unless I'm missing something, this should be no different when running in a container?
If you feel there's a risk here, I'll happily remove this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh, if its default whatever, but linux generally refuses to replace binaries on disk if they are running inside of an LXC/docker container (though will happily do so during normal operation).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. I've never run into that problem, but haven't really come across a situation where such a setup would be needed. I tend to want to install apps like bitcoind
inside my containers, in which case this would not be an issue.
But if I wanted this kind of setup, I imagine I'd leave bitcoind
disabled on the host and only start the service inside the container, right?
If this is true, then the host level daemon would never be restarted on upgrade as the service is disabled, causing the restart to be skipped on upgrade. The container on the other hand would keep running the "old" in-memory binary, until it's restarted by some other means.
I could be missing something...
utACK 2a87b1b with or without restart-after-upgrade. |
How will this affect systems that don't have/use systemd? |
@luke-jr this affects only debian-based systems (including Ubuntu) with systemd. |
I believe @luke-jr's question was "what about older but still supported Debian-based systems that do not have systemd", which is a good one. WIll this not result in them failing to build the packages? |
Older debian systems that are missing the I'm running a test on Ubuntu 14.04 right now, to see what kind of issues we're running into on that platform. |
As it turns out, Ubuntu 14.04 LTS actually does have a Since the distro does not actually use systemd, the included FWIW, Debian 7 also has a |
I'm less concerned with merely old distros, as much as ones that have simply rejected the mandatory-systemd nonsense, such as Devuan. |
@luke-jr to build the package, you'd need to have |
Did that last comment answer your questions? |
I'm going to merge this as @TheBlueMatt utACKed this - he's the ppa maintainer. |
Err, no, Luke's point is good and would break several PPA-supported releases.
…On May 1, 2018 2:52:47 PM UTC, "Wladimir J. van der Laan" ***@***.***> wrote:
I'm going to merge this as @TheBlueMatt utACKed this - he's the ppa
maintainer.
I don't think other distributions are relevant here as this concerns
explicitly the `debian` directory.
Other improvements can be made later.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#12769 (comment)
|
2a87b1b Add systemd service for bitcoind (ctp-tsteenholdt) 9085532 Sync contrib/debian from Matt Corallo's PPA (ctp-tsteenholdt) Pull request description: On suggestion from @TheBlueMatt I have updated `contrib/debian` files to include a systemd service in the `bitcoind` build. Tested and working on Ubuntu 16.04 and 17.10. This fixes Issue #12758 Tree-SHA512: b6137fafee940c7410df1242c8716a87f47c5bc60eb8df3ad0184a50c2d67ef3f2728761c742670a0ad546ab6e7ad60472a721350cd6280b3bcbdc582e50ee07
Oh, hmm, I appears to be wrong, it looks like the dh-systemd package is on trusty, I suppose its fine, then. |
After discussion with Matt on IRC, this is not ready for prime time until 2019 and shouldn't have been ACKed and merged. - Revert "Add systemd service for bitcoind" This reverts commit 2a87b1b. - Revert "Sync contrib/debian from Matt Corallo's PPA" This reverts commit 9085532. Tree-SHA512: 439f4ccc3e196011af448b220adf26b0e653ac589bf4cfbbc276c1500c9d08f209c9d6101e4d232857779d9f25164cfb222ed30e3d63de116f9121e6ebde31c3
Had to revert this, please file again in 2019 (or whenever relevant). |
@laanwj, as @TheBlueMatt mentions in his followup, |
After discussion on IRC we're switching to a different strategy, distribution packaging files will be under this repository from now on: |
Okay... Does this mean I should rework the changes to go in the new path then? |
Indeed, just cherry-pick the commits and submit them to the other repo. |
Thanks. I've created bitcoin-core/packaging#1 with exact same changes... |
After discussion with Matt on IRC, this is not ready for prime time until 2019 and shouldn't have been ACKed and merged. - Revert "Add systemd service for bitcoind" This reverts commit 2a87b1b. - Revert "Sync contrib/debian from Matt Corallo's PPA" This reverts commit 9085532. Tree-SHA512: 439f4ccc3e196011af448b220adf26b0e653ac589bf4cfbbc276c1500c9d08f209c9d6101e4d232857779d9f25164cfb222ed30e3d63de116f9121e6ebde31c3
On suggestion from @TheBlueMatt I have updated
contrib/debian
files to include a systemd service in thebitcoind
build. Tested and working on Ubuntu 16.04 and 17.10.This fixes Issue #12758