imagegenius / docker-immich

Monolithic (Single) Docker Container for Immich
GNU General Public License v3.0
455 stars 26 forks source link

Upload from app fail #328

Open qbicus opened 3 months ago

qbicus commented 3 months ago

For every image that is upoloaded after the 1.99 release I get in the log file the following:

[Nest] 247  - 03/29/2024, 8:50:46 PM   ERROR [Error: EPERM: operation not permitted, utime '/photos/upload/c0ec343e-cbe3-4fe1-8402-f957e419a04c/e7/ce/e7ce631c-b3cb-4d7f-adb3-fb7efbd09197.jpg'] Error uploading file Error: EPERM: operation not permitted, utime '/photos/upload/c0ec343e-cbe3-4fe1-8402-f957e419a04c/e7/ce/e7ce631c-b3cb-4d7f-adb3-fb7efbd09197.jpg'
[Nest] 247  - 03/29/2024, 8:50:46 PM   ERROR [Error: EPERM: operation not permitted, utime '/photos/upload/c0ec343e-cbe3-4fe1-8402-f957e419a04c/e7/ce/e7ce631c-b3cb-4d7f-adb3-fb7efbd09197.jpg'] Failed to upload file
[Nest] 247  - 03/29/2024, 8:50:46 PM   ERROR [Error: EPERM: operation not permitted, utime '/photos/upload/c0ec343e-cbe3-4fe1-8402-f957e419a04c/e7/ce/e7ce631c-b3cb-4d7f-adb3-fb7efbd09197.jpg'] Error: EPERM: operation not permitted, utime '/photos/upload/c0ec343e-cbe3-4fe1-8402-f957e419a04c/e7/ce/e7ce631c-b3cb-4d7f-adb3-fb7efbd09197.jpg'

The image appears in the webinterface but it is broken.

hydazz commented 3 months ago

is /photos mounted to a smb or other network storage on the host? or is it a normal filesystem mount?

qbicus commented 3 months ago

/photos was always mounted as smb. It worked flawlessly before the update so I am at a loss. all that was done was pull the new image and in Postgre install the vectors thingy

hydazz commented 3 months ago

[Error: EPERM: operation not permitted is a permission issue, ensure that /photos/upload/c0ec343e-cbe3-4fe1-8402-f957e419a04c/e7/ce/e7ce631c-b3cb-4d7f-adb3-fb7efbd09197.jpg (or the parent directories) are indeed owned by the desired user, perhaps the UID changed...

what does docker exec immich s6-setuidgid abc ls -la /photos/upload/c0ec343e-cbe3-4fe1-8402-f957e419a04c/e7/ce/e7ce631c-b3cb-4d7f-adb3-fb7efbd09197.jpg show?

hydazz commented 2 months ago

success?

someonewating commented 2 months ago

Hi @hydazz , thank you for your attention first.

I have the exactly same issue. Just updated my postgredb, and then encountered this issue.

my /photo is mounted via smb as well, the permission is:

total 4.0K
drwxrwxrwx 2 root root    0 Aug 26  2023 .
drwxr-xr-x 1 root root 4.0K Apr 14 10:23 ..
drwxrwxrwx 2 root root    0 Sep 11  2023 encoded-video
drwxrwxrwx 2 root root    0 Sep 11  2023 library
drwxrwxrwx 2 root root    0 Sep 11  2023 log
drwxrwxrwx 2 root root    0 Sep 11  2023 machine-learning
drwxrwxrwx 2 root root    0 Sep 11  2023 redis
drwxrwxrwx 2 root root    0 Nov  6 22:05 .reverse-geocoding-dump
drwxrwxrwx 2 root root    0 Sep 11  2023 thumbs
drwxrwxrwx 2 root root    0 Sep 11  2023 typesense
drwxrwxrwx 2 root root    0 Sep 11  2023 upload

my error message is: [Nest] 522 - 04/14/2024, 10:24:52 AM ERROR [Error: EPERM: operation not permitted, utime '/photos/upload/3129b451-c047-4eda-8fd2-d1ed2c4f34a6/18/d1/18d149fd-0804-4ef8-8bb2-907fe579a731.jpg'] Error: EPERM: operation not permitted, utime '/photos/upload/3129b451-c047-4eda-8fd2-d1ed2c4f34a6/18/d1/18d149fd-0804-4ef8-8bb2-907fe579a731.jpg'

however if I run ls -ahl /photos/upload/3129b451-c047-4eda-8fd2-d1ed2c4f34a6/18/d1/18d149fd-0804-4ef8-8bb2-907fe579a731.jpg, I will get ls: cannot access '/photos/upload/3129b451-c047-4eda-8fd2-d1ed2c4f34a6/18/d1/18d149fd-0804-4ef8-8bb2-907fe579a731.jpg': No such file or directory.

For a long time I used environment variable in my docker compose file: PUID=1000 and PGID=1000 , but this is the first time I saw this error.

I also tried find / -name 18d149fd-0804-4ef8-8bb2-907fe579a731.jpg, but that file cannot even be found.

Not sure what is wrong now, I tried to log into the container and tried to create/remove files, and it works well. Looks like only the npm is unable to create files. The immich is able to show the image properly so I think it has read access.

Please kindly let me know your thoughts. Thank you in advance!

hydazz commented 2 months ago

is this share mounted via fstab?

someonewating commented 2 months ago

I think no, as the output of cat /etc/fstab is empty.

Actually the immich and the storage are running on Azure Container App and Azure Storage Account, so I'm not sure how the storage has been mounted.

hydazz commented 2 months ago

Does Azure allow you to change the permissions of the mount?

someonewating commented 2 months ago

Well it should be possible. may I know what permission I need to change?

hydazz commented 2 months ago

The mounts should be mounted so that the owner is 1000 (whoever this maps to on the azure host), which you don't have access to, perhaps just set PUID and PGID to 0 if its not possible

you could also try chown -R abc:abc /photos?

someonewating commented 2 months ago

Thank you @hydazz , my issue has been resolved by changing PUID and PGUID to 0, which represents root user.

someonewating commented 2 months ago

Just another comment for users who using Azure Container APP and Azure Storage Account to run Immich. This version of Immich will take more time to start up, the default setting of the startup probe will treat the container as unhealthy, so the Initial delay seconds has to be increased.

qbicus commented 2 months ago

In my case the permissions were fine as it worked without an issue till I did an update of the image (pull the latest etc). I solved it by saving all the images in a separate folder, deleting the old stack and re-creating everything from 0 and this time used the postgresql inside the image and not my separate one (I have a separate postgre that I used for other projects as well). Reimported the external library and now works.

Nothing changed in the mount/permissions etc

goekhanm commented 3 weeks ago

Hi, have the same problem here. Immich, Redis and Postgres are in separated containers. Running the setup on the latest unraid. The photo-library is stored on an external USB-Storage. Library is mounted with the unraid-option "read/write -slave".

@qbicus

"postgresql inside the image"

Which Image do you use? Couldn't find an Immich-Image including Postgres.

qbicus commented 3 weeks ago

Sorry wrong choice of words. I meant the docker compose file contains a postgresql container. In my previous set-up I had a separate VM that handled all my database requirements (postgresql, mysql with several versions). I think the problem was in the pgvectors extensions that was different than the newly required one.

goekhanm commented 3 weeks ago

@qbicus Thanks for clearing that up

goekhanm commented 2 weeks ago

Quick Update: I solved my problem by using the official unraid setup for immich via docker compose manager: https://immich.app/docs/install/unraid/ I hope it helps