#New install: Postgres doesn't appear to be running

1 messages · Page 1 of 1 (latest)

left obsidian
#

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 ?

#

@dry geode are you able to assist on this?

dry geode
#

Immich-server logs?

left obsidian
#

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)...

dry geode
#

And your env?

#

Is the database just not starting?

left obsidian
dry geode
#

What are in the database logs?

left obsidian
#

whats the command to just view the db logs

dry geode
#

docker compose logs database

left obsidian
#

there was a chown error at the end of the install script

dry geode
#

It needs to own the postgree directory

left obsidian
#

error was "/media/michael/IMMICHMSTR/immich/library: operation not permitted"

dry geode
#

What are the permissions on your database volume mount?

left obsidian
#

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 @mellow spindle yesterday)

dry geode
#

Where are you running the docker compose command from? What directory?

left obsidian
#

/media/michael/IMMICHMSTR/immich

dry geode
#

Oh just saw your other message

#

Ok

left obsidian
#

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

dry geode
#

The folder is empty because it can't be initialized yet

#

For the database folder

left obsidian
#

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?

dry geode
#

No

#

Can you show me the fstab entry for the mount?

left obsidian
#

sorry linux newb - how do I do thaat?

dry geode
#

Idk lol

#

cat /etc/fstab ?

left obsidian
dry geode
#

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.

left obsidian
#

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

dry geode
#

Weird.

left obsidian
#

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?

dry geode
#

I don't think so

left obsidian
#

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

#

seems to be

dry geode
#

Have you restarted since installing docker?

left obsidian
#

nope

dry geode
#

Worth a shot. Sometimes docker is a bit weird with permissions after the initial install

left obsidian
#

ok rebooting

#

ok no difference

dry geode
#

Still same permission error?

left obsidian
#

see how postgres just says "starting"

#

not running

dry geode
#

Right

left obsidian
#

yeah still same

dry geode
#

I'm not sure, I can take another look tomorrow.

left obsidian
#

ok no worries thanks for your time!

#

i'll keep palying

marsh dew
#

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

left obsidian
#

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

left obsidian
marsh dew
#

it should show you permissions for the data directory, and its contents

left obsidian
#

it just returns ">"

marsh dew
#

I forgot the "

#

now, try it

#

if you are sstuck on ">" just Ctrl + C

left obsidian
marsh dew
#

do again ls -lan in your directory

left obsidian
marsh dew
#

can you mount a volume to your database instead?

left obsidian
#

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? 😦

left obsidian
#

as in happy to but I need guidnace on that

marsh dew
#

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

left obsidian
#

ok that was a reccomendation from daniel..

#

but clearly that ain't working so I will take the steps you just mention

dry geode
#

Have you tried running sudo chown on the directory yourself?

left obsidian
#

nope

dry geode
#

I think it needs to be owned by root instead of your user for it to work.

left obsidian
#

should I try that first

#

before the change to the yml

marsh dew
#

yeah, wouldnt hurt

left obsidian
#

ok sorry what would the specifc command be

marsh dew
#

sudo chown root:root ./database

left obsidian
marsh dew
#

you are not in the sudoers

left obsidian
#

all my other sudo s have worked

#

i can try it as root

marsh dew
#

hmm, maybe you are

#

stop the container database first docker compose down

left obsidian
left obsidian
marsh dew
#

if you switch to root user, there is no need to use sudo

left obsidian
#

yep got that sorry i cut and paste it

#

🙂

marsh dew
#

as sudo stand for Super User DO

#

np

left obsidian
#

yup

dry geode
#

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

left obsidian
marsh dew
#

rwx for user

dry geode
#

For group and everyone

marsh dew
#

well he downloaded compose and stuff

left obsidian
marsh dew
#

alright, try the volume thingy now

marsh dew
#

wait a sec, I see it now

#

OMG

left obsidian
marsh dew
#

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

left obsidian
#

ok yeah thats an rpi default image thing

dry geode
#

Can you stop and rrmove the stack, delete the database directory and try to start it again?

left obsidian
#

or do i just create a root user and login as that

dry geode
#

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

marsh dew
#

if it asks you for a name, just give it your name

#

a root user should be left alone

left obsidian
#

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

dry geode
#

Did you manually create the database folder? I'd delete it and restart the stack first.

marsh dew
left obsidian
left obsidian
#

so that could be an issue

#

let me delete the database folder

#

and create it again

marsh dew
#

rm -r ./database

left obsidian
#

ok done that

marsh dew
#

sudo cat /etc/sudoers

left obsidian
marsh dew
#

looks alright

dry geode
marsh dew
#

okay, lets do a database directory elsewhere?

left obsidian
#

so delete the database folder

#

then do a compuse

#

ok that was interesting

dry geode
#

This looks more and more like a filesystem problem to me

left obsidian
#

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

dry geode
#

Output of du and lsblk?

marsh dew
#

your SD card could be corrupted

left obsidian
#

differnt sd card

#

same thing last time

marsh dew
#

did you try to run it with a volume tho

dry geode
#

You could always comment out the volume entirely.

left obsidian
#

oh, btw that last command DID acgtually create the database folder

dry geode
#

No persistence to see if it works at all

dry geode
left obsidian
#

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

marsh dew
#

yeah, the problem is not with creating the folder but changing its owner

left obsidian
left obsidian
marsh dew
#

just try to run it without persistence first

#

without volumes I mean

left obsidian
#

so so steps to do that would be to edit the yml as you mentioned before?

marsh dew
#

just a database without any volumes for now

left obsidian
#

sorry need more specifics

marsh dew
#

paste your compose, the database part

left obsidian
marsh dew
#

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

  #- ./database:/var...
left obsidian
marsh dew
#

yea, lets go

left obsidian
#

daniel asked me to remove the pgdata in the "volumes" at the very bottom of the file too if that is relevant

marsh dew
#

not relevant

left obsidian
#

ok

#

so whats next - compose down

marsh dew
#

so you did have the same problem using the pgdata volume?

left obsidian
#

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

marsh dew
#

so much for portable then

#

it's still possible to easily move the database using volumes, I'm doing it that way

left obsidian
#

ok

marsh dew
left obsidian
#

so compose down and force a rebuild?

#

or just a usual compose up -d

marsh dew
#

rebuild? we're not building anything
docker compose up -d --force-recreate if you want to be sure

left obsidian
#

yeah 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

dry geode
#

Some strange permission issues. Maybe just use a database volume mount and call it a day for now lol

marsh dew
#

we're not done yet, after restart you won't have your account and config

left obsidian
#

does it mean the DB is on the pi SD card though?

marsh dew
#

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

left obsidian
#

i am starting from zero again

marsh dew
#

well yes, but I mean you want to persist your data from now on?

left obsidian
#

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

dry geode
#

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:/...

left obsidian
#

@murek do you want to have a crack at that? (trying to mount the docker VM disk image?)

marsh dew
#

EZ

#

just kidding, never done that

left obsidian
#

oh lol you had me exicted for a min

marsh dew
#

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 here

left obsidian
marsh dew
#

yea, you're switching from ./database to pgdata

dry geode
#

Correct since we can't get past your permission issues

left obsidian
#

ok so restore the yml to what it was with pgdata and then down and up

#

ok

dry geode
#

Yup

left obsidian
#

correct?

marsh dew
#

yes

left obsidian
#

ok so i can work with this now and start importing all my assets again?

dry geode
#

Yup

left obsidian
#

and when i get new machine we'll be able to migrate the DB even though its on the pi SD card?

dry geode
#

Maybe wait until the import is done before you start sorting

left obsidian
#

yeah i will turn off all ML stuff

marsh dew
left obsidian
#

wont do any "work" such as faces or albums

left obsidian
marsh dew
#

there are some tables for sure

left obsidian
#

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

marsh dew
#

du -hs .

marsh dew
left obsidian
#

i had 160,000 in there

#

2tb assets

marsh dew
#

DAMN

#

alright, manually create a directory "backups" and let's bind mount it. Let's try to do a backup

left obsidian
#

yeah lost the DB - it was about 5 days of work

left obsidian
marsh dew
#

next to your compose file

#

it's just for testing

left obsidian
#

done

marsh dew
#

an then add it to your db

dry geode
#

It didn't need to be mounted

left obsidian
#

ahh need colon

#

colon added

marsh dew
left obsidian
#

done

marsh dew
#

yea, and just do docker compose up -d

dry geode
#

But why did it need to be mounted?

left obsidian
#

down first or just up

dry geode
#

You can pipe pgdumpall to stdout

marsh dew
#

we're trying do do a database dump, for backup purposes

#

oh yea

#

forgot about that

dry geode
#

Yes. You don't need a coming mount for this

#

Or, just use the backup container

marsh dew
#

then docker exec -t immich_postgres pg_dumpall -c -U postgres | gzip > "./backup.sql"

dry geode
#

.SQL.gz really since it is gzipped

marsh dew
#

right, maybe without gz for now, because we just want to see if it works

left obsidian
marsh dew
#

docker exec -t immich_postgres pg_dumpall -c -U postgres > "./backup.sql"

left obsidian
#

backup.sql is there but not in the backusp folder

marsh dew
#

forget the folder, it's not necessary

dry geode
#

Cd the backup folder and run the command there instead

left obsidian
#

worked

dry geode
#

Actually heading to bed now lol

left obsidian
#

@marsh dew are you interested in seeing if we can get the old database back from the mac docker VM disk image?

#

or not

marsh dew
#

yea, but later. I'm going to uni soon

left obsidian
#

ok cool, be intersting to see

#

if we can...

#

thanks again ttyl hit me up when you want to look

left obsidian
#

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

#

@marsh dew @dry geode @mellow spindle I am getting great performance!!!!!!

#

FML

#

it should be blisteringly fast SSD to SSD

mellow spindle
#

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?

left obsidian
#

SAMSUNG QVO 870 4TB

#

oh man @mellow spindle 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

mellow spindle
#

I've read about this, yes

left obsidian
#

so that took half the day then the pi giving issues took another few hours

mellow spindle
#

Although the issue is very likely with file stuff and not the actual change

left obsidian
#

and now i have gone back to mac

#

and along with slow speeds, i get these

mellow spindle
left obsidian
#

i was getting these all the time which is why it took 7 days or so to get all my data in there

mellow spindle
left obsidian
#

uploads just suddenly fall over and print 100s of lines. I showed it to @solar marsh when I first saw that behaviour he was aware of it

mellow spindle
#

Keep in mind that just pinging everyone all the time can be pretty annoying...

#

Especially since Alex doesn't need to look at this

left obsidian
#

i just mentioned him b'cause he's aware of it and might want to add something

#

but yes noted thanks

mellow spindle
#

I think if he mentioned that's fine, we simply don't need to care about it :)

left obsidian
#

so thats an issue with the upload script not failing gracefully

mellow spindle
#

So it didn't complete, correct?

#

Only ~80% got transfered and then it died

left obsidian
#

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

mellow spindle
#

I think the cli is about to be refactored pretty soon...

left obsidian
#

i think i should wait until the upload script is fixed maybe, is that being worked on?

mellow spindle
#

Is it possible that it isn't handling duplicates very well?

left obsidian
#

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

mellow spindle
#

Yeah ok, that's fine

left obsidian
#

i just took the year 2020 as a test

mellow spindle
#

Any server logs while uploading?

left obsidian
#

whats the log command again? the docker gui is dead

#

docker logs immich_server ?

mellow spindle
#

Yep

left obsidian
#

no output from that command

mellow spindle
#

docker ps

left obsidian
#

just a cursor

mellow spindle
#

Oh, I think that's the reason why the upload is failing...

#

Can you reach Immich?

left obsidian
#

nope she's dead

#

ok makes sense

#

docker crashes and then the upload routine has noone to talk to

mellow spindle
#

Exactly

left obsidian
#

sigh

#

ok giving up on mac docker a 2nd time

#

what a p.o.s

mellow spindle
#

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... :(

left obsidian
#

be nice for it to gracefully say - lost connection to docker.. aborting

mellow spindle
#

Yeah...

#

That's something the new cli will probably do

left obsidian
#

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 🙂

mellow spindle
#

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

left obsidian
#

actually wsl is just installing now as part of the docker install

mellow spindle
#

Oh ok

left obsidian
#

so it must use it

mellow spindle
#

Apparently, yes

#

Tbh I still don't get why you had that many issues with your drives on debian

left obsidian
#

i am not worried about it being in a VM now that I exectued a practive backup with the help of murek

left obsidian
#

ok immich up and running already on windows docker!

#

let's see how this goes

left obsidian
#

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

mellow spindle
#

Funny ok

#

Are you uploading to localhost now?

#

So same machine running immich and running the cli

left obsidian
#

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

mellow spindle
#

Ah ok, so you had two drives connected to the resepctive computer. The ssd for immich and another drive

left obsidian
#

ya

mellow spindle
#

And the other drive is also a ssd I'm assuming?

left obsidian
#

its the 10TB usb 3.0 5400 rpm

#

but that is capable of 160MB/S

#

the ssd 500ish write

mellow spindle
#

Got it ok

left obsidian
#

on mac it was doing 7 and on windows just now doing 60 sustained

mellow spindle
#

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...

left obsidian
#

yeah not on a no internal fan ancient surface tablet

#

lol

mellow spindle
#

Oh wtf

left obsidian
#

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

mellow spindle
#

I mean that was probably just some " missing or something

left obsidian
mellow spindle
#

It's just that I'm not used to powershell pretty much

mellow spindle
left obsidian
#

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

mellow spindle
#

Hm this sounds weird

left obsidian
#

will need to work out where the immich script is? and maybe call it with a path?

mellow spindle
#

I mean the PATH env should be the same, so idk

#

But as long as it works with cmd whatever, right?

left obsidian
#

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

left obsidian
#

edge case obviously on windows powershell, but can probably be fixed, how to raise that as a ticket?

mellow spindle
#

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

solar marsh
left obsidian
#

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

mellow spindle
#

It can just drop old ones

left obsidian
#

well it is cuasae the scroll bar shrinks more and more so i dont think it disposes of any

mellow spindle
#

At some point it certainly will

#

If the powershell can run out of memory by having too many lines that would be ridiculous

left obsidian
#

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!

dry geode
#

You should probably decrease the job concurrencies

left obsidian
#

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

mellow spindle
#

lol

left obsidian
#

that should last until my mini pc arrives (which i checked out performs the i5 i am using now)

left obsidian
#

omg i think it has to be done

#

will be the beefiest immich server ever

mellow spindle
#

I would just ask him tbh

left obsidian
#

shit i'll whip out his HDD and install linux on it!!

mellow spindle
left obsidian
#

he'll never know

left obsidian
#

i'll be able to get all my injestion done in a day!

mellow spindle
#

Not with that poor hdd lol

#

But it would be much faster, yes

left obsidian
#

alot of it is on a nas with raid 10

#

Solved my thermal throttling!!

#

lol

mellow spindle
#

OMG

left obsidian
#

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

dry geode
#

Just install and run the docker machine learning container on it

left obsidian
#

ooo thats an idea too

#

i'll look into that