immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
47.33k stars 2.4k forks source link

[BUG] Unable to execute "Remove Offline Files" on default library for CLI "imported" external libraries #6144

Closed asecor closed 1 month ago

asecor commented 9 months ago

The bug

I migrated immich from NAS1 to NAS2 and the top level path changed from /mnt/Photos to /share/Photos.

Even though I updated .env and docker-compose.yml with the new top level paths (i.e. from /mnt/Photos/immich to /share/Photos/immich), I backed up and restored postgresql DB onto new stack, everything loaded fine, all images display fine, no issues until I attempted to download multiple photos older than July 2023 from own timeline or albums and every time zip file size is 22 bytes...

Furthermore I then noticed that even though the photos load in immich (presumably cached), their location is /mnt/Photos/ instead of /share/Photos - how can I purge the metadata of the externally imported (a while back via CLI tool) photos/videos so that I can re-import it again correctly, via the new method.

The OS that Immich Server is running on

QNAP TS-464 Linux 5.10.60-qnap

Version of Immich Server

v1.91.4

Version of Immich Mobile App

v1.91.4 build.116 (Android)

Platform with the issue

Your docker-compose.yml content

version: "3.8"

#
# WARNING: Make sure to use the docker-compose.yml of the current release:
#
# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
#
# The compose file on main may not be compatible with the latest release.
#

name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: [ "start.sh", "immich" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /share/Photos:/share/Photos:ro
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.yml
    #   service: hwaccel
    command: [ "start.sh", "microservices" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /share/Photos:/share/Photos:ro
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
    restart: always

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2-alpine@sha256:60e49e22fa5706cd8df7d5e0bc50ee9bab7c608039fa653c4d961014237cca46
    restart: always

  database:
    container_name: immich_postgres
    image: tensorchord/pgvecto-rs:pg14-v0.1.11
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always

volumes:
  pgdata:
  model-cache:

Your .env content

# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
UPLOAD_LOCATION=/share/Photos/immich

# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release

# Connection secrets for postgres and typesense. You should change these to random passwords
TYPESENSE_API_KEY=<KEY>
DB_PASSWORD=<PASSWORD>

# The values below this line do not need to be changed
###################################################################################
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

REDIS_HOSTNAME=immich_redis

Reproduction steps

Downloading photos (which are pointing/residing at old mount point according to immich)

1. Create album
2. Add photos older than September 2023
3. Go to newly created album
4. Select multiple photos and download
5. immich shows correct zip file size of the selected photos
6. Firefox/Safari downloads zip file with size of 22 bytes

Attempted different albums, and/or individual photos in users' timeline older than September 2023 with same result.

Additional information

immich_server            | [Nest] 6  - 01/03/2024, 3:07:33 PM   ERROR [Error: ENOENT: no such file or directory, access '/mnt/photos/meerprat/2023/04/20230414_193441.mp4'] Unable to send file: Error
immich_server            | [Nest] 6  - 01/03/2024, 3:07:33 PM    WARN [ExpressAdapter] Content-Type doesn't match Reply body, you might need a custom ExceptionFilter for non-JSON responses
immich_server            | [Nest] 6  - 01/03/2024, 3:07:33 PM   ERROR [ExceptionsHandler] ENOENT: no such file or directory, access '/mnt/photos/meerprat/2023/04/20230414_193441.mp4'
immich_server            | Error: ENOENT: no such file or directory, access '/mnt/photos/meerprat/2023/04/20230414_193441.mp4'
etnoy commented 9 months ago

I'm not sure we still support that older style of imported read-only files. We deprecated them in favor of external libraries