[GH-ISSUE #9962] PhotoPrism environment variables are missing for the CLI tools #2165

Closed
opened 2026-02-26 12:51:31 +03:00 by kerem · 4 comments
Owner

Originally created by @slypete on GitHub (Dec 15, 2025).
Original GitHub issue: https://github.com/community-scripts/ProxmoxVE/issues/9962

Have you read and understood the above guidelines?

yes

🔎 Did you run the script with verbose mode enabled?

Yes, verbose mode was enabled and the output is included below

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

PhotoPrism

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

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

⚙️ What settings are you using?

  • Default Settings
  • Advanced Settings

🖥️ Which Linux distribution are you using?

Debian 13

📈 Which Proxmox version are you on?

9.1.1

📝 Provide a clear and concise description of the issue.

Environment variables are missing for the photoprism CLI tools

The script does not load the /opt/photoprism/config/.env into the environment. These variables are only loaded as part of the service in the EnvironmentFile. Therefore, the variables are not available to the command line tools (which run outside of the service).

I added this in my ~/.bashrc to export all of these variables to the bash session:

export $(grep -v '^#' /opt/photoprism/config/.env | xargs)

If you don't have these variables on your session, your command line tools will use the default config rather than the config you have configured in .env. For example, let's say you switch to using mariadb rather than the default sqlite. If you use the CLI to add a user, the CLI will add a user to the sqllite database rather than the mariadb database. This goes for all of the CLI tools. The will use the wrong config because the environment variables are not available.

🔄 Steps to reproduce the issue.

  1. Install photoprism using the default config
  2. Point your photoprism to a mariadb using the /opt/photoprism/config/.env file
  3. Use the CLI to add a user
    photoprism users add -w -p insecure -r Admin -A Local --superadmin pete
  4. Try to login to the WebUI with the new user
  5. Observe that you cannot login
  6. Observe that the user was created in sqllite and not in mariadb
  7. Export the variables to you session
    export $(grep -v '^#' /opt/photoprism/config/.env | xargs)
  8. Use the CLI to add a user
    1. Observe that the user was successfully created in mariadb

Paste the full error output (if available).

Doesn't error out, just uses the wrong config which can be very confusing.

🖼️ Additional context (optional).

No response

Originally created by @slypete on GitHub (Dec 15, 2025). Original GitHub issue: https://github.com/community-scripts/ProxmoxVE/issues/9962 ### ✅ Have you read and understood the above guidelines? yes ### 🔎 Did you run the script with verbose mode enabled? Yes, verbose mode was enabled and the output is included below ### 📜 What is the name of the script you are using? PhotoPrism ### 📂 What was the exact command used to execute the script? bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/photoprism.sh)" ### ⚙️ What settings are you using? - [x] Default Settings - [ ] Advanced Settings ### 🖥️ Which Linux distribution are you using? Debian 13 ### 📈 Which Proxmox version are you on? 9.1.1 ### 📝 Provide a clear and concise description of the issue. Environment variables are missing for the photoprism CLI tools The script does not load the /opt/photoprism/config/.env into the environment. These variables are only loaded as part of the service in the EnvironmentFile. Therefore, the variables are not available to the command line tools (which run outside of the service). I added this in my `~/.bashrc` to export all of these variables to the bash session: `export $(grep -v '^#' /opt/photoprism/config/.env | xargs)` If you don't have these variables on your session, your command line tools will use the default config rather than the config you have configured in .env. For example, let's say you switch to using mariadb rather than the default sqlite. If you use the CLI to add a user, the CLI will add a user to the sqllite database rather than the mariadb database. This goes for all of the CLI tools. The will use the wrong config because the environment variables are not available. ### 🔄 Steps to reproduce the issue. 1. Install photoprism using the default config 2. Point your photoprism to a mariadb using the /opt/photoprism/config/.env file 3. Use the CLI to add a user `photoprism users add -w -p insecure -r Admin -A Local --superadmin pete` 4. Try to login to the WebUI with the new user 5. Observe that you cannot login 6. Observe that the user was created in sqllite and not in mariadb 7. Export the variables to you session `export $(grep -v '^#' /opt/photoprism/config/.env | xargs)` 8. Use the CLI to add a user 9. 6. Observe that the user was successfully created in mariadb ### ❌ Paste the full error output (if available). Doesn't error out, just uses the wrong config which can be very confusing. ### 🖼️ Additional context (optional). _No response_
kerem 2026-02-26 12:51:31 +03:00
Author
Owner

@MickLesk commented on GitHub (Dec 15, 2025):

What are cli Tools? Extrend the env and done? But without any Info we dont know whats Missing. We have build the env based on there template

And how do you Connect to the LXC?

<!-- gh-comment-id:3654049771 --> @MickLesk commented on GitHub (Dec 15, 2025): What are cli Tools? Extrend the env and done? But without any Info we dont know whats Missing. We have build the env based on there template And how do you Connect to the LXC?
Author
Owner

@slypete commented on GitHub (Dec 15, 2025):

Hi @MickLesk, I connect to the LXC via PVE shell option in webgui.

It’s a script issue because the script creates the systemd service. The CLI tools are part of the photoprism binary. These tools expect all of the environment variables defined in /opt/photoprism/config/.env in the CLI session. You can login as root and run “env” to see that they are not. Because they are defined in the EnvironmentFile variable for systemd, they are only available to the service.

You can see others struggling with this issue here. They didn’t figure it out completely, but it’s because the CLI vs service are using different configurations.
https://github.com/tteck/Proxmox/issues/395

<!-- gh-comment-id:3654284465 --> @slypete commented on GitHub (Dec 15, 2025): Hi @MickLesk, I connect to the LXC via PVE shell option in webgui. It’s a script issue because the script creates the systemd service. The CLI tools are part of the photoprism binary. These tools expect all of the environment variables defined in /opt/photoprism/config/.env in the CLI session. You can login as root and run “env” to see that they are not. Because they are defined in the EnvironmentFile variable for systemd, they are only available to the service. You can see others struggling with this issue here. They didn’t figure it out completely, but it’s because the CLI vs service are using different configurations. https://github.com/tteck/Proxmox/issues/395
Author
Owner

@MickLesk commented on GitHub (Dec 15, 2025):

2021...

Show us an link of the documentation and we can take a look. “Just saying ‘that's not how it works’ is nonsense. It's like if I told you about the quantum particle AXYB12, you'd never understand it without documentation.”

Show some logs, show some screenshots, maybe someone will be able to understand it halfway.

<!-- gh-comment-id:3654308004 --> @MickLesk commented on GitHub (Dec 15, 2025): 2021... Show us an link of the documentation and we can take a look. “Just saying ‘that's not how it works’ is nonsense. It's like if I told you about the quantum particle AXYB12, you'd never understand it without documentation.” Show some logs, show some screenshots, maybe someone will be able to understand it halfway.
Author
Owner

@slypete commented on GitHub (Dec 16, 2025):

Hello again!

Here's the documentation:
https://www.photoprism.app/pro/kb/config-options

Run env as root to see none of them are loaded in the environment. All you need to do is add this to root's ~/.bashrc to export all of the .env variables the bash session and save users a lot of headache:

export $(grep -v '^#' /opt/photoprism/config/.env | xargs)

Also, here's another user reporting the issue more recently. You can tell they used PVE Helper Scripts because of the systemd service configuration.
https://www.reddit.com/r/photoprism/comments/1mpehlv/issue_photoprism_variables_in_the/

Take care,
slypete

<!-- gh-comment-id:3658347670 --> @slypete commented on GitHub (Dec 16, 2025): Hello again! Here's the documentation: https://www.photoprism.app/pro/kb/config-options Run `env` as root to see none of them are loaded in the environment. All you need to do is add this to root's `~/.bashrc `to export all of the `.env` variables the bash session and save users a lot of headache: `export $(grep -v '^#' /opt/photoprism/config/.env | xargs)` Also, here's another user reporting the issue more recently. You can tell they used PVE Helper Scripts because of the systemd service configuration. https://www.reddit.com/r/photoprism/comments/1mpehlv/issue_photoprism_variables_in_the/ Take care, slypete
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ProxmoxVE#2165
No description provided.