Title: Unable to open settings file /media/external/bitcoin/settings.json.tmp Post by: BlackHatCoiner on August 28, 2021, 11:46:46 AM 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:
Code: ./bitcoind --datadir=/media/external/bitcoin --reindex It returns me: Code: Error: Failed saving settings file: 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? Title: Re: Unable to open settings file /media/external/bitcoin/settings.json.tmp Post by: LoyceV on 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. Title: Re: Unable to open settings file /media/external/bitcoin/settings.json.tmp Post by: BlackHatCoiner on 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.Title: Re: Unable to open settings file /media/external/bitcoin/settings.json.tmp Post by: LoyceV on 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: Code: ls -al /media/external/bitcoin What filesystem are you using on the external drive? (I'm just guessing a bit here) Title: Re: Unable to open settings file /media/external/bitcoin/settings.json.tmp Post by: BlackHatCoiner on August 28, 2021, 01:04:56 PM What permissions does it show on console (as a user)? Say: Code: ls -al /media/external/bitcoin Code: ubuntu@ubuntu:/media/external/bitcoin$ ls -al /media/external/bitcoin What filesystem are you using on the external drive? I'm not cutting my head off, but I think it's ext2.Title: Re: Unable to open settings file /media/external/bitcoin/settings.json.tmp Post by: LoyceV on August 28, 2021, 01:12:02 PM I used sudo chmod -R 777 /media/external/bitcoin Code: ubuntu@ubuntu:/media/external/bitcoin$ ls -al /media/external/bitcoin I'm not cutting my head off, but I think it's ext2. Try:Code: mount | grep media Title: Re: Unable to open settings file /media/external/bitcoin/settings.json.tmp Post by: BlackHatCoiner on August 28, 2021, 01:20:41 PM Try: Code: mount | grep media Code: ubuntu@ubuntu:/media/external/bitcoin$ mount | grep media 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.Title: Re: Unable to open settings file /media/external/bitcoin/settings.json.tmp Post by: LoyceV on August 28, 2021, 01:33:04 PM Sorry, apparently it's exfat. Exfat can't handle file permissions. I guess it's mounted by/as/for root now.~ Yep, but I chmod it with 777. I'm really curious what's the issue here. 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 (https://askubuntu.com/questions/923691/ownership-permission-problem-with-automounting-exfat-drive) sounds familiar: Quote Code: /dev/sdb1 /media/maria/Lexfat exfat defaults,uid=1000,gid=1000 0 0 Title: Re: Unable to open settings file /media/external/bitcoin/settings.json.tmp Post by: BlackHatCoiner on 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.
Title: Re: Unable to open settings file /media/external/bitcoin/settings.json.tmp Post by: LoyceV on August 28, 2021, 02:48:28 PM If I mount it, will I essentially format it? No:Quote from: Linux manual page mount -t type device 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 :)This tells the kernel to attach the filesystem found on device (which is of type type) at the directory dir. Just in case: changing the file system will wipe the disk. Title: Re: Unable to open settings file /media/external/bitcoin/settings.json.tmp Post by: n0nce on August 28, 2021, 08:25:20 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. 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 Code: chmod 777 Code: sudo chown -R username /media/external/bitcoin Title: Re: Unable to open settings file /media/external/bitcoin/settings.json.tmp Post by: nc50lc on August 30, 2021, 03:21:50 AM I tried to reproduce it by setting the whole datadir as read-only but I've got a different error:
Code: Error initializing settings: Error: Failed saving settings file: 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: Code: Error initializing settings: Error: Failed saving settings file: 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. Title: Re: Unable to open settings file /media/external/bitcoin/settings.json.tmp Post by: LoyceV on August 30, 2021, 09:45:57 AM This is bad solution, but looking at https://bitcoin.stackexchange.com/q/107115 (https://bitcoin.stackexchange.com/q/107115), a user managed to solve the problem by running Bitcoin Core as root. Bad is an understatement! Obviously, you can solve permission problems by running as root, but those permissions are paramount for basic system security.Title: Re: Unable to open settings file /media/external/bitcoin/settings.json.tmp Post by: nc50lc on 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. |