immich-app / immich

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

[BUG] Cannot backup any photo or video on MIUI 14 #4654

Closed zhyfzy closed 5 months ago

zhyfzy commented 11 months ago

The bug

It is normal to upload photos and videos through the webpage, but on my Android device, It can only detect the number of total assets, but does nothing after I touch the 'start backup' button. Neither the foreground nor the background is work.

There is an error log in the Android app

Message:
Catch all error: PlatformException(Request for permission failed., User denied permission., null, null) - PlatformException(Request for permission failed., User denied permission., null, null)

FROM:
ImmichErrorLogger

STACK TRACES:
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310)
<asynchronous suspension>
#2      AssetEntity._getFile (package:photo_manager/src/types/entity.dart:712)
<asynchronous suspension>
#3      HashService._hashAssets (package:immich_mobile/shared/services/hash.service.dart:59)
<asynchronous suspension>
#4      SyncService._addAlbumFromDevice (package:immich_mobile/shared/services/sync.service.dart:620)
<asynchronous suspension>
#5      diffSortedLists (package:immich_mobile/utils/diff.dart:30)
<asynchronous suspension>
#6      SyncService._syncLocalAlbumAssetsToDb (package:immich_mobile/shared/services/sync.service.dart:437)
<asynchronous suspension>
#7      AlbumService.refreshDeviceAlbums (package:immich_mobile/modules/album/services/album.service.dart:114)
<asynchronous suspension>
#8      AssetNotifier.getAllAsset (package:immich_mobile/shared/providers/asset.provider.dart:53)
<asynchronous suspension>

And anthor log:

MESSAGE: 
Media location permission is not granted. Cannot access original assets for backup.

FROM:
BackupService

But I have already granted all permissions in the apps setting (Xiaomi 13). It keeps generating logs like this and no files are uploaded.

The OS that Immich Server is running on

Ubuntu 22.04

Version of Immich Server

1.82.1

Version of Immich Mobile App

1.82.1 build.2106

Platform with the issue

Your docker-compose.yml content

version: "3.8"

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
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
      - typesense
    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
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
      - typesense
    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

  immich-web:
    container_name: immich_web
    image: ghcr.io/immich-app/immich-web:${IMMICH_VERSION:-release}
    env_file:
      - .env
    restart: always

  typesense:
    container_name: immich_typesense
    image: typesense/typesense:0.24.1@sha256:9bcff2b829f12074426ca044b56160ca9d777a0c488303469143dd9f8259d4dd
    environment:
      - TYPESENSE_API_KEY=${TYPESENSE_API_KEY}
      - TYPESENSE_DATA_DIR=/data
      # remove this to get debug messages
      - GLOG_minloglevel=1
    volumes:
      - tsdata:/data
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2-alpine@sha256:70a7a5b641117670beae0d80658430853896b5ef269ccf00d1827427e3263fa3
    restart: always

  database:
    container_name: immich_postgres
    image: postgres:14-alpine@sha256:28407a9961e76f2d285dc6991e8e48893503cc3836a4755bbc2d40bcc272a441
    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

  immich-proxy:
    container_name: immich_proxy
    image: ghcr.io/immich-app/immich-proxy:${IMMICH_VERSION:-release}
    environment:
      # Make sure these values get passed through from the env file
      - IMMICH_SERVER_URL
      - IMMICH_WEB_URL
    ports:
      - 2283:8080
    depends_on:
      - immich-server
      - immich-web
    restart: always

volumes:
  pgdata:
  model-cache:
  tsdata:

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=/media/terra/immich

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

LOG_LEVEL=verbose

# Connection secrets for postgres and typesense. You should change these to random passwords
TYPESENSE_API_KEY=some-random-text
DB_PASSWORD=postgres

# 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

1. Deploying immich through docker-compose and conducting init settings
2. Open the Android app and login 
3. Touch the 'start backup' button in the android app, but nothing happened.
...

Additional information

No response

alextran1502 commented 11 months ago

What is the Android version of your phone?

zhyfzy commented 11 months ago

What is the Android version of your phone?

Android 14 (MIUI 14.0.3)

alextran1502 commented 11 months ago

Do you mind reinstalling the app and try again for the permission?

zhyfzy commented 11 months ago

Do you mind reinstalling the app and try again for the permission?

yes,i have reinstalled both the Android app and docker containers (clean install),but this problem still exists

alextran1502 commented 11 months ago

Thank you, I will try to create the same Android version on an emulator to see if I can reproduce this issue

thjkl-gthb commented 11 months ago

I got the same issue and my phone's version is Android 14 (MIUI 14.0.2)

thjkl-gthb commented 11 months ago

I got the same issue and my phone's version is Android 14 (MIUI 14.0.2) @alextran1502

Update: It's working on my another phone with MIUI 12(Rooted), so it may be related to the system settings like security enhancement

Plus, for the non-working phone, it can't load the Pic in "Albums on device" under the library

robert-zc-github commented 10 months ago

Update: I also meet this on My MI 13(Android 14, MIUI 14.0.5), it seems that it is cauesd by a system bug. The permission had not been applied correctly, i correct that by relaunch the App permissions: in Settings -> Apps -> Permissions -> Permissions -> choose immich, select "Access photos and videos" permission to "Deny", and than reselect to "Always allow".

When i return to immich, I found the backup progress start.

zhyfzy commented 10 months ago

Update: I also meet this on My MI 13(Android 14, MIUI 14.0.5), it seems that it is cauesd by a system bug. The permission had not been applied correctly, i correct that by relaunch the App permissions: in Settings -> Apps -> Permissions -> Permissions -> choose immich, select "Access photos and videos" permission to "Deny", and than reselect to "Always allow".

When i return to immich, I found the backup progress start.

Thank you, this works for me