BlackHatCoiner (OP)
Legendary
Offline
Activity: 1568
Merit: 7648
Protocols over bureaucrats
|
I'm running an Ubuntu Server (20.04) from my RPi 4 in which I have connected my external 1TB SSD drive and I connect remotely. I want to reindex the blockchain, so I enter: ./bitcoind --datadir=/media/external/bitcoin --reindex It returns me: Error: Failed saving settings file: - Error: Unable to open settings file /media/external/bitcoin/settings.json.tmp for writing I've given all the permissions to that directory, or I at least, tried to. I used sudo chmod -R 777 /media/external/bitcoin, but I still can't create files by my own (without sudo touch). Probably Bitcoin Core tries to create files and can't due to permissions. What do I have to give it all the permissions it requires?
|
. .BLACKJACK ♠ FUN. | | | ███▄██████ ██████████████▀ ████████████ █████████████████ ████████████████▄▄ ░█████████████▀░▀▀ ██████████████████ ░██████████████ █████████████████▄ ░██████████████▀ ████████████ ███████████████░██ ██████████ | | CRYPTO CASINO & SPORTS BETTING | | │ | | │ | ▄▄███████▄▄ ▄███████████████▄ ███████████████████ █████████████████████ ███████████████████████ █████████████████████████ █████████████████████████ █████████████████████████ ███████████████████████ █████████████████████ ███████████████████ ▀███████████████▀ ███████████████████ | | .
|
|
|
|
LoyceV
Legendary
Offline
Activity: 3360
Merit: 16927
Thick-Skinned Gang Leader and Golden Feather 2021
|
|
August 28, 2021, 12:25:32 PM |
|
I've given all the permissions to that directory, or I at least, tried to. I used sudo chmod -R 777 /media/external/bitcoin, but I still can't create files by my own (without sudo touch). Could the permissions problem be on /media/external or even /media? On second thought, it's unlikely that's the problem considering you can view the directory.
|
|
|
|
BlackHatCoiner (OP)
Legendary
Offline
Activity: 1568
Merit: 7648
Protocols over bureaucrats
|
|
August 28, 2021, 12:53:42 PM |
|
Could the permissions problem be on /media/external or even /media? Probably something's wrong with the drive or with the OS that I don't know. When I run the mentioned command, it returns successfully so I guess it runs it successfully. Googling it didn't seem a great idea; there aren't lots of issues for the Ubuntu server. At least not more than the Ubuntu desktop. On second thought, it's unlikely that's the problem considering you can view the directory. I can view the directory, but as read-only. I can write on that directory and create files too with sudo. What I can't do is giving it the permissions to do it automatically.
|
. .BLACKJACK ♠ FUN. | | | ███▄██████ ██████████████▀ ████████████ █████████████████ ████████████████▄▄ ░█████████████▀░▀▀ ██████████████████ ░██████████████ █████████████████▄ ░██████████████▀ ████████████ ███████████████░██ ██████████ | | CRYPTO CASINO & SPORTS BETTING | | │ | | │ | ▄▄███████▄▄ ▄███████████████▄ ███████████████████ █████████████████████ ███████████████████████ █████████████████████████ █████████████████████████ █████████████████████████ ███████████████████████ █████████████████████ ███████████████████ ▀███████████████▀ ███████████████████ | | .
|
|
|
|
LoyceV
Legendary
Offline
Activity: 3360
Merit: 16927
Thick-Skinned Gang Leader and Golden Feather 2021
|
|
August 28, 2021, 12:56:30 PM |
|
I can view the directory, but as read-only. I can write on that directory and create files too with sudo. What I can't do is giving it the permissions to do it automatically. What permissions does it show on console (as a user)? Say: ls -al /media/external/bitcoin What filesystem are you using on the external drive? (I'm just guessing a bit here)
|
|
|
|
BlackHatCoiner (OP)
Legendary
Offline
Activity: 1568
Merit: 7648
Protocols over bureaucrats
|
|
August 28, 2021, 01:04:56 PM |
|
What permissions does it show on console (as a user)? Say: ls -al /media/external/bitcoin ubuntu@ubuntu:/media/external/bitcoin$ ls -al /media/external/bitcoin total 16640 drwxr-xr-x 4 root root 262144 Aug 28 11:02 . drwxr-xr-x 5 root root 262144 Aug 24 20:14 .. -rwxr-xr-x 1 root root 0 Aug 24 20:16 .lock -rwxr-xr-x 1 root root 105 Aug 28 09:57 anchors.dat -rwxr-xr-x 1 root root 37 Oct 24 2021 banlist.dat -rwxr-xr-x 1 root root 10 Aug 28 11:02 bitcoin.conf drwxr-xr-x 3 root root 262144 Aug 28 09:45 blocks drwxr-xr-x 2 root root 262144 Aug 28 09:57 chainstate -rwxr-xr-x 1 root root 11795920 Aug 28 09:57 debug.log -rwxr-xr-x 1 root root 247985 Aug 28 09:57 fee_estimates.dat -rwxr-xr-x 1 root root 18 Aug 28 09:57 mempool.dat -rwxr-xr-x 1 root root 2608672 Aug 28 09:56 peers.dat -rwxr-xr-x 1 root root 7 Sep 27 2021 settings.json What filesystem are you using on the external drive? I'm not cutting my head off, but I think it's ext2.
|
. .BLACKJACK ♠ FUN. | | | ███▄██████ ██████████████▀ ████████████ █████████████████ ████████████████▄▄ ░█████████████▀░▀▀ ██████████████████ ░██████████████ █████████████████▄ ░██████████████▀ ████████████ ███████████████░██ ██████████ | | CRYPTO CASINO & SPORTS BETTING | | │ | | │ | ▄▄███████▄▄ ▄███████████████▄ ███████████████████ █████████████████████ ███████████████████████ █████████████████████████ █████████████████████████ █████████████████████████ ███████████████████████ █████████████████████ ███████████████████ ▀███████████████▀ ███████████████████ | | .
|
|
|
|
LoyceV
Legendary
Offline
Activity: 3360
Merit: 16927
Thick-Skinned Gang Leader and Golden Feather 2021
|
|
August 28, 2021, 01:12:02 PM |
|
I used sudo chmod -R 777 /media/external/bitcoin ubuntu@ubuntu:/media/external/bitcoin$ ls -al /media/external/bitcoin total 16640 drwxr-xr-x 4 root root 262144 Aug 28 11:02 . drwxr-xr-x 5 root root 262144 Aug 24 20:14 .. Your directory has 755 permission, not 777. So your user indeed has no write access. I'm not cutting my head off, but I think it's ext2. Try:
|
|
|
|
BlackHatCoiner (OP)
Legendary
Offline
Activity: 1568
Merit: 7648
Protocols over bureaucrats
|
|
August 28, 2021, 01:20:41 PM |
|
ubuntu@ubuntu:/media/external/bitcoin$ mount | grep media /dev/sda1 on /media/external type exfat (rw,relatime,fmask=0022,dmask=0022,iocharset=utf8,namecase=0,errors=remount-ro)
Sorry, apparently it's exfat. Your directory has 755 permission, not 777. So your user indeed has no write access. Yep, but I chmod it with 777. I'm really curious what's the issue here.
|
. .BLACKJACK ♠ FUN. | | | ███▄██████ ██████████████▀ ████████████ █████████████████ ████████████████▄▄ ░█████████████▀░▀▀ ██████████████████ ░██████████████ █████████████████▄ ░██████████████▀ ████████████ ███████████████░██ ██████████ | | CRYPTO CASINO & SPORTS BETTING | | │ | | │ | ▄▄███████▄▄ ▄███████████████▄ ███████████████████ █████████████████████ ███████████████████████ █████████████████████████ █████████████████████████ █████████████████████████ ███████████████████████ █████████████████████ ███████████████████ ▀███████████████▀ ███████████████████ | | .
|
|
|
|
LoyceV
Legendary
Offline
Activity: 3360
Merit: 16927
Thick-Skinned Gang Leader and Golden Feather 2021
|
|
August 28, 2021, 01:33:04 PM |
|
Sorry, apparently it's exfat. ~ Yep, but I chmod it with 777. I'm really curious what's the issue here. Exfat can't handle file permissions. I guess it's mounted by/as/for root now. If you don't use the drive elsewhere (on Windows systems), I'd format it with a default Linux filesystem. Ext2/3/4 will work. Alternatively, you can mount it for the user that needs to access it. It's been a while, but this sounds familiar: /dev/sdb1 /media/maria/Lexfat exfat defaults,uid=1000,gid=1000 0 0
|
|
|
|
BlackHatCoiner (OP)
Legendary
Offline
Activity: 1568
Merit: 7648
Protocols over bureaucrats
|
|
August 28, 2021, 02:41:02 PM |
|
If I mount it, will I essentially format it? I'm asking because I'm running a node and I don't want to lose my syncing so far or I need to know if I should back up the blocks in case something happens.
|
. .BLACKJACK ♠ FUN. | | | ███▄██████ ██████████████▀ ████████████ █████████████████ ████████████████▄▄ ░█████████████▀░▀▀ ██████████████████ ░██████████████ █████████████████▄ ░██████████████▀ ████████████ ███████████████░██ ██████████ | | CRYPTO CASINO & SPORTS BETTING | | │ | | │ | ▄▄███████▄▄ ▄███████████████▄ ███████████████████ █████████████████████ ███████████████████████ █████████████████████████ █████████████████████████ █████████████████████████ ███████████████████████ █████████████████████ ███████████████████ ▀███████████████▀ ███████████████████ | | .
|
|
|
|
LoyceV
Legendary
Offline
Activity: 3360
Merit: 16927
Thick-Skinned Gang Leader and Golden Feather 2021
|
|
August 28, 2021, 02:48:28 PM |
|
If I mount it, will I essentially format it? No: mount -t type device dir
This tells the kernel to attach the filesystem found on device (which is of type type) at the directory dir. But if you didn't know this, you may need to read up a bit on Linux CLI basics. It'll come in handy Just in case: changing the file system will wipe the disk.
|
|
|
|
n0nce
|
If I mount it, will I essentially format it? I'm asking because I'm running a node and I don't want to lose my syncing so far or I need to know if I should back up the blocks in case something happens.
I would personally recommend to backup the blocks directory to another drive, wipe the drive, format it as ext4 and put back the blocks. Then do a reindex. Also, I wouldn't recommend to (allow all kinds of access to all users), instead simply change the ownership of the folder to only the user that runs bitcoin core: sudo chown -R username /media/external/bitcoin
|
|
|
|
nc50lc
Legendary
Offline
Activity: 2464
Merit: 5738
Self-proclaimed Genius
|
|
August 30, 2021, 03:21:50 AM Merited by ABCbits (2), HCP (2) |
|
I tried to reproduce it by setting the whole datadir as read-only but I've got a different error: Error initializing settings: Error: Failed saving settings file: - Failed renaming settings file <DataDir>\settings.json.tmp to <DataDir>\settings.json When I set an existing setting.json.tmp file as read-only ( appeared when the drive/settings.json was read-only), I got the same error: Error initializing settings: Error: Failed saving settings file: - Error: Unable to open settings file <DataDir>/settings.json.tmp for writing Both doesn't register to the debug.log since Bitcoin Core wont even launch. I'm thinking it may not be a permission issue of the whole drive, but it lacks info so I'll just leave this to others.
|
|
|
|
LoyceV
Legendary
Offline
Activity: 3360
Merit: 16927
Thick-Skinned Gang Leader and Golden Feather 2021
|
|
August 30, 2021, 09:45:57 AM Last edit: August 30, 2021, 10:37:19 AM by LoyceV |
|
Bad is an understatement! Obviously, you can solve permission problems by running as root, but those permissions are paramount for basic system security.
|
|
|
|
nc50lc
Legendary
Offline
Activity: 2464
Merit: 5738
Self-proclaimed Genius
|
|
August 30, 2021, 11:15:18 AM |
|
Can you give more detailed info?
Actually, I missed the part where he said that he can't create files on his own to that drive, so... I think it's a different issue.
|
|
|
|
|