EACCES: permission denied error while trying to restore

Hey,

I’m trying to restore my n8n setup after a server issue.

But i get following errors:

User settings loaded from: /home/node/.n8n/config

Last session crashed

Error: Worker exiting due to an error.

Error: EACCES: permission denied, open ‘/home/node/.n8n/crash.journal’

I use docker-compose file on raspberry pi 4 64bit OS, data are on docker volumes.

version: '3.7'

volumes:
  db_storage:
  n8n_storage:
  redis_storage:

x-shared: &shared
  restart: always
  image: docker.n8n.io/n8nio/n8n
  environment:
    - DB_TYPE=postgresdb
    - DB_POSTGRESDB_HOST=postgres
    - DB_POSTGRESDB_PORT=5432
    - DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
    - DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER}
    - DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}
    - GENERIC_TIMEZONE=Europe/Paris
    - EXECUTIONS_DATA_PRUNE=true
    - EXECUTIONS_DATA_MAX_AGE=168
    - EXECUTIONS_DATA_PRUNE_MAX_COUNT=50000
    - EXECUTIONS_MODE=queue
    - QUEUE_BULL_REDIS_HOST=redis
    - QUEUE_HEALTH_CHECK_ACTIVE=true
    - N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
    - N8N_SECURE_COOKIE=false
  links:
    - postgres
    - redis
  volumes:
    - n8n_storage:/home/node/.n8n
  depends_on:
    - redis
    - postgres

services:
  postgres:
    image: postgres:14
    restart: always
    ports:
      - 5432:5432
    environment:
      - POSTGRES_USER
      - POSTGRES_PASSWORD
      - POSTGRES_DB
      - POSTGRES_NON_ROOT_USER
      - POSTGRES_NON_ROOT_PASSWORD
    volumes:
      - db_storage:/var/lib/postgresql/data
      - ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}']
      interval: 5s
      timeout: 5s
      retries: 10

  redis:
    image: redis:6-alpine
    restart: always
    volumes:
      - redis_storage:/data
    healthcheck:
      test: ['CMD', 'redis-cli', 'ping']
      interval: 5s
      timeout: 5s
      retries: 10

  n8n:
    <<: *shared
    ports:
      - 5678:5678

  n8n-worker:
    <<: *shared
    command: worker
    depends_on:
      - n8n

I did restore the 3 volumes and my docker n8n folder. Any idea of what could be wrong ?

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
  • n8n version: latest
  • Database (default: SQLite): PostgreSQL 14
  • n8n EXECUTIONS_PROCESS setting (default: own, main): queue
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: Raspbian 64 bits Latest

n8n GPT Answer:

It looks like you are encountering a permission issue when n8n tries to access the .n8n directory or files within it. This problem often occurs due to the Docker container not having the necessary permissions to access the mounted volumes. Here’s how you can address this issue step by step:

1. Adjust File Ownership and Permissions

The error message indicates that the Docker container’s user (node in this case) does not have the necessary permissions to open the specified file in the directory. We can resolve this by ensuring the user inside the Docker container has the correct permissions to access the volumes.

Docker Container User Permission

The Docker image for n8n (docker.n8n.io/n8nio/n8n) runs as a non-root user node. You need to make sure that the directory on the host that is mounted into the container has the correct permissions set.

You can set the permissions on your Raspberry Pi host with the following commands:

sudo chown -R 1000:1000 /path/to/your/n8n/volumes
sudo chmod -R 755 /path/to/your/n8n/volumes

Note: Replace /path/to/your/n8n/volumes with the actual path to where the n8n_storage, db_storage, and redis_storage volumes are stored on your host machine.

2. Ensure Environment Variables Are Correct

It’s important to confirm that the environment variables, particularly those related to the database and other services, are set correctly in your docker-compose.yml file or in an .env file that Docker Compose uses.

3. Restart the Containers

After making these changes, restart your Docker containers to ensure all services are using the updated configurations and permissions:

docker-compose down
docker-compose up -d

4. Check Logs for Additional Insights

If the problem persists after these adjustments, check the Docker container logs for more detailed error messages which can provide further insights:

docker logs <container_name_or_id>

Replace <container_name_or_id> with the name or ID of the n8n container.

5. Validate Docker Volume Mounts

Lastly, ensure that your Docker volumes are correctly mounted and accessible by using the following command to inspect the volumes:

docker volume inspect <volume_name>

This command will show you where the volume is mounted on the host, which can help in diagnosing path or permission issues.

By following these steps, you should be able to resolve the permission issues and successfully restore your n8n setup on your Raspberry Pi using Docker.

Source: ChatGPT

2 Likes

It solves my issue, thanks.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.