Node-red-contrib-persist on DietPi : EACCES: permission denied, open '/root/data/persistence.json'

Cannot open this file in node red and dietpi. On raspbian stretch everything is ok.
Please help.
Thanks.

What user is running node-red?
Does that user have permission to access the file specified?
what do you mean when you say

On raspbian stretch everything is ok.

Yes, on raspbian everything is ok, only on dietpi i have a problem.
Problem is coming with persist node from palette.
Clean install for all many times.

Sounds like an issue with a specific contrib node.

Ps. Did you install node-red as root by any chance?

Did you use the official install script to install node-red?

No understand?
I nstall node red from dietpi-software menu.

Only on dietpi i have a problem!

I would recommend you remove and use the official installer script.

I suspect the installation method you used has caused permissions issue.

Install instructions for pi

Disclaimer...
I have not used dietpi but as it is Debian based I believe the official pi install script will work.

I have installed the official version of Raspberian and node red many times, at least more than 100 times. I have 6 Rpi that work. I only have such a problem with dietpi.

Did you use the EXACT same procedure for installing on DietPI as you use on Raspian?

Even if the answer is yes, the OS'es are different - it might be related - or it might be a problem of the contrib node (which you still havent linked to or provided the node-red-contrib-xxxxx name)

I am aware the official script setups up node-red without messing up permissions - so thats why my suggestion was to use the official script (some people install with root when they should not)

If you dont wanna try it - fair enough - go search the net or debug the node causing your issue & report it on the github issues page.

I write image of dietpi with balena etcher on sd card. then i install dietpi without problems.
Also i install node red with software ui on dietpi under number 122.
Only i have a problem with persist store!

I have no idea what that means.

If you wont try the official debian based installer written specifically for installing node-red then I cant help on that part sorry.

unless...

What is persist store? Are you modifying the settings.js to make context persistent?

The title clearly states permission denied!

Yes it does but we have no access to your system to check out the issue - we have to drag information out of you.

Do you really think posting "Cannot open this file in node red and dietpi. On raspbian stretch everything is ok" is enough for people to help?

for example...

  • It could be the account that runs node-red
  • it could be the way you installed it

NOTE:
node-red DOESNT NOT ACCESS anything in /root/data/persistence.json. Some combination of how node-red is installed (possibly) and / or a CONTRIB node and / or something YOU set in settings.js is the reason

1 Like

What access?
No problem, say it and you have it.

So finally, we get the required information!

It looks to me like the installation on DietPi was done by root - thats why entering a filename only ( persistence.json) is trying to be written to /root/data

I STRONGLY suspect the installation is not correct!

I suspect on your raspian installs, the persistence.json is NOT written to /root/data but instead it will be found in the pi/data folder

As a test, put a full file path e.g. /tmp/persistence.json - it might work but I suspect you will have other issues in the future due to the installation method.

You can take my word for it or keep looking elsewhere.

incoming new message pi/data/persistence.json: ENOENT: no such file or directory, open 'pi/data/persistence.json'

data/persistence.json: ENOENT: no such file or directory, open 'data/persistence.json'

root/data/persistence.json: EACCES: permission denied, open 'root/data/persistence.json'

Try a known existing ABSOLUTE path first - e.g. /tmp

when you dont use the / it tries to write to a relative path - in your case /root/data

so when you try data/persistence.json it tries to write to /root/data/data/persistence.json - and that path doesnt exist!

try /tmp/persistence.json as i said before