[SOLVED] Immich keeps restarting the backup - eviltoast

Hi guys! I’m having my first attempt at Immich (…and docker, since I’m at it). So I have successfully set it up (I think), and connected the phone and it started uploading. I have enabled foreground and background backup, and I have only chosen the camera album from my Pixel/GrapheneOS phone. Thing is, after a while (when the screen turns off for a while, even though the app is unrestricted in Android/GrapheneOS, or whenever changing apps…or whenever it feels like), the backup seems to start again from scratch, uploading again and again the first videos from the album (the latest ones, from a couple of days ago), and going its way until somewhere in December 2023…which is where at some point decides to go back and re-do May 2024. It’s been doing this a bunch of times. I’ve seen mentioned a bunch of times that I should set client_max_body_size on nginx to something large like 5000MB. However in my case it’s set to 0, which should read as unrestricted. It doesn’t skip large videos of several hundreds megs, it does seem to go through the upload process…but then it keeps redoing them after a while.

Any idea what might be failing? Why does it keep restarting the backup? By the way, I took a screenshot of the backup a couple days ago, and both the backed up asset number and the remainder has kept the same since (total 2658, backup 179, remainder 2479). This is a couple of days now going through what I’d think is the same files over and over?

SOLVED: So it was about adding the client_max_body_size value to my nginx server. I thought I did, so I was ignoring this even though I saw it mentioned multiple times. Mine is set to value 0, not 50000M as suggested on other threads, but I thought it should work. But then again, it was in the wrong section, applying to a different service/container, not Immich. Adding it to Immich too (with 0, in my case, which should set it to “unlimited”) worked immediately after restarting nginx service. Thanks everyone for all the follow ups and suggestions!

  • seang96@spgrn.com
    link
    fedilink
    English
    arrow-up
    4
    ·
    5 months ago

    What do the logs say? I’d check

    • proxy log for response code
    • l assume media is storing, if not check it
    • microservice not checking for duplicates due to some error

    the more I think there are more unknowns sice there are a few ways it could be running.

    • iturnedintoanewt@lemm.eeOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      5 months ago

      Good point about media storing. I seem to have some loop folders issue. My Immich folder has encoded-video (empty), profile (empty), thumbs (with stuff), and immich-files…and immich-files has encoded-video (again, empty), library (with all the stuff), profile (empty), thumbs (empty) and upload (empty). This is my .env:

      UPLOAD_LOCATION=/media/MyNAS/Immich/immich_files
      THUMB_LOCATION=/media/MyNAS/Immich/thumbs
      ENCODED_VIDEO_LOCATION=/media/MyNAS/Immich/encoded-video
      PROFILE_LOCATION=/media/NASdata/MyNAS/Immich/profile
      

      And…this is my docker-compose.yml:

          volumes:
            - ${UPLOAD_LOCATION}:/usr/src/app/upload
            - ${THUMB_LOCATION}:/usr/src/app/upload/thumbs
            - ${ENCODED_VIDEO_LOCATION}:/usr/src/app/upload/encoded-video
            - ${PROFILE_LOCATION}:/usr/src/app/upload/profile
            - /etc/localtime:/etc/localtime:ro
      
      

      Is there anything obviously wrong that would make Immich place stuff in weird folders? Should I remove all the additional paths from .env, leaving only UPLOAD_LOCATION?

      • nfh@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        5 months ago

        I’d watch those folders, especially the UPLOAD_LOCATION, when it’s uploading. Are they being written? Do they persist, or are they being deleted? See if you can upload a single image through the web client, and observe that behavior too.

        • iturnedintoanewt@lemm.eeOP
          link
          fedilink
          English
          arrow-up
          2
          ·
          edit-2
          5 months ago

          I mean, my concern is…it would seem in docker-compose.yml that these paths would match:

          ${THUMB_LOCATION} = ${UPLOAD_LOCATION}/thumbs
          ${ENCODED_VIDEO_LOCATION} = ${UPLOAD_LOCATION}/encoded-video
          ${PROFILE_LOCATION} = ${UPLOAD_LOCATION}profile
          
          

          , which might explain why I’m getting a thumbs folder inside my /media/MyNAS/Immich/immich-files…same with profile and encoded-video. The thumbs clearly is being used (the one inside Immich/immich-files/thumbs), while the root-located one (Immich/thumbs) is not. The root-based folders might be created due to the .env file, but then not used…and maybe it’s confusing Immich? Can I remove the entries from the .env, leaving just the UPLOAD_LOCATION one? Or am I making myself a mess this way? Maybe I should make them point equally in the .env to the same sub-paths inside immich-files so they match the structure in the docker-compose.yml? Sorry…kinda new to docker compose.

          • blotz@lemmy.world
            link
            fedilink
            English
            arrow-up
            3
            ·
            5 months ago

            I think the issue might be that the config changes haven’t been properly committed. Docker container won’t just update based on docker compose config.

            docker container stop
            docker container rm
            

            You might want to delete and reset any settings which have been set

            docker volume ls
            docker volume rm (IDs from docker volume ls)
            

            (This will also wipe out any backups/accounts made on immich already tho)

            But once you have deleted the old containers, running docker compose up -d will start the containers with the new config. You can use docker compose logs -f to see the server logs and check if everything is working.

            • iturnedintoanewt@lemm.eeOP
              link
              fedilink
              English
              arrow-up
              2
              ·
              edit-2
              5 months ago

              Thanks for all the help. I changed the paths as I was mentioning a bit on the .env, so they matched the ones on the docker-compose.yml. But no dice. I think it gets stuck at the same picture, although I’m not 100% sure which one. After I rebuilt the container, the number of assets increased by two, but I also realized that I took a couple pics earlier. So it added those two and crashed a while later at the same spot as before…Is a picture/video capable of corrupting the whole backup?? Also, I’m not sure how to properly track which one is messing it, because the backup seems to have skipped a lot of pictures in what it copied.

              • seang96@spgrn.com
                link
                fedilink
                English
                arrow-up
                1
                ·
                5 months ago

                If it is due to a sigle asset I imagine an error would log to the console.

                • iturnedintoanewt@lemm.eeOP
                  link
                  fedilink
                  English
                  arrow-up
                  1
                  ·
                  edit-2
                  5 months ago

                  O.M.G…so many hours wasted. One of my first searches already returned “you should increase client_max_body_size to something like 50000M”, and I was like I aLreAdy iNCreAseD mY client_max_body_size tO zERo sO its uNLimIteD DuH <spongebob.jpg> Well turns out my client_max_body_size 0 parameter was in a section defining parameters for a different container/server. So of course it wasn’t applying to Immich. Just added the same line to Immich section too, restarted nginx…and the backed up asset count is already wayy ahead of the ceiling it would always hit at 180ish assets. I think I might have found my issue.

                  Thanks for all the help and following up!

                • iturnedintoanewt@lemm.eeOP
                  link
                  fedilink
                  English
                  arrow-up
                  1
                  ·
                  edit-2
                  5 months ago

                  You mean to docker logs immich_server ? I think this would be about the only error kinda it’s outputting once in a bluemoon.

                  [Nest] 6 - 05/29/2024, 2:40:17 PM WARN [ImmichServer] [ExpressAdapter] Content-Type doesn’t match Reply body, you might need a custom ExceptionFilter for non-JSON responses

                  Everything else is Websocket Connect, Websocket Disconnect.

          • seang96@spgrn.com
            link
            fedilink
            English
            arrow-up
            1
            ·
            5 months ago

            Were you able to fix it? Mounting like that should work but it looks like docker isn’t mounting subpaths right.

            • iturnedintoanewt@lemm.eeOP
              link
              fedilink
              English
              arrow-up
              1
              ·
              5 months ago

              Yeah, also my thought. Seems it’s still not working. I’ve seen it repeat the uploads multiple times, and still have quite a limited amount of pictures on the server.

              • seang96@spgrn.com
                link
                fedilink
                English
                arrow-up
                1
                ·
                5 months ago

                My advice is start over at least temporarily. Use immich base compose with one mount for the uploads and test it before deviating from the basic setup.

                • iturnedintoanewt@lemm.eeOP
                  link
                  fedilink
                  English
                  arrow-up
                  1
                  ·
                  5 months ago

                  You mean, without defining additional paths for thumbs, profile etc? Will it work without declaring them?

                  Thanks!

  • 4am@lemm.ee
    link
    fedilink
    English
    arrow-up
    3
    ·
    5 months ago

    Is the container running out of disk space for its DB? Is the container running out of memory during the backup process and crashing?

    • iturnedintoanewt@lemm.eeOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      5 months ago

      The docker container where the DB lives has still another 2GB free to go (I’ll increase this). The pictures storage goes to a NAS drive with nearly 10TB of storage left. The docker container has 4GB RAM to run, only immich is running on this at this moment…I didn’t seen running too high just yet.

  • land@lemmy.ml
    link
    fedilink
    English
    arrow-up
    3
    arrow-down
    1
    ·
    edit-2
    5 months ago

    It happened to me as well. To resolve it, go to Administration > Jobs and apply them all available options. I had multiple issues, including this one, but resetting it from the Jobs page fixed it for me.

    • iturnedintoanewt@lemm.eeOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      5 months ago

      Thanks! I never walked through that screen yet…I’ll try that!

      EDIT: Seems…not to have done much. Backup keeps tracking and uploading a ton of files. Many more than what the server actually displays, as in, I’ve seen the backup go through pictures with dates the server doesn’t seem to show. I’ve seen it slowly go through at least 15-20 videos for example, but the server only acknowledges a grand total of 2 video assets.

      EDIT2: Oops, seems the screen eventually turned off and backup stalled…Let’s see what it does now… …aaaand back to May 25th. Yup, still the same problem here :(

      • land@lemmy.ml
        link
        fedilink
        English
        arrow-up
        2
        ·
        5 months ago

        Another thing I was doing was to keep spamming the cancel button.

  • blotz@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    5 months ago

    What method are you using to mount the nas for immich. I ran into issues trying to mount my Nas using docker volume+sshfs but ran into zero problems using docker volume/cifs. With sshfs, immich would run until it suddenly stopped working and backups would constantly fail. Restarting the server would cause it to run for a little time longer.

    • iturnedintoanewt@lemm.eeOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      5 months ago

      I mean, the NAS is already mounted. It’s an NFS share, it gets mounted at boot, and it should be just another regular folder, transparent to docker (or anything else).

  • Decronym@lemmy.decronym.xyzB
    link
    fedilink
    English
    arrow-up
    1
    ·
    5 months ago

    Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I’ve seen in this thread:

    Fewer Letters More Letters
    HTTP Hypertext Transfer Protocol, the Web
    NAS Network-Attached Storage
    NFS Network File System, a Unix-based file-sharing protocol known for performance and efficiency
    nginx Popular HTTP server

    [Thread #772 for this sub, first seen 30th May 2024, 07:15] [FAQ] [Full list] [Contact] [Source code]