I’ve copied /root/.n8n to / directory then system crashed

I’ve copied /root/.n8n to / directory, since this, I cannot login! it seems that I’ve done something wrong!

used command to copy was:

cd / && cp -r /root/.n8n/ ./

Now it gives me in main screen “Set up owner account“ form.

looks like, database is gone!

n8n Information

  • n8n version: 1.107.4
  • Database: sqlite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via: npm
  • Operating system: debian

Since you just copied, in the worst case data is corrupted.

Check for their presence :

ls -l /root/.n8n

ls -l /.n8n

And be sure which user starts the n8n , in which folder.

You can even explicitly start n8n with the new path or even set it as env variable:

export N8N_USER_FOLDER=/.n8n

Cheers!

Thanks for your replay, what if I was having this in config!

Environment="N8N_DATA_FOLDER=/n8n/data"

any chance to get my workflows back?

Your real database.sqlite and config (with the correct encryption key) should be under /root/.n8n or /.n8n

Since that variable set the folder for n8n instance when starts… :

Start n8n, check logs for “User settings loaded from: …”.

Etc…

ls -l /root/.n8n

ls -l /.n8n

backup from old /,n8n:

I don’t have this folder /n8n/data and I didn’t delete it, however it was configured in env as mentioned!

OMG: Result was: n8n[815574]: User settings loaded from: /.n8n/config

From where did you got :

Just seen it better… maybe is N8N_USER_FOLDER variable.

And since your command was “cd” tehnic copying, it means that you have a copy in your home folder.

By design, n8n stores the SQLite DB and encryption key in a .n8n subfolder of the user who starts n8n, unless you override it with N8N_USER_FOLDER

Your service log confirms: current user folder = /.n8n, not /root/.n8n

Adițional check for old copy :

sudo ls -la /.n8n

Cheers!

Thanks for your great help, I think I’m going to rewrite all workflows from scratch, thanks again.

1 Like