Immich-server.service failing repeatedly

I am currently in the process of setting up a server and wanted to get immich running. However, the “immich-server.service” keeps failing. Below are relevant snippets from my configuration aswell as some logs:

immich.nix, mostly just followed the wiki to set this up.

{ config, lib, pkgs, modulesPath, ... }:

{ 
  services.immich = {
	enable = true;
	port = 2283;
	host = "0.0.0.0";
	openFirewall = true;
	mediaLocation = "/mnt/data/immich";
	machine-learning.enable = false;
  };

networking.firewall.allowedTCPPorts = [ 2283 ];

}

hardware-configuration.nix:

{ config, lib, pkgs, modulesPath, ... }:

{
  imports =
    [ (modulesPath + "/installer/scan/not-detected.nix")
    ];

  boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "ehci_pci" "usbhid" "usb_storage" "sd_mod" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-amd" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/6a7149ae-c064-4f48-86fb-bffe89b683ff";
      fsType = "ext4";
    };

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/D714-C111";
      fsType = "vfat";
      options = [ "fmask=0077" "dmask=0077" ];
    };

  swapDevices =
    [ { device = "/dev/disk/by-uuid/95f0f0be-d198-4119-9ffa-23b0dc8699b0"; }
    ];

  fileSystems."/mnt/data" =
    { device = "/dev/disk/by-uuid/5b2cbbe5-8947-44ed-92f4-265962f1ff98";
      fsType = "ext4";
    };


  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

Only “/mnt/data” is relevant, which is an additional SSD I’ve mounted.

An excerpt of “journalctl -u immich-server.service”:

Apr 05 10:32:49 nix-server systemd[1]: immich-server.service: Failed with result 'exit-code'.
Apr 05 10:32:49 nix-server systemd[1]: immich-server.service: Consumed 30.135s CPU time, 449.3M memory peak.
Apr 05 10:32:52 nix-server systemd[1]: immich-server.service: Scheduled restart job, restart counter is at 64.
Apr 05 10:32:52 nix-server systemd[1]: Started Immich backend server (Self-hosted photo and video backup solution).
Apr 05 10:32:59 nix-server immich[3648]: (node:3648) ExperimentalWarning: WASI is an experimental feature and might change at any time
Apr 05 10:32:59 nix-server immich[3648]: (Use `node --trace-warnings ...` to show where the warning was created)
Apr 05 10:33:00 nix-server immich[3648]: Starting api worker
Apr 05 10:33:00 nix-server immich[3648]: Starting microservices worker
Apr 05 10:33:10 nix-server immich[3648]: (node:3648) ExperimentalWarning: WASI is an experimental feature and might change at any time
Apr 05 10:33:10 nix-server immich[3648]: (Use `node --trace-warnings ...` to show where the warning was created)
Apr 05 10:33:10 nix-server immich[3648]: [Nest] 3648  - 05.04.2026, 10:33:10     LOG [Microservices:WebsocketRepository] Initialized websocket server
Apr 05 10:33:10 nix-server immich[3666]: (node:3666) ExperimentalWarning: WASI is an experimental feature and might change at any time
Apr 05 10:33:10 nix-server immich[3666]: (Use `node --trace-warnings ...` to show where the warning was created)
Apr 05 10:33:11 nix-server immich[3648]: [Nest] 3648  - 05.04.2026, 10:33:11     LOG [Microservices:DatabaseRepository] targetLists=1, current=1 for clip_index of 0 rows
Apr 05 10:33:11 nix-server immich[3648]: [Nest] 3648  - 05.04.2026, 10:33:11     LOG [Microservices:DatabaseRepository] targetLists=1, current=1 for face_index of 0 rows
Apr 05 10:33:11 nix-server immich[3648]: [Nest] 3648  - 05.04.2026, 10:33:11     LOG [Microservices:DatabaseRepository] Dropping pgvecto.rs extension
Apr 05 10:33:11 nix-server immich[3648]: Query failed : {
Apr 05 10:33:11 nix-server immich[3648]:   durationMs: 14.065164999999979,
Apr 05 10:33:11 nix-server immich[3648]:   error: PostgresError: must be owner of extension vectors
Apr 05 10:33:11 nix-server immich[3648]:       at ErrorResponse (file:///nix/store/qh9csgjgzbkkya57xskdpcs1fqraw7gd-immich-2.6.3/lib/node_modules/immich/node_modules/.pnpm/postgres@3.4.8/node_modules/postgres/src/connection.js:815:30)
Apr 05 10:33:11 nix-server immich[3648]:       at handle (file:///nix/store/qh9csgjgzbkkya57xskdpcs1fqraw7gd-immich-2.6.3/lib/node_modules/immich/node_modules/.pnpm/postgres@3.4.8/node_modules/postgres/src/connection.js:489:6)
Apr 05 10:33:11 nix-server immich[3648]:       at Socket.data (file:///nix/store/qh9csgjgzbkkya57xskdpcs1fqraw7gd-immich-2.6.3/lib/node_modules/immich/node_modules/.pnpm/postgres@3.4.8/node_modules/postgres/src/connection.js:324:9)
Apr 05 10:33:11 nix-server immich[3648]:       at Socket.emit (node:events:519:28)
Apr 05 10:33:11 nix-server immich[3648]:       at addChunk (node:internal/streams/readable:561:12)
Apr 05 10:33:11 nix-server immich[3648]:       at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
Apr 05 10:33:11 nix-server immich[3648]:       at Readable.push (node:internal/streams/readable:392:5)
Apr 05 10:33:11 nix-server immich[3648]:       at Pipe.onStreamRead (node:internal/stream_base_commons:189:23) {
Apr 05 10:33:11 nix-server immich[3648]:     severity_local: 'ERROR',
Apr 05 10:33:11 nix-server immich[3648]:     severity: 'ERROR',
Apr 05 10:33:11 nix-server immich[3648]:     code: '42501',
Apr 05 10:33:11 nix-server immich[3648]:     file: 'aclchk.c',
Apr 05 10:33:11 nix-server immich[3648]:     line: '2952',
Apr 05 10:33:11 nix-server immich[3648]:     routine: 'aclcheck_error'
Apr 05 10:33:11 nix-server immich[3648]:   },
Apr 05 10:33:11 nix-server immich[3648]:   sql: 'DROP EXTENSION IF EXISTS vectors',
Apr 05 10:33:11 nix-server immich[3648]:   params: []
Apr 05 10:33:11 nix-server immich[3648]: }
Apr 05 10:33:11 nix-server immich[3648]: [Nest] 3648  - 05.04.2026, 10:33:11    WARN [Microservices:DatabaseService] The pgvecto.rs extension is no longer needed, but could not be dropped.
Apr 05 10:33:11 nix-server immich[3648]:     This may be because Immich does not have the necessary permissions to drop the extension.
Apr 05 10:33:11 nix-server immich[3648]:     Please run 'DROP EXTENSION vectors;' manually as a superuser.
Apr 05 10:33:11 nix-server immich[3648]:     See https://docs.immich.app/guides/database-queries for how to query the database.
Apr 05 10:33:11 nix-server immich[3648]: [Nest] 3648  - 05.04.2026, 10:33:11    WARN [Microservices:DatabaseService] PostgresError: must be owner of extension vectors
Apr 05 10:33:11 nix-server immich[3648]:     at ErrorResponse (file:///nix/store/qh9csgjgzbkkya57xskdpcs1fqraw7gd-immich-2.6.3/lib/node_modules/immich/node_modules/.pnpm/postgres@3.4.8/node_modules/postgres/src/connection.js:815:30)
Apr 05 10:33:11 nix-server immich[3648]:     at handle (file:///nix/store/qh9csgjgzbkkya57xskdpcs1fqraw7gd-immich-2.6.3/lib/node_modules/immich/node_modules/.pnpm/postgres@3.4.8/node_modules/postgres/src/connection.js:489:6)
Apr 05 10:33:11 nix-server immich[3648]:     at Socket.data (file:///nix/store/qh9csgjgzbkkya57xskdpcs1fqraw7gd-immich-2.6.3/lib/node_modules/immich/node_modules/.pnpm/postgres@3.4.8/node_modules/postgres/src/connection.js:324:9)
Apr 05 10:33:11 nix-server immich[3648]:     at Socket.emit (node:events:519:28)
Apr 05 10:33:11 nix-server immich[3648]:     at addChunk (node:internal/streams/readable:561:12)
Apr 05 10:33:11 nix-server immich[3648]:     at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
Apr 05 10:33:11 nix-server immich[3648]:     at Readable.push (node:internal/streams/readable:392:5)
Apr 05 10:33:11 nix-server immich[3648]:     at Pipe.onStreamRead (node:internal/stream_base_commons:189:23) {
Apr 05 10:33:11 nix-server immich[3648]:   severity_local: 'ERROR',
Apr 05 10:33:11 nix-server immich[3648]:   severity: 'ERROR',
Apr 05 10:33:11 nix-server immich[3648]:   code: '42501',
Apr 05 10:33:11 nix-server immich[3648]:   file: 'aclchk.c',
Apr 05 10:33:11 nix-server immich[3648]:   line: '2952',
Apr 05 10:33:11 nix-server immich[3648]:   routine: 'aclcheck_error'
Apr 05 10:33:11 nix-server immich[3648]: }
Apr 05 10:33:11 nix-server immich[3648]: [Nest] 3648  - 05.04.2026, 10:33:11     LOG [Microservices:DatabaseRepository] Running migrations
Apr 05 10:33:11 nix-server immich[3648]: [Nest] 3648  - 05.04.2026, 10:33:11     LOG [Microservices:DatabaseRepository] Finished running migrations
Apr 05 10:33:11 nix-server immich[3648]: [Nest] 3648  - 05.04.2026, 10:33:11     LOG [Microservices:DatabaseService] Checking for schema drift
Apr 05 10:33:11 nix-server immich[3648]: [Nest] 3648  - 05.04.2026, 10:33:11     LOG [Microservices:DatabaseService] No schema drift detected
Apr 05 10:33:11 nix-server immich[3648]: [Nest] 3648  - 05.04.2026, 10:33:11     LOG [Microservices:StorageService] Verifying system mount folder checks, current state: {"mountChecks":{}}
Apr 05 10:33:11 nix-server immich[3648]: [Nest] 3648  - 05.04.2026, 10:33:11   ERROR [Microservices:StorageService] Failed to create /mnt/data/immich/encoded-video/.immich: Error: EACCES: permission denied, mkdir '/mnt/data/immich/encoded-video'
Apr 05 10:33:11 nix-server immich[3648]: [Nest] 3648  - 05.04.2026, 10:33:11     LOG [Microservices:StorageService] Writing initial mount file for the encoded-video folder
Apr 05 10:33:11 nix-server immich[3648]: microservices worker error: Error: Failed to create "<UPLOAD_LOCATION>/encoded-video/.immich - Please see https://docs.immich.app/administration/system-integrity#folder-checks for more information.", stack: Error: Failed to create "<UPLOAD_LOCATION>/encoded-video/.immich - Please see https://docs.immich.app/administration/system-integrity#folder-checks for more information."
Apr 05 10:33:11 nix-server immich[3648]:     at StorageService.createMountFile (/nix/store/qh9csgjgzbkkya57xskdpcs1fqraw7gd-immich-2.6.3/lib/node_modules/immich/dist/services/storage.service.js:145:19)
Apr 05 10:33:11 nix-server immich[3648]:     at /nix/store/qh9csgjgzbkkya57xskdpcs1fqraw7gd-immich-2.6.3/lib/node_modules/immich/dist/services/storage.service.js:55:36
Apr 05 10:33:11 nix-server immich[3648]:     at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
Apr 05 10:33:11 nix-server immich[3648]:     at async /nix/store/qh9csgjgzbkkya57xskdpcs1fqraw7gd-immich-2.6.3/lib/node_modules/immich/dist/repositories/database.repository.js:392:27
Apr 05 10:33:11 nix-server immich[3648]:     at async /nix/store/qh9csgjgzbkkya57xskdpcs1fqraw7gd-immich-2.6.3/lib/node_modules/immich/node_modules/.pnpm/kysely@0.28.11/node_modules/kysely/dist/cjs/kysely.js:541:20
Apr 05 10:33:11 nix-server immich[3648]:     at async DefaultConnectionProvider.provideConnection (/nix/store/qh9csgjgzbkkya57xskdpcs1fqraw7gd-immich-2.6.3/lib/node_modules/immich/node_modules/.pnpm/kysely@0.28.11/node_modules/kysely/dist/cjs/driver/default-connection-provider.js:12:20)
Apr 05 10:33:11 nix-server immich[3648]:     at async /nix/store/qh9csgjgzbkkya57xskdpcs1fqraw7gd-immich-2.6.3/lib/node_modules/immich/dist/repositories/database.repository.js:389:13
Apr 05 10:33:11 nix-server immich[3648]: microservices worker exited with code 1
Apr 05 10:33:11 nix-server immich[3648]: Killing api process
Apr 05 10:33:12 nix-server systemd[1]: immich-server.service: Main process exited, code=exited, status=1/FAILURE
Apr 05 10:33:12 nix-server systemd[1]: immich-server.service: Failed with result 'exit-code'.

There are two error messages in here, one seems to be related to postgres, the other seems to be related to permissions:

something something vecto.rs:

Apr 05 10:33:11 nix-server immich[3648]: [Nest] 3648  - 05.04.2026, 10:33:11    WARN [Microservices:DatabaseService] The pgvecto.rs extension is no longer needed, but could not be dropped.
Apr 05 10:33:11 nix-server immich[3648]:     This may be because Immich does not have the necessary permissions to drop the extension.
Apr 05 10:33:11 nix-server immich[3648]:     Please run 'DROP EXTENSION vectors;' manually as a superuser.
Apr 05 10:33:11 nix-server immich[3648]:     See https://docs.immich.app/guides/database-queries for how to query the database.
Apr 05 10:33:11 nix-server immich[3648]: [Nest] 3648  - 05.04.2026, 10:33:11    WARN [Microservices:DatabaseService] PostgresError: must be owner of extension vectors

the second error message:

Apr 05 10:33:11 nix-server immich[3648]: [Nest] 3648  - 05.04.2026, 10:33:11   ERROR [Microservices:StorageService] Failed to create /mnt/data/immich/encoded-video/.immich: Error: EACCES: permission denied, mkdir '/mnt/data/immich/encoded-video'
Apr 05 10:33:11 nix-server immich[3648]: [Nest] 3648  - 05.04.2026, 10:33:11     LOG [Microservices:StorageService] Writing initial mount file for the encoded-video folder
Apr 05 10:33:11 nix-server immich[3648]: microservices worker error: Error: Failed to create "<UPLOAD_LOCATION>/encoded-video/.immich - Please see https://docs.immich.app/administration/system-integrity#folder-checks for more information.", stack: Error: Failed to create "<UPLOAD_LOCATION>/encoded-video/.immich - Please see https://docs.immich.app/administration/system-integrity#folder-checks for more information."

Now, since its complaining about missing permissions, I have tried to set “/mnt/data” to 755, although this didn’t change anything. Since I am not familiar with postgres, I neither have an idea which error caused which nor the confidence to manually mess around in the database.

This is an empty system, no data from previous installations, all drives have been wiped before installation and there is nothing that comes to my mind that could be interfering with immich.

I am on 25.11. The same setup worked on my previous installation on the same hardware without any issues. The only thing I changed is the disk currently mounted at “/mnt/data”.

What am I doing wrong here?

2 Likes

This is how I have set up postgres for immich and dawarich.

Immich was straight forward and is barely more than enabling it.

For using a different disk for data, I mount that at /var/lib/immich, in my experience just using the default location in /var/lib is much easier than figuring out what exact sandboxing settings you have to tweak in the service.

2 Likes

https://search.nixos.org/options?channel=unstable&query=services.immich.mediaLocation+&show=services.immich.mediaLocation

If it’s not the default, it has to be created manually, for example:

systemd.tmpfiles.settings.immich."/mnt/data/immich".d = {
  user = "immich";
  group = "immich";
  mode = "0700";
};

Does that help with the file permission error?

For the db extension error, follow Pre-existing Postgres | Immich.

I tried to setup a basic configuration of immich on a nixos-container yesterday and I had a similar issue with you. Outside the container, I run the same config on the server and seems to work properly.

Note: On that container I had set up immich long ago, but then deleted it. Outside the container, in the main system immich has been running for some months.

That issue may or may not be related: nixos/immich: does not create or chown mediaLocation when using mounted drive (e.g. /run/media/E) · Issue #491953 · NixOS/nixpkgs · GitHub