bitcoind can't start using debian systemctl after migration to different directory #22652

issue caglorithm opened this issue on August 6, 2021
  1. caglorithm commented at 4:35 PM on August 6, 2021: none

    Description

    Hi. I have earlier followed the Raspibolt guide to set up bitcoind. I have recently migrated my entire home folder, inclugin ./bitcoin/ from one disk to another (external) drive. I have then created a softlink from that new home folder on the external drive to /home/bitcoin. I have made sure that the folder on the external drive is owned by the user bitcoin and that the user has +rwx permissions on all files and directories inside using chmod -R.

    sudo chown -R bitcoin /mnt/ext/bitcoin/

    with /mnt/ext/bitcoin/ being my new home directory.

    When I start bitcoind using systemctl, I can't get it to run and I'm getting the following error constantly. When I login as the user bitcoin and start bitcoind in the command line, everything works fine.

    The problem

    When I read the logs using sudo journalctl -f -u bitcoind I get the following:

    Aug 06 16:46:05 brpi bitcoind[5459]: ************************
    Aug 06 16:46:05 brpi bitcoind[5459]: EXCEPTION: N5boost10filesystem16filesystem_errorE
    Aug 06 16:46:05 brpi bitcoind[5459]: boost::filesystem::status: Permission denied: "/home/bitcoin/.bitcoin"
    Aug 06 16:46:05 brpi bitcoind[5459]: bitcoin in AppInit()
    Aug 06 16:46:05 brpi systemd[1]: bitcoind.service: Control process exited, code=exited, status=1/FAILURE
    Aug 06 16:46:05 brpi systemd[1]: bitcoind.service: Failed with result 'exit-code'.
    Aug 06 16:46:05 brpi systemd[1]: Failed to start Bitcoin daemon.
    Aug 06 16:46:35 brpi systemd[1]: bitcoind.service: Service RestartSec=30s expired, scheduling restart.
    Aug 06 16:46:35 brpi systemd[1]: bitcoind.service: Scheduled restart job, restart counter is at 74.
    Aug 06 16:46:35 brpi systemd[1]: Stopped Bitcoin daemon.
    Aug 06 16:46:35 brpi systemd[1]: Starting Bitcoin daemon...
    Aug 06 16:46:35 brpi bitcoind[5469]: ************************
    

    My /etc/systemd/system/bitcoind.service file:

    [Unit]
    Description=Bitcoin daemon
    After=network.target
    
    [Service]
    
    # Service execution
    ###################
    ExecStart=/usr/local/bin/bitcoind -daemon \
                                      -pid=/run/bitcoind/bitcoind.pid \
                                      -conf=/home/bitcoin/.bitcoin/bitcoin.conf \
                                      -datadir=/home/bitcoin/.bitcoin
    # Process management
    ####################
    
    Type=forking
    PIDFile=/run/bitcoind/bitcoind.pid
    Restart=on-failure
    TimeoutSec=300
    RestartSec=30
    
    
    # Directory creation and permissions
    ####################################
    
    # Run as bitcoin:bitcoin
    User=bitcoin
    Group=bitcoin
    
    # /run/bitcoind
    RuntimeDirectory=bitcoind
    RuntimeDirectoryMode=0710
    
    # /etc/bitcoin
    ConfigurationDirectory=bitcoin
    ConfigurationDirectoryMode=0710
    
    # /var/lib/bitcoind
    StateDirectory=bitcoind
    StateDirectoryMode=0710
    
    # Hardening measures
    ####################
    
    # Provide a private /tmp and /var/tmp.
    PrivateTmp=true
    
    # Mount /usr, /boot/ and /etc read-only for the process.
    ProtectSystem=full
    
    # Deny access to /home, /root and /run/user
    ProtectHome=true
    
    # 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
    
    # Deny the creation of writable and executable memory mappings.
    MemoryDenyWriteExecute=true
    
    [Install]
    WantedBy=multi-user.target
    

    System information

    Raspberry Pi 4 B

    uname -a Linux brpi 5.10.52-v7l+ [#1440](/bitcoin-bitcoin/1440/) SMP Tue Jul 27 09:55:21 BST 2021 armv7l GNU/Linux

    bitcoind v0.21.1

    Distributor ID: Raspbian Description: Raspbian GNU/Linux 10 (buster) Release: 10 Codename: buster

    <!-- What version of Bitcoin Core are you using, where did you get it (website, self-compiled, etc)? -->

    <!-- What type of machine are you observing the error on (OS/CPU and disk type)? -->

    <!-- GUI-related issue? What is your operating system and its version? If Linux, what is your desktop environment and graphical shell? -->

    <!-- Any extra information that might be useful in the debugging process. -->

    <!--- This is normally the contents of a `debug.log` or `config.log` file. Raw text or a link to a pastebin type site are preferred. -->

  2. caglorithm added the label Bug on Aug 6, 2021
  3. Thoragh commented at 8:57 PM on August 7, 2021: contributor

    You have to remove ProtectHome=true.

  4. MarcoFalke closed this on Aug 23, 2021

  5. DrahtBot locked this on Aug 23, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 21:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me