Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: defa1 on June 29, 2021, 02:28:26 PM



Title: bitcoind unable to read settings.json on external ssd
Post by: defa1 on June 29, 2021, 02:28:26 PM
I installed ubuntu server on my pi and attached and mounted an external ssd which already contains a bitcoin datadirectory. When I run:

bitcoind -datadir=/media/external/bitcoin-datadir -conf=/media/external/bitcoin-datadir/bitcoin.conf

I get as a result:

Error: Failed saving settings file:
- Error: Unable to open settings file /media/external/bitcoin-datadir/settings.json.tmp for writing

I'd be grateful is anyone can assist with this.

edit: I was using the SSD before with bitcoin-qt if that makes any difference


Title: Re: bitcoind unable to read settings.json on external ssd
Post by: ranochigo on June 29, 2021, 03:25:50 PM
Did you give the file write permissions?

chmod 644 settings.json? That gives you the permission to read and write to file.


Title: Re: bitcoind unable to read settings.json on external ssd
Post by: NotATether on June 29, 2021, 05:25:07 PM
It could be that only root can write to disk, not the admins (the adm group). You should navigate to /run/media/<the uuid of the partition> and execute chgrp adm followed by chmod g+w. You can find the UUID of your partition with fdisk -l and blkid commands.


Title: Re: bitcoind unable to read settings.json on external ssd
Post by: defa1 on June 29, 2021, 10:48:59 PM
I can create .txt files on the ssd using sudo touch so I can write to disk. If I run blkid I get the following:

/dev/mmcblk0p1: LABEL_FATBOOT="system-boot" LABEL="system-boot" UUID="4D3B-86C0" TYPE="vfat" PARTUUID="4ec8ea53-01"
/dev/mmcblk0p2: LABEL="writable" UUID="79af43d1-801b-4c28-81d5-724c930bcc83" TYPE="ext4" PARTUUID="4ec8ea53-02"
/dev/sda: LABEL_FATBOOT="bitcoin" LABEL="bitcoin" UUID="E440-25BD" TYPE="vfat"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/loop4: TYPE="squashfs"
/dev/loop5: TYPE="squashfs"

with /dev/sda being the ssd. "cd /run/media/E440-25BD" gets me "-bash: cd: /run/media/E440-25BD: No such file or directory"

fdisk -l doesn't give me the UUID for the ssd either, only:

Disk /dev/sda: 931.53 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: Tech           
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

and more information about other partitions


Title: Re: bitcoind unable to read settings.json on external ssd
Post by: BitMaxz on June 29, 2021, 11:34:56 PM
Can you follow the guide from this link below on how to configure the external drive for your raspi

- https://howchoo.com/bitcoin/run-bitcoin-full-node-raspberry-pi#configure-the-external-hard-drive

It needs to configure the external drive first before you are able to use and write data to your external drive. I don't know if there is a difference between using HDD and SSD.


Title: Re: bitcoind unable to read settings.json on external ssd
Post by: defa1 on June 29, 2021, 11:37:04 PM
Thanks, but I've been looking at that guide all night already. Problem seems to be that I cannot change permissions or owners of the files on the drive.
I'm thinking about formatting the drive and just downloading the blockchain again.


Title: Re: bitcoind unable to read settings.json on external ssd
Post by: HCP on June 30, 2021, 12:29:25 AM
I can create .txt files on the ssd using sudo touch so I can write to disk.
No... you're using sudo... so the root account can write to the disk. I suspect that you're not running bitcoind as root (and you shouldn't be!) which is why it errors out saying that it can't write the temp file.


Problem seems to be that I cannot change permissions or owners of the files on the drive.
It would appear that it is indeed most likely a permissions issue... but I'm surprised that a sudo chown and sudo chgrp won't let you modify the permissions tho? ???


Title: Re: bitcoind unable to read settings.json on external ssd
Post by: NotATether on June 30, 2021, 07:18:04 AM
It would appear that it is indeed most likely a permissions issue... but I'm surprised that a sudo chown and sudo chgrp won't let you modify the permissions tho? ???

Apparently, sudo actions are done with the sudo group, not the adm group: https://superuser.com/questions/86347/whats-difference-between-group-admin-and-adm

I can create .txt files on the ssd using sudo touch so I can write to disk. If I run blkid I get the following:

~

with /dev/sda being the ssd. "cd /run/media/E440-25BD" gets me "-bash: cd: /run/media/E440-25BD: No such file or directory"

Try checking /etc/fstab if the UUID is in there, if the disk is mounted on boot then it should surely be there.


Title: Re: bitcoind unable to read settings.json on external ssd
Post by: defa1 on June 30, 2021, 03:11:36 PM
Thanks for the help everyone. I'm going to connect this drive to my linux laptop and format it using the nice and easy gui. I'll have to redownload the blockchain but that's not a big deal.


Title: Re: bitcoind unable to read settings.json on external ssd
Post by: defa1 on July 01, 2021, 10:32:19 PM
Not sure I got a drive with 400 GB of space lying around but that would indeed be a good idea.


Title: Re: bitcoind unable to read settings.json on external ssd
Post by: defa1 on July 02, 2021, 05:41:46 PM
I formatted the drive to ext4 and it still wouldn't work, but now I was able to chown /mnt/bitcoin so I finally started IBD!!


Title: Re: bitcoind unable to read settings.json on external ssd
Post by: HCP on July 02, 2021, 11:28:29 PM
I formatted the drive to ext4 and it still wouldn't work, but now I was able to chown /mnt/bitcoin so I finally started IBD!!
That is a very strange outcome... when you "formatted" it, did you completely remove all the partitions and start from scratch, or did you just format the existing partition? ???

I'm guessing that the old vfat system just wasn't handling the file permissions properly... glad you at least managed to get the IBD underway! ;)


Title: Re: bitcoind unable to read settings.json on external ssd
Post by: defa1 on July 03, 2021, 09:00:09 AM
I deleted everything on the drive and formatted in ext4.


Title: Re: bitcoind unable to read settings.json on external ssd
Post by: Cricktor on July 03, 2021, 12:06:09 PM
Initially your drive was formatted as VFAT which I wouldn't consider the best option to use with a Raspi. Though I assume you could've saved the setup by giving an appropriate owner and group option in fstab, so that after mounting bitcoind would be happy and would've write access to it.

Anyway, reformatting to ext4 or any better supported filesystem for Linux where you can properly set permissions and ownership is the better option.


Title: Re: bitcoind unable to read settings.json on external ssd
Post by: HCP on July 03, 2021, 10:31:52 PM
Yeah, I assume the VFAT option was originally chosen for compatibility with Windows? ???

In any case, one of the more linux-centric filesystems is definitely the better option going forward (assuming you don't need the ability to read the drive on a Windows system)


Title: Re: bitcoind unable to read settings.json on external ssd
Post by: defa1 on July 04, 2021, 06:03:11 PM
Yeah, I assume the VFAT option was originally chosen for compatibility with Windows? ???

No I only used the drive with Raspberry Pi OS before. Just plugged it in and it worked although maybe they formatted it for Windows by default during production.


Title: Re: bitcoind unable to read settings.json on external ssd
Post by: HCP on July 05, 2021, 08:37:19 PM
Ahhhh ok. Yeah, most external drives tend to be formatted for use with Windows by default. There are some exceptions where I have seen drives that are marketed as "OSX external drives" etc.

I actually purchased a fairly typical 1TB External HDD yesterday. Works fine with Windows, but when I connected it to the Pi it was completely unreadable unless I formatted the thing ::)

Yay for "standards" ::)