Immich: Server CLI does not work #1608

Closed
opened 2025-11-20 05:13:15 -05:00 by saavagebueno · 2 comments
Owner

Originally created by @dom6770 on GitHub (Jul 31, 2025).

Originally assigned to: @vhsdream on GitHub.

Have you read and understood the above guidelines?

yes

📜 What is the name of the script you are using?

Immich

📂 What was the exact command used to execute the script?

bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/immich.sh)"

⚙️ What settings are you using?

  • Default Settings
  • Advanced Settings

🖥️ Which Linux distribution are you using?

Debian 12

📝 Provide a clear and concise description of the issue.

Immich provides a server CLI: https://immich.app/docs/administration/server-commands/

This doesn't work out of the box:

> immich-admin
zsh: command not found: immich-admin

Adding the correct directory to PATH solves this:

> PATH="/opt/immich/app/bin:$PATH"
> immich-admin
Initializing Immich
Detected CPU Cores: 4
node:fs:441
    return binding.readFileUtf8(path, stringToFlags(options.flag));
                   ^

Error: ENOENT: no such file or directory, open './package.json'
    at readFileSync (node:fs:441:20)
    at Object.<anonymous> (/opt/immich/app/dist/constants.js:37:59)
    at Module._compile (node:internal/modules/cjs/loader:1730:14)
    at Object..js (node:internal/modules/cjs/loader:1895:10)
    at Module.load (node:internal/modules/cjs/loader:1465:32)
    at Function._load (node:internal/modules/cjs/loader:1282:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1487:12)
    at require (node:internal/modules/helpers:135:16) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: './package.json'
}

Node.js v22.17.1

But, now it doesn't find the package.json, so the command needs to be executed in /opt/immich/app:

> cd /opt/immich/app
> immich-admin
Initializing Immich
Detected CPU Cores: 4
Usage: main [options] [command]

Options:
  -h, --help              display help for command

Commands:
  reset-admin-password    Reset the admin password
  enable-password-login   Enable password login
  disable-password-login  Disable password login
  enable-oauth-login      Enable OAuth login
  disable-oauth-login     Disable OAuth login
  list-users              List Immich users
  version                 Print Immich version
  grant-admin             Grant admin privileges to a user (by email)
  revoke-admin            Revoke admin privileges from a user (by email)
  change-media-location   Change database file paths to align with a new media location
  help [command]          display help for command

Using change-media-location reveals another issue:

> cd /opt/immich/app && immich-admin change-media-location
Initializing Immich
Detected CPU Cores: 4
Error: getaddrinfo ENOTFOUND redis
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:111:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'redis'
}
Error: getaddrinfo ENOTFOUND database
    at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:122:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'database'
}
Unable to update database file paths.

It doesn't use any variables from the /opt/immich/.env file and uses a hardcoded value:

host: dto.REDIS_HOSTNAME || 'redis',

Copying the .env to /opt/immich/app does not resolve this. I am not sure why, I am no developer at all.

To fix this, I used a npm package:

> npm install -g dotenv-cli

added 11 packages in 472ms

4 packages are looking for funding
  run `npm fund` for details
> dotenv -e ../.env node dist/main.js immich-admin change-media-location
? Enter the previous value of IMMICH_MEDIA_LOCATION: [/opt/immich/upload]

It would be nice if all of this would work out of the box for a fresh LXC installation. I think many users will switch from docker to LXC, and they need immich-admin change-media-location

🔄 Steps to reproduce the issue.

  1. Attach (or SSH) into the LXC
  2. Execute immich-admin

Paste the full error output (if available).

bash: immich-admin: command not found

🖼️ Additional context (optional).

I already opened a discussion: https://github.com/community-scripts/ProxmoxVE/discussions/6420
but after I solved it, I think it's worth to open a issue for it.

Originally created by @dom6770 on GitHub (Jul 31, 2025). Originally assigned to: @vhsdream on GitHub. ### ✅ Have you read and understood the above guidelines? yes ### 📜 What is the name of the script you are using? Immich ### 📂 What was the exact command used to execute the script? bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/immich.sh)" ### ⚙️ What settings are you using? - [x] Default Settings - [ ] Advanced Settings ### 🖥️ Which Linux distribution are you using? Debian 12 ### 📝 Provide a clear and concise description of the issue. Immich provides a server CLI: https://immich.app/docs/administration/server-commands/ This doesn't work out of the box: ```bash > immich-admin zsh: command not found: immich-admin ``` Adding the correct directory to PATH solves this: ```bash > PATH="/opt/immich/app/bin:$PATH" > immich-admin Initializing Immich Detected CPU Cores: 4 node:fs:441 return binding.readFileUtf8(path, stringToFlags(options.flag)); ^ Error: ENOENT: no such file or directory, open './package.json' at readFileSync (node:fs:441:20) at Object.<anonymous> (/opt/immich/app/dist/constants.js:37:59) at Module._compile (node:internal/modules/cjs/loader:1730:14) at Object..js (node:internal/modules/cjs/loader:1895:10) at Module.load (node:internal/modules/cjs/loader:1465:32) at Function._load (node:internal/modules/cjs/loader:1282:12) at TracingChannel.traceSync (node:diagnostics_channel:322:14) at wrapModuleLoad (node:internal/modules/cjs/loader:235:24) at Module.require (node:internal/modules/cjs/loader:1487:12) at require (node:internal/modules/helpers:135:16) { errno: -2, code: 'ENOENT', syscall: 'open', path: './package.json' } Node.js v22.17.1 ``` But, now it doesn't find the package.json, so the command needs to be executed in `/opt/immich/app`: ```bash > cd /opt/immich/app > immich-admin Initializing Immich Detected CPU Cores: 4 Usage: main [options] [command] Options: -h, --help display help for command Commands: reset-admin-password Reset the admin password enable-password-login Enable password login disable-password-login Disable password login enable-oauth-login Enable OAuth login disable-oauth-login Disable OAuth login list-users List Immich users version Print Immich version grant-admin Grant admin privileges to a user (by email) revoke-admin Revoke admin privileges from a user (by email) change-media-location Change database file paths to align with a new media location help [command] display help for command ``` Using `change-media-location` reveals another issue: ```bash > cd /opt/immich/app && immich-admin change-media-location Initializing Immich Detected CPU Cores: 4 Error: getaddrinfo ENOTFOUND redis at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:111:26) { errno: -3008, code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'redis' } Error: getaddrinfo ENOTFOUND database at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:122:26) { errno: -3008, code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'database' } Unable to update database file paths. ``` It doesn't use any variables from the `/opt/immich/.env` file and uses a hardcoded value: ```JS host: dto.REDIS_HOSTNAME || 'redis', ``` Copying the `.env` to `/opt/immich/app` does not resolve this. I am not sure why, I am no developer at all. To fix this, I used a npm package: ```bash > npm install -g dotenv-cli added 11 packages in 472ms 4 packages are looking for funding run `npm fund` for details > dotenv -e ../.env node dist/main.js immich-admin change-media-location ? Enter the previous value of IMMICH_MEDIA_LOCATION: [/opt/immich/upload] ``` It would be nice if all of this would work out of the box for a fresh LXC installation. I think many users will switch from docker to LXC, and they need `immich-admin change-media-location` ### 🔄 Steps to reproduce the issue. 1. Attach (or SSH) into the LXC 2. Execute `immich-admin` ### ❌ Paste the full error output (if available). ```bash bash: immich-admin: command not found ``` ### 🖼️ Additional context (optional). I already opened a discussion: https://github.com/community-scripts/ProxmoxVE/discussions/6420 but after I solved it, I think it's worth to open a issue for it.
saavagebueno added the bug label 2025-11-20 05:13:15 -05:00
Author
Owner

@vhsdream commented on GitHub (Jul 31, 2025):

Funnily enough, I ran into this yesterday as I was trying to fix an issue with many of my images failing to load.

I managed to get things to work by adding some content to their start.sh script.

I'll have to have a think about how best to deal with this.

@vhsdream commented on GitHub (Jul 31, 2025): Funnily enough, I ran into this yesterday as I was trying to fix an issue with many of my images failing to load. I managed to get things to work by adding some content to their `start.sh` script. I'll have to have a think about how best to deal with this.
Author
Owner

@vhsdream commented on GitHub (Jul 31, 2025):

Ohhhh and now there's 1.137.0 with some more changes. I was trying to test my fix for this and it dropped.

@vhsdream commented on GitHub (Jul 31, 2025): Ohhhh and now there's 1.137.0 with some more changes. I was trying to test my fix for this and it dropped.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/ProxmoxVE#1608