Openai/691353e9-c8e4-8002-9ea3-93ea859a8d5c

Revision as of 05:28, 12 November 2025 by Lukegao (talk | contribs) (导入ChatGPT Share对话 691353e9...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


This conversation was exported from ChatGPT[1]

gpt-5 edit

User: edit

Assistant: That screenshot sums up a very common gotcha when running Immich’s CLI inside a TrueNAS-managed container. edit

That screenshot sums up a very common gotcha when running Immich’s CLI inside a TrueNAS-managed container. The key line is:

Error: EACCES: permission denied, mkdir './.config'

That’s not an Immich bug — it’s Node.js (which the Immich CLI is built with) trying to create a configuration directory in its current working directory, which inside a TrueNAS-scale container typically maps to /usr/src/app or /root. If that location isn’t writable by the user the CLI runs as, you get exactly this EACCES error.

Here’s how to fix or work around it.

1. Understand what’s happening edit

The Immich CLI stores its authentication tokens in ~/.config/immich by default. But when you execute it inside a TrueNAS App container (especially through the App Shell or Docker exec), you’re often not logged in as root or the environment variables for $HOME aren’t set. That means Node.js falls back to ./.config in the current directory, which is unwritable inside /usr/src/app.

So, it’s not the NAS mount at all — it’s a local write permission problem for that .config folder.

2. Quick fix edit

Run the command with a writable config path:

immich --config /tmp/immich-cli-config login

or, if you want it persistent:

mkdir -p /mnt/photos/immich-cli-config
chmod 777 /mnt/photos/immich-cli-config
immich --config /mnt/photos/immich-cli-config login

That tells Immich CLI to store its auth/session info somewhere you actually control.

3. Permanent solution for TrueNAS edit

If you’re running the CLI inside the TrueNAS Immich App shell:

  • Add a writable mount for CLI configs, for example: - Host path: /mnt/tank/immich/config - Container path: /config
  • Then run: ``bash immich --config /config/cli login
    This prevents it from ever touching /usr/src/app again.
    
    ===== 4. Sanity check =====
    
    You can verify where it’s trying to write by running:
    bash

echo $HOME pwd ls -ld .

If $HOME is unset or points to /, that’s the smoking gun. You can set it temporarily with:

bash

export HOME=/tmp

===== 5. Bonus: Running CLI from outside the container =====

You can also skip all this by running the Immich CLI on your host machine (or another Linux VM) and just point it at your Immich instance with:

bash

immich --server http://<immich_host>:2283

``

It doesn’t have to run inside the same container.

If you show me your current docker exec or TrueNAS App shell command (and whether you’re root or not inside it), I can tell you exactly what to mount or export so it works cleanly every time.

References edit

  1. "Immich CLI permission fix". ChatGPT. Retrieved 2025-11-12.