New install: Postgres doesn't appear to be running
Re-installing on a debian setup on pi.
On running web client:
500 connect ECONNREFUSED 172.19.0.8:3001
Seems to me that there should be ports assigned to postrges:14-alpine ?


318 Replies
@jrasm91 are you able to assist on this?
Immich-server logs?
Error: getaddrinfo ENOTFOUND immich_postgres
immich_server | at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26)
immich_server | [Nest] 6 - 10/17/2023, 12:46:05 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...

And your env?
Is the database just not starting?

What are in the database logs?
whats the command to just view the db logs
docker compose logs database

there was a chown error at the end of the install script
It needs to own the postgree directory
error was "/media/michael/IMMICHMSTR/immich/library: operation not permitted"
What are the permissions on your database volume mount?

i actually have no idea where the database is b'cause that database folder is empty
this is the relevant section from the .yml

I thought the intention was to have the database reside on the volume that is the ssd drive, i.e /media/michael/IMMICHMSTR/immich/database
(from the conversation with @Daniel yesterday)
Where are you running the docker compose command from? What directory?
/media/michael/IMMICHMSTR/immich
Oh just saw your other message
Ok
even though I ran the compose with sudo - I got this on the initial build... Error response from daemon: error while creating mount source path '/media/michael/IMMICHMSTR/immich/library': chown /media/michael/IMMICHMSTR/immich/library: operation not permitted
The folder is empty because it can't be initialized yet
For the database folder
so what i did then was https://docs.docker.com/engine/install/linux-postinstall/#:~:text=If%20you%20don't%20want,members%20of%20the%20docker%20group.
now i can run docker commands without sudo
but i didnt know how to re-run the build
as when i do compose up - d now - it all looks fine
but yes i think a step in creating the db was skipped becuase of the " error while creating mount source path"
should i just purge and rebuild?
No
Can you show me the fstab entry for the mount?
sorry linux newb - how do I do thaat?
Idk lol
cat /etc/fstab ?

Two things, the volume mount might just be wrong or you actually have a permission issue. A bad mount would mean it is perpetually not writable.
i just made a folder as a test
worked fine

so no issues writing to that database folder
there was a permissions issue when i ran the initial sudo docker compose - d
as i mentioned - not sure why - becuase it was ran as superuser
so whatever happens in the script from that point where it failed never happened
Weird.
hence my asking maybe its best for me to purge and re-run now that i have given permissions to all users
here is another thought - I might not have a root user
is that possible?
I don't think so
when i made the pi image i specified my name as the root user - so maybe there is no "root" user
how do i chack that
check
hmm

seems to be
Have you restarted since installing docker?
nope
Worth a shot. Sometimes docker is a bit weird with permissions after the initial install
ok rebooting
ok no difference

Still same permission error?
see how postgres just says "starting"
not running
Right

yeah still same
I'm not sure, I can take another look tomorrow.
ok no worries thanks for your time!
i'll keep palying
maybe try to recreate container, since you created it as a root user?
docker compose up -d --force-recreate --remove-orphans
After that, you can check if the directory mounted with proper permissions inside the container
docker exec immich_postgres "ls -lan /var/lib/postgresql/data"
sometimes a "hard reset" like that works
docker compose down -v --remove-orphans
docker compose up -d
I just did a clean install of the o/s and then after installing docker too the steps it reccomded to Manage Docker as a non-root user
then i ran the immich build and it went through with no errors!

oh - still the same issue

man this is so frustrating
i am following all the strps
steps
it was easier to install on the mac docker desktop app
why is the chown command failing for the db - that is the question
what is ' docker exec immich_postgres "ls -lan /var/lib/postgresql/data ' meant to do as it seems to do nothing
it should show you permissions for the data directory, and its contents
it just returns ">"
I forgot the "
now, try it
if you are sstuck on ">" just Ctrl + C


do again
ls -lan
in your directory
can you mount a volume to your database instead?
surely many have trodden in this path before me - I just dont get how on a clean install using reccomended scripts I am hitting this wall? š¦
I dont know how
as in happy to but I need guidnace on that
np
instead
- ./database: ...
do a
- database: ...
without the ./
now, on the bottom, find volumes:
and add one more, called database
after all is done, docker compose up -d --force-recreate
ok that was a reccomendation from daniel..

but clearly that ain't working so I will take the steps you just mention
Have you tried running sudo chown on the directory yourself?
nope
I think it needs to be owned by root instead of your user for it to work.
should I try that first
before the change to the yml
yeah, wouldnt hurt
ok sorry what would the specifc command be
sudo chown root:root ./database

you are not in the sudoers
all my other sudo s have worked
i can try it as root
hmm, maybe you are
stop the container database first
docker compose down

ahh ok yep
if you switch to root user, there is no need to use sudo
yep got that sorry i cut and paste it
š
as sudo stand for Super User DO
np
yup
You know what
I think your file system is read only still. Can you create a file in that folder?
The permissions are only r-x for user and group

rwx for user
For group and everyone
well he downloaded compose and stuff


alright, try the volume thingy now
that's some dark magic there
wait a sec, I see it now
OMG
try this now?
you don't have root permissions
no no no
your system is badly set up
you are root user, creating folders, but they are owned my "michael"
so you aren't really a root user
ok yeah thats an rpi default image thing
Can you stop and rrmove the stack, delete the database directory and try to start it again?
or do i just create a root user and login as that
It should create it and it should just work. I don't understand why it is running into this error or why the directory is owned not by root
this is where you did no-no
if it asks you for a name, just give it your name
a root user should be left alone
well actually no that was an error - the root user still exists - I thought that was the case then but have read up on it

i could do this
Did you manually create the database folder? I'd delete it and restart the stack first.
where is this from?
The Pi Hut
How to Change the Default Account Username and Password
By default your Raspberry Pi comes with an account 'pi' with the password 'raspberry'. For security reasons it's probably a good idea to change the password, but you may also wish to change the username as well. There are a couple of different ways to change the default username but I found the following method the eas

i actually cant recall I think i might have whne the disk was plugged into my PC
so that could be an issue
let me delete the database folder
and create it again
rm -r ./database
ok done that

sudo cat /etc/sudoers

looks alright
Can you start docker compose without creating the folder?
okay, lets do a database directory elsewhere?
let me try that
so delete the database folder
then do a compuse
ok that was interesting
This looks more and more like a filesystem problem to me

ok but this is a 2nd new install of the o/s so i am not sure how or why there should be a filesystem issue
Output of du and lsblk?
your SD card could be corrupted
differnt sd card
same thing last time
did you try to run it with a volume tho
You could always comment out the volume entirely.
oh, btw that last command DID acgtually create the database folder
No persistence to see if it works at all
.
With what permissions?
so this Error response from daemon: error while creating mount source path '/media/michael/IMMICHMSTR/immich/database': chown /media/michael/IMMICHMSTR/immich/database: operation not permitted
it did create the database folder before that
as part of the compose -up
yeah, the problem is not with creating the folder but changing its owner

no havent yet
just try to run it without persistence first
without volumes I mean
so so steps to do that would be to edit the yml as you mentioned before?
just a database without any volumes for now
sorry need more specifics
paste your compose, the database part

It's harder to edit but alright,
comment out with #

yea, lets go
daniel asked me to remove the pgdata in the "volumes" at the very bottom of the file too if that is relevant
not relevant
ok
so whats next - compose down
so you did have the same problem using the pgdata volume?
and then compose up?
no i never tried an install with the standard yml in this build
daniel suggested i mod the file so that the setup will be portable as I have ordered a new box to move this install onto
so i wanted an easy to move instance of immich
so much for portable then
it's still possible to easily move the database using volumes, I'm doing it that way
ok
yea, do the composeup
so compose down and force a rebuild?
or just a usual compose up -d
rebuild? we're not building anything
docker compose up -d --force-recreate
if you want to be sureyeah i meant that
recreate not rebuild
i'ldd just do basic up -d first
ok worked it seems
FFS

so why was that
such an issue

thank you murek
Some strange permission issues. Maybe just use a database volume mount and call it a day for now lol
we're not done yet, after restart you won't have your account and config
does it mean the DB is on the pi SD card though?
you have to attach the pgdata volume, as it was at beginning. It will be then on the SD card. Don't worry, it's not that big
the
pg_dumpall
will help you move data, when your hardware arrives, the procedure is there https://documentation.immich.app/docs/administration/backup-and-restoreBackup and Restore | Immich
Database
I dont have one... I lost it all b'cuase Mac docker sucks
i am starting from zero again
well yes, but I mean you want to persist your data from now on?
mac docker operates in a VM and the VM image has all my data, but we couldn't mount the image to get the db files
How it is set up right now if you recreate the container you lose your database so you should add back the volume mount how you had it on your Mac with pgdata:/...
@murek do you want to have a crack at that? (trying to mount the docker VM disk image?)
EZ
just kidding, never done that
oh lol you had me exicted for a min
don't delete it yet, there is this
volumes_from
command that could come in handy
well I could have crack at that, but later. Imma head out it's 6AM hereso you mean UNDO these mods...

yea, you're switching from
./database
to pgdata
Correct since we can't get past your permission issues
ok so restore the yml to what it was with pgdata and then down and up
ok
Yup

correct?
yes
boom

ok so i can work with this now and start importing all my assets again?
Yup
and when i get new machine we'll be able to migrate the DB even though its on the pi SD card?
Maybe wait until the import is done before you start sorting
Correct
yeah i will turn off all ML stuff
yes, you can try exporting now, if you want to be sure
wont do any "work" such as faces or albums
well there aint anyting to export yet š
there are some tables for sure
true
i trust you guys š
i'll get my CLI upload running
and leave it for a day
whats the linu
linux command for disk space DF?

can either of you let me know what is the space left on the pi os sd?
40% of 32gb i guess
12.8 gb
11.5 gb
hmm
my last database was 6gb i think
ok thanks again guys
man what a polava
du -hs .
that's a lot of photosi had 160,000 in there
2tb assets
DAMN
alright, manually create a directory "backups" and let's bind mount it. Let's try to do a backup
yeah lost the DB - it was about 5 days of work
here is the thread if you are interested https://discord.com/channels/979116623879368755/1163189245138186340
ok sure - where should i make the backup dir on the external ssd?
next to your compose file
it's just for testing
done
an then add it to your db

It didn't need to be mounted

ahh need colon
colon added

well, we're trying to see if we can access it from the host
done
yea, and just do
docker compose up -d
But why did it need to be mounted?
down first or just up
You can pipe pgdumpall to stdout
we're trying do do a database dump, for backup purposes
oh yea
forgot about that
Yes. You don't need a coming mount for this
Or, just use the backup container
then
docker exec -t immich_postgres pg_dumpall -c -U postgres | gzip > "./backup.sql"
.SQL.gz really since it is gzipped
right, maybe without gz for now, because we just want to see if it works

docker exec -t immich_postgres pg_dumpall -c -U postgres > "./backup.sql"
backup.sql is there but not in the backusp folder
forget the folder, it's not necessary
Cd the backup folder and run the command there instead

worked
Actually heading to bed now lol
many thanks for all your help š
@jerkyman are you interested in seeing if we can get the old database back from the mac docker VM disk image?
or not
yea, but later. I'm going to uni soon
ok cool, be intersting to see
if we can...
thanks again ttyl hit me up when you want to look
After all that I had to abandon the pi
the SSD kept giving i/o errors and dropping out
i tried three different usb cases for it
and also tried going via a powered USB 3.0 hub (thinking maybe pi was not giving it enought power)
But nope, couldn't keep it from giving errors. Drive is perfect plugged back into my PC. So..... I am back to MAC
@jerkyman @jrasm91 @Daniel I am getting great performance!!!!!!

FML
it should be blisteringly fast SSD to SSD
Oh no... I was seeing the notification
I am getting great performance!!!!!!without the image and I was like "Oh yay, a ping from you and it isn't bad news!" Well, turns out it is bad news :( May I ask what SSD you've got?
SAMSUNG QVO 870 4TB
oh man @Daniel that reccomendation you made to put - ./database: in the yml to try to get it to set up the db on the drive was a nightmare
I've read about this, yes
so that took half the day then the pi giving issues took another few hours
Although the issue is very likely with file stuff and not the actual change
and now i have gone back to mac
and along with slow speeds, i get these

I mean that ssd is pretty shitty and definitely not "blisteringly fast", but it should perform better than 7MB lol
i was getting these all the time which is why it took 7 days or so to get all my data in there
Huh? Could you scroll down a little?
uploads just suddenly fall over and print 100s of lines. I showed it to @Alex when I first saw that behaviour he was aware of it
Keep in mind that just pinging everyone all the time can be pretty annoying...
Especially since Alex doesn't need to look at this
i just mentioned him b'cause he's aware of it and might want to add something
but yes noted thanks
I think if he mentioned that's fine, we simply don't need to care about it :)
so thats an issue with the upload script not failing gracefully
So it didn't complete, correct?
Only ~80% got transfered and then it died
nope, so what i do is run the exact same import again, and it will get further and die again at some point
this is why it took me soooo long to get my 190,000 assets in
and why i was heartbroken to lose the DB
I think the cli is about to be refactored pretty soon...
i think i should wait until the upload script is fixed maybe, is that being worked on?
Is it possible that it isn't handling duplicates very well?
https://github.com/immich-app/immich/pull/4434
well that folder i was importing from was an OUTPUT asset folder from my old installation - so it should be perfefct with no dupes or weirdness
Yeah ok, that's fine
i just took the year 2020 as a test
Any server logs while uploading?
whats the log command again? the docker gui is dead
docker logs immich_server ?
Yep
no output from that command
docker ps

just a cursor
Oh, I think that's the reason why the upload is failing...
Can you reach Immich?
nope she's dead
ok makes sense
docker crashes and then the upload routine has noone to talk to
Exactly
sigh
ok giving up on mac docker a 2nd time
what a p.o.s
So that the only "issue" with the cli is that it isn't handling a connection loss very gracefully
Yeah... Sorry that you have such a bad experience with docker and therefore with Immich as well... :(
yes
be nice for it to gracefully say - lost connection to docker.. aborting
Yeah...
That's something the new cli will probably do
ok just for shits and giggles I am going to try docker on windows
becuase when you have lost 5 days of your life on soemthing now is not the time to give up!
at least i can now get containers running in no time at all š
I honestly don't think you want to do this...
a) does docker on windows also just spin up a VM, b) is windows really not meant to be running docker
Actually, your best bet would probably be to install docker on wsl lmao
actually wsl is just installing now as part of the docker install
Oh ok
so it must use it
Apparently, yes
Tbh I still don't get why you had that many issues with your drives on debian
i am not worried about it being in a VM now that I exectued a practive backup with the help of murek
was very strange
ok immich up and running already on windows docker!
let's see how this goes
happy to report it is going sooo much faster on windows docker, and the machine is only an surface 4 i5 7th gen with only 8gb ram
wow
Funny ok
Are you uploading to localhost now?
So same machine running immich and running the cli
yes was also uploading to local host on the mac too
same scenario
just mac docker issues I am sure - the mac m1 is a way faster machine
Ah ok, so you had two drives connected to the resepctive computer. The ssd for immich and another drive
ya
And the other drive is also a ssd I'm assuming?
its the 10TB usb 3.0 5400 rpm
but that is capable of 160MB/S
the ssd 500ish write
Got it ok
on mac it was doing 7 and on windows just now doing 60 sustained
I mean 60MB/s is still very bad, but that is probably the hard drive
I don't think you can get 160MB/s out of that...
yeah not on a no internal fan ancient surface tablet
lol
Oh wtf
i see what you mean about powershell its great at pretenting to be linux on the whole, until you try run a nodejs command
then it just says nup
but hysterically, old windows cmd runs the node stuff fine
I mean that was probably just some " missing or something
yes its very hot right now so will be throttling
It's just that I'm not used to powershell pretty much
It'll die lmao
powershell doesn't know how to deal with the command "immich"
so it doenst know where the script is maybe\
whereas in cmd.exe i can just type immich upload yada yada and it goes
so not sure on that
Hm this sounds weird
will need to work out where the immich script is? and maybe call it with a path?
I mean the PATH env should be the same, so idk
But as long as it works with cmd whatever, right?
ok I solved it
it was windows execution policies banning scripts
there is a command to run in powershell to ovveride it and allow scripts to be exectued by the current user š
working now
edge case obviously on windows powershell, but can probably be fixed, how to raise that as a ticket?
a) I don't understand why you're so worried that it will "fill the buffer up" and b) I would wait for the new CLI before reporting any bugs
Although it seems like this could even be just powershell being stupid, since it works in all other shells. So might even be we can't fix it at all
issue with powershell I believe, you can ignore it
yes likely
Dan comments re buffer are becuase there must be a line maximium before it runs out of ram or somewho cuases other failure
and i am doing 10 or 20 thousand pics in one upload so thats why i mention it
noted Alex its windows - edge case... but so far its performaing way better than mac docker so that is interesting. the machine is a solid state i5 tablet from 2017 too
It doens't need to store all lines, no?
It can just drop old ones
well it is cuasae the scroll bar shrinks more and more so i dont think it disposes of any
At some point it certainly will
If the powershell can run out of memory by having too many lines that would be ridiculous
man no wonder the pi struggled. this thing is sitting flatlining at 100% cpu and thats with the ML engine turned off!
how insane google is doing this for likley 20% of the entire world!
You should probably decrease the job concurrencies
yeah ok will put them all on 1
but now I know the windows setup was so easy and my son is away for a week - I might commandeer his 12th gen i9 with 32gb ram š
mwahahaha
lol
that should last until my mini pc arrives (which i checked out performs the i5 i am using now)
is that a yes!
omg i think it has to be done
will be the beefiest immich server ever
I don't think I can say yes or no to this :P
I would just ask him tbh
shit i'll whip out his HDD and install linux on it!!
Actually, I wouldn't say this with that much confidence. People have crazy homelabs!
he'll never know
lmao
i'll be able to get all my injestion done in a day!
Not with that poor hdd lol
But it would be much faster, yes
alot of it is on a nas with raid 10
Solved my thermal throttling!!

lol
OMG
that air purifier is pumping large volume of air haha its cool to the touch now whereas before it felt it was about to melt
CPU and memory both maxed
haha the poor little thing its been in a drawer for the past 5 years
back to using my sons beast - surely i can just set up a linux o/s on a usb drive and boot from that, therefore not needing to work out which of the 3 x m2 drives on his mainboard is the o/s drive.
prefer to not pull them out
Just install and run the docker machine learning container on it
ooo thats an idea too
i'll look into that
Got my son's i9 beast on injestion. It's fantastic, have done 25,000 assets in about 3 hours so far (all processed, too) š Speed and Power!