FATAL: role "root" does not exist

I followed the instructions to upgrade and now immich doesn't work anymore. Docker logs says "immich_server | 2025-05-22 16:25:32.525 UTC [107] FATAL: role "root" does not exist".
62 Replies
Immich
Immich6d ago
:wave: Hey @Logarithm, Thanks for reaching out to us. Please carefully read this message and follow the recommended actions. This will help us be more effective in our support effort and leave more time for building Immich :immich:. References - Container Logs: docker compose logs docs - Container Status: docker ps -a docs - Reverse Proxy: https://immich.app/docs/administration/reverse-proxy - Code Formatting https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline#h_01GY0DAKGXDEHE263BCAYEGFJA Checklist I have... 1. :blue_square: verified I'm on the latest release(note that mobile app releases may take some time). 2. :blue_square: read applicable release notes. 3. :blue_square: reviewed the FAQs for known issues. 4. :blue_square: reviewed Github for known issues. 5. :blue_square: tried accessing Immich via local ip (without a custom reverse proxy). 6. :blue_square: uploaded the relevant information (see below). 7. :blue_square: tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable (an item can be marked as "complete" by reacting with the appropriate number) Information In order to be able to effectively help you, we need you to provide clear information to show what the problem is. The exact details needed vary per case, but here is a list of things to consider: - Your docker-compose.yml and .env files. - Logs from all the containers and their status (see above). - All the troubleshooting steps you've tried so far. - Any recent changes you've made to Immich or your system. - Details about your system (both software/OS and hardware). - Details about your storage (filesystems, type of disks, output of commands like fdisk -l and df -h). - The version of the Immich server, mobile app, and other relevant pieces. - Any other information that you think might be relevant. Please paste files and logs with proper code formatting, and especially avoid blurry screenshots. Without the right information we can't work out what the problem is. Help us help you ;) If this ticket can be closed you can use the /close command, and re-open it later if needed.
Zeus
Zeus6d ago
you probably changed the image for the wrong container, you need to change it for the database
Logarithm
LogarithmOP5d ago
No description
Logarithm
LogarithmOP5d ago
my postgres apparently doesn't exist anymore I'll try to restore it I did nothing to delete it eh luckyly I had a backup there's nothing in /var/lib/postgresql/data now
Mraedis
Mraedis5d ago
No description
Mraedis
Mraedis5d ago
It sounds to me like you made a mistake
Logarithm
LogarithmOP5d ago
@Mraedis oops I'll try to restore the database as I'm met with a page as if I was to create a new admin user from a new install "gzip: /path/to/backup/dump.sql.gz: No such file or directory root@mephistos:/home/iammephisto/immich-app# gunzip --stdout "dump.sql.gz" | sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" | docker exec -i immich_postgres psql --dbname=postgres --username=postgres ERROR: syntax error at or near "Could" LINE 1: Could not check if docker-default AppArmor profile was loade... ^" yelp restoring database from backup please! much love! I've pruned everything, will try to re-launch fresh hopefully my database will reload correctly because the restore script doesn't work root@mephistos:/home/iammephisto/immich-app# gunzip --stdout "dump.sql.gz" \ | sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \ | docker exec -i immich_postgres psql --dbname=postgres --username=postgres ERROR: syntax error at or near "Could" LINE 1: Could not check if docker-default AppArmor profile was loade... ^
Mraedis
Mraedis5d ago
This is an apparmor+docker problem
Zeus
Zeus5d ago
Please post the output of your backup dump. I fear it might not exist
Mraedis
Mraedis5d ago
You're running docker exec -i but apparmor is preventing it
Zeus
Zeus5d ago
You’ll have to un gzip it and look at the file Looks more to me like Postgres is trying to read the word Could from the dump…
Mraedis
Mraedis5d ago
That or that is literally what is inside the .gz file like ZEus says
Logarithm
LogarithmOP5d ago
You want me to unzip my backup dump? I'll try.
Mraedis
Mraedis5d ago
it's quite literally gunzip dump.sql.gz
Logarithm
LogarithmOP5d ago
oh no the dump.sql file is "Could not check if docker-default AppArmor profile was loaded: open /sys/kernel/security/apparmor/profiles: no such file or directory" fk I found another backup from yesterday
Mraedis
Mraedis5d ago
I don't fully understand how /var/lib/postgresql/data was wiped here though, if the directory is not empty it shouldn't have started at all
Logarithm
LogarithmOP5d ago
I'll give it a shot bash: cd: /var/lib/postgresql/data: No such file or directory yeah that but my postres is stored in my immich folder
Mraedis
Mraedis5d ago
That's DB_DATA_LOCATION
Logarithm
LogarithmOP5d ago
maybe I should change that
Mraedis
Mraedis5d ago
It's not literally /var/lib/postgresql/data
Logarithm
LogarithmOP5d ago
DB_DATA_LOCATION=/mnt/immich/Immich/postgres
Mraedis
Mraedis5d ago
Yeah so what's inside there
Logarithm
LogarithmOP5d ago
@Mraedis
No description
Logarithm
LogarithmOP5d ago
I managed to run the backup restore script from a backup from 2 days ago I'll have to do some cleanup
Logarithm
LogarithmOP5d ago
No description
Logarithm
LogarithmOP5d ago
damn my library was apparently wiped somehow I had a backup tho weird tho does docker compose down -v clear the library folder?
Mraedis
Mraedis5d ago
No, but why are you doing -v
Logarithm
LogarithmOP5d ago
it's what the doc says https://immich.app/docs/administration/backup-and-restore I should be fine I'll copy my backup files and restore the database again
Mraedis
Mraedis5d ago
Are you sure the locations were wiped
Logarithm
LogarithmOP5d ago
yep absolutely sure
Mraedis
Mraedis5d ago
Because there is no mechanism in immich that does that
Logarithm
LogarithmOP5d ago
I don't know what did it tbh I did change the location in the .env file for the library however
Mraedis
Mraedis5d ago
So what's at the old location?
Logarithm
LogarithmOP5d ago
nothing was left either very strange I don't know if the database will expect files to be at the old location or if it will assume the new location wdyt
Mraedis
Mraedis5d ago
It will assume them to be at UPLOAD_LOCATION So whatever the env is at
Logarithm
LogarithmOP5d ago
thanks this is my last shoit shot ewww not even loading the webpage now let me check logs AND it wiped my library again? wth I had just copied it back (10gb) lucky I don't have my 100GB backup on there lol
Zeus
Zeus5d ago
Immich doesn’t wipe libraries. I suspect there’s a large misunderstanding or error on your part as the admin, sorry
Logarithm
LogarithmOP5d ago
I understand what you mean. I'll re-upload the files and attempt another database restore, see what happens.
Logarithm
LogarithmOP5d ago
So, my database name in my .env says this:
No description
Logarithm
LogarithmOP5d ago
the restore script says database name is postgres should I replace it with immich "" --dbname=postgres --username=<DB_USERNAME> "" that might actually help if the restore script runs with whatever default parameters immich installs 😛
Zeus
Zeus5d ago
No, you should not change it from Postgres
Logarithm
LogarithmOP5d ago
ah I'm lost tbh is this not ok? ''gunzip --stdout "dump.sql.gz" \ | sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" \ | docker exec -i immich_postgres psql --dbname=postgres --username=postgres'' immich server keeps restarting 2240434a07af ghcr.io/immich-app/immich-server:release "tini -- /bin/bash s…" 5 minutes ago Restarting (1) 30 seconds ago immich_server now is the postgres restarting omg 8323206076ff ghcr.io/immich-app/postgres:16-vectorchord0.3.0-pgvectors0.3.0 "/usr/local/bin/immi…" About a minute ago Restarting (1) 27 seconds ago immich_postgres root@mephistos:/home/iammephisto/immich-app# gunzip --stdout "dump.sql.gz" | sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" | docker exec -i immich_postgres psql --dbname=postgres --username=postgres Error response from daemon: Container fd0a2ce896d7b87ad2bc6b0f51b964d46744e9bab6cad183faf14119add22099 is restarting, wait until the container is running last question, this aint working: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9e40a71915f3 ghcr.io/immich-app/immich-server:release "tini -- /bin/bash s…" 4 minutes ago Restarting (1) 57 seconds ago immich_server is immich-server:release not the right image? Immich server really doesn't want to run anymore pi:StorageService] Verifying system mount folder checks, current state: {"mountChecks":{"thumbs":true,"upload":true,"backups":true,"library":true,"profile":true,"encoded-video":true}} immich_server | [Nest] 17 - 05/22/2025, 10:08:36 PM ERROR [Api:StorageService] Failed to read upload/encoded-video/.immich: Error: ENOENT: no such file or directory, open 'upload/encoded-video/.immich' immich_server | api worker exited with code 1 It's in my upload/encoded-video folder tho Permissions maybe? I mean like /mnt/immich/Immich/upload/... immich_server | [Nest] 17 - 05/22/2025, 10:24:39 PM ERROR [Api:StorageService] Failed to read upload/encoded-video/.immich: Error: ENOENT: no such file or directory, open 'upload/encoded-video/.immich' immich_server | api worker exited with code 1 immich_server | Initializing Immich v1.133.0 immich_server | Detected CPU Cores: 4 root@mephistos:/home/iammephisto/immich-app# Tried to fix permissions
NoMachine
NoMachine5d ago
because you have to copy the files back
Logarithm
LogarithmOP5d ago
I did
NoMachine
NoMachine5d ago
not everything, because immich is telling you .immich doesn't exists
Logarithm
LogarithmOP5d ago
Ohhhhhhhh Apparently uploaded video was not part of upload Let me try Thats my .env
Logarithm
LogarithmOP5d ago
No description
Logarithm
LogarithmOP5d ago
I still get immich_server | [Nest] 17 - 05/22/2025, 10:59:41 PM ERROR [Api:StorageService] Failed to read upload/encoded-video/.immich: Err
Logarithm
LogarithmOP5d ago
No description
Logarithm
LogarithmOP5d ago
It's there tho
NoMachine
NoMachine5d ago
humm, but your env says library not upload
Logarithm
LogarithmOP5d ago
Holy shit more fk
Logarithm
LogarithmOP5d ago
No description
Logarithm
LogarithmOP5d ago
@NoMachine i switched from regular uploads to the other method, it keeps some files in the upload directory but classifies all new files in library under ur username
NoMachine
NoMachine5d ago
can you share your compose ?
Logarithm
LogarithmOP5d ago
Sure
Logarithm
LogarithmOP5d ago
@NoMachine there you go
NoMachine
NoMachine5d ago
ok, it looks pretty standard, and also, all your files should be moved to /mnt/immich/Immich/library since that what you have in your env inside that folder should be upload,library,thumbs,encoded-video,etc now, the connection error, is the database running? try restarting docker compose down && docker compose up -d --pull and post the output docker ps
Logarithm
LogarithmOP5d ago
I think it's my hdd that might have physically unmounted I'll check tomorrow. Strange but possible. allright, I managed to restore my DB, turns out my drive had disconected because of shock protection I had to reboot it and everything is back to normal now

Did you find this page helpful?