Flows.json access locked

Hi!

I'm trying to set up Node-RED with Kubernetes + Helm charts (Ubuntu 22). I have flows.json file in data folder on the pod and on Persistent Volume to secure data after a reboot:

 volumeMounts:
     - name: node-red-flows
       mountPath: "/data/flows.json"
       subPath: node-red/flows.json

  volumes:
    - name: node-red-flows
      persistentVolumeClaim:
        claimName: {{ .Values.persistentVolumeClaim }}

But when I do this it prevents me from using Node-RED from web. If I try to change flows there – an error pops up:

Deploy failed: {"code":"EBUSY","message":"EBUSY: resource busy or locked, rename '/data/flows.json.$$$' -> '/data/flows.json'"}

I tried to modify access to this file (chmode/chown or with securityContext in chart) but it didn't help. Any suggestions?

Presumably because Node-RED is running when you are trying to rename the file?

I'm not trying to rename it. Node-RED is just duplicating flow file (with $$$ in it's name) and asks me to rename it (according to the error)

Can you check what has locked the file? Is it Node-RED or something else? You probably need to check both the temp file and the actual as it isn't clear which is locked.

I checked with lsof and fuser and it seems like nothing is blocking them. And also both of this files can be changed with text editors (nano for example).

Hmm, must be a timing thing then. Sorry, not sure what else to suggest. I don't use Docker or Kubernetes for Node-RED I'm afraid.

Thanks anyway

Surely something is actually attempting to rename flows.json.$$$ to flows.json? And flows.json is in use.

I don't suppose it is related to this issue but having $ or other "special" characters in a filename is probably inviting trouble.

Do you mean that it does allow you to use node-red from the web, but when you Deploy you see the error? If so them my guess is that node-red first writes the new file with the $$$ extension and will then rename it. The error suggests it has written the new one but then is unable to rename it.

What is the ownership and permissions on the flows file, and other files in the folder?

Yes. It seems like that is exactly what is happening.

Other files was owned by node-red user and flows.json was owned by root. I changed ownership to node-red user but it didn't help.

Do you mean the ownership is changed back to root again?

Sorry. No. The owner is node-red but the error is still there when I'm trying to Deploy.

and what are the permissions on the file ?

I set permissions to 777 (read/write for all) but it didn't help. Initially it was 644 (read/write for owner, only read for everyone else).

Can you show us an ls -al on the whole directory please?

I think the whole directory ( . ) should be fully owned by node-red. Currently it is owned by the root group.

Why have virtually all the files got the same time stamp? Even package.json and settings.js.

It didn't help

image

image

Why have the timestamps on most of the files changed?