I'm running Bitcoin Core 0.20.1 on a Raspberry Pi 4 (running Raspberry Pi OS standard).
It's just a standard install of Bitcoin Core, I built from source and installed into /home/pi/.bitcoin (looking back, I should have created the 'bitcoin' user first).
I created a new user 'bitcoin' and mounted an external HDD (under /mnt/bitcoin), now when running bitcoind I specify this location as the datadir. I had initially added this location in the bitcoin.conf file but was getting errors and someone mentioned not to add the datadir in the conf file.
Bitcoind runs just fine and uses the correct datadir when using the following command (whilst logged in a bitcoin user)
bitcoind -daemon -datadir=/mnt/bitcoin
The issue is when I try to access a bitcoin-cli command. I'm currently getting the following error when running
************************ EXCEPTION: N5boost10filesystem16filesystem_errorE
boost::filesystem::create_directory: File exists: "/home/bitcoin/.bitcoin" bitcoin in AppInitRPC()
It can definitely access bitcoin-cli, as when I run the command without any parameters, it returns the help screen.
Can someone point me in the right direction to fixing this please?