rr- / szurubooru

Image board engine, Danbooru-style.
GNU General Public License v3.0
704 stars 178 forks source link

szuru_sql exits, PostgreSQL appears to contain a database #393

Closed y0nei closed 2 years ago

y0nei commented 3 years ago

i followed this video = https://www.youtube.com/watch?v=V73M_COXa5k&t=237s

My port in .env is 4040 I didint change the domain in config.yaml and didint change base_url=/ in .env

server_1  | standard_init_linux.go:207: exec user process caused "exec format error"
client_1  | standard_init_linux.go:207: exec user process caused "exec format error"
sql_1     |
sql_1     | PostgreSQL Database directory appears to contain a database; Skipping initialization
sql_1     |
sql_1     | 1970-04-27 10:17:12.009 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
sql_1     | 1970-04-27 10:17:12.009 GMT [1] LOG:  listening on IPv6 address "::", port 5432
sql_1     | 1970-04-27 10:17:12.009 GMT [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
sql_1     | 1970-04-27 10:17:12.009 GMT [1] LOG:  startup process (PID 20) was terminated by signal 11: Segmentation fault
sql_1     | 1970-04-27 10:17:12.009 GMT [1] LOG:  aborting startup due to startup process failure
sql_1     | 1970-04-27 10:17:12.009 GMT [1] LOG:  database system is shut down
sql_1     |
sql_1     | PostgreSQL Database directory appears to contain a database; Skipping initialization
szuru_client_1 exited with code 1
szuru_server_1 exited with code 1

and then like couple lines of this

sql_1     | PostgreSQL Database directory appears to contain a database; Skipping initialization
sql_1     |
sql_1     | 1970-04-27 10:17:12.009 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
sql_1     | 1970-04-27 10:17:12.009 GMT [1] LOG:  listening on IPv6 address "::", port 5432
sql_1     | 1970-04-27 10:17:12.009 GMT [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
sql_1     | 1970-04-27 10:17:12.009 GMT [1] LOG:  startup process (PID 20) was terminated by signal 11: Segmentation fault
sql_1     | 1970-04-27 10:17:12.009 GMT [1] LOG:  aborting startup due to startup process failure
sql_1     | 1970-04-27 10:17:12.009 GMT [1] LOG:  database system is shut down
szuru_sql_1 exited with code 1
sgsunder commented 3 years ago

The message PostgreSQL Database directory appears to contain a database; Skipping initialization is normal (Basically there's a startup script that creates a new database if it's the first time you started up the postgres container).

The real issue is from the segmentation fault, and the "exec format error." What platform are you running on? The provided containers are compiled for x86-64 only, if you are running on something else then you would have to build the containers yourself.

y0nei commented 3 years ago

im running that on raspberry pi 3 B+ with the standard raspberry pi debian os i also have postgres, nextcloud and bitwarden running on that, maybe thats the issue

raspi is ARM7, in that case how do build them myself?

sgsunder commented 3 years ago

See here for ARM instructions: https://github.com/rr-/szurubooru/wiki/ARM-and-Raspberry-Pi-Support-for-Docker-builds

y0nei commented 3 years ago

Now i got this

WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/main: temporary error (try again later) WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/community: temporary error (try again later) ERROR: unable to select packages: dumb-init (no such package): required by: world[dumb-init] ERROR: Service 'client' failed to build: The command '/bin/sh -c apk --no-cache add dumb-init' returned a non-zero code: 1

sgsunder commented 3 years ago

try again later

Did you try again to see if it still fails? It seems like the package repo might have been down for a bit

y0nei commented 3 years ago

nope, still the same issue I tried it on a Ubuntu VM and it worked properly, i still get this on my raspi tho

Now i got this

WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/main: temporary error (try again later) WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/community: temporary error (try again later) ERROR: unable to select packages: dumb-init (no such package): required by: world[dumb-init] ERROR: Service 'client' failed to build: The command '/bin/sh -c apk --no-cache add dumb-init' returned a non-zero code: 1

sgsunder commented 3 years ago

What Dockerfile are you building? We're still on Alpine Linux v3.12 inside the Docker containers, so that error message doesn't make sense.

y0nei commented 3 years ago

My docker file in server/Dockerfile shows ALPINE_VERSION=3.12 But the main issue is that its unable to select the dumb-init package for some reason, how do i fix that?

sgsunder commented 3 years ago

I can't reproduce it at all no matter what I try, even in ARM emulation. Perhaps it's an internet issue? Your DNS resolver is borked or something.

Does running nslookup dl-cdn.alpinelinux.org work? How about docker run --rm alpine:3.12 nslookup dl-cdn.alpinelinux.org?

y0nei commented 3 years ago

i ran docker run --rm alpine:3.12 nslookup dl-cdn.alpinelinux.org

nslookup: read: Connection refused
nslookup: read: Connection refused
nslookup: read: Connection refused
nslookup: read: Connection refused
Server:         8.8.4.4
Address:        8.8.4.4:53

Non-authoritative answer:
dl-cdn.alpinelinux.org  canonical name = dualstack.d.sni.global.fastly.net
Name:   dualstack.d.sni.global.fastly.net
Address: 2a04:4e42::645
Name:   dualstack.d.sni.global.fastly.net
Address: 2a04:4e42:200::645
Name:   dualstack.d.sni.global.fastly.net
Address: 2a04:4e42:400::645
Name:   dualstack.d.sni.global.fastly.net
Address: 2a04:4e42:600::645

Non-authoritative answer:
dl-cdn.alpinelinux.org  canonical name = dualstack.d.sni.global.fastly.net
Name:   dualstack.d.sni.global.fastly.net
Address: 151.101.2.133
Name:   dualstack.d.sni.global.fastly.net
Address: 151.101.66.133
Name:   dualstack.d.sni.global.fastly.net
Address: 151.101.130.133
Name:   dualstack.d.sni.global.fastly.net
Address: 151.101.194.133
sgsunder commented 3 years ago

nslookup: read: Connection refused

I think your Docker install is not resolving DNS properly. Don't know how to solve that for sure, but you can try restarting the Docker app, or reinstalling it

sgsunder commented 3 years ago

@ziimro ARM images are now available on Docker Hub! check the wiki for further details. I'm not sure if you're still having this issue but hopefully this makes the build easier for you.

Feel free to reopen if this issue is still unresolved.

y0nei commented 2 years ago

@sgsunder is been some time and i tried tinkering with it again. I changed to alpine 13.3 in docker compose but it still doesent work. Id love to get some help and finally get it working

y0nei commented 2 years ago
 PostgreSQL Database directory appears to contain a database; Skipping initialization
sql_1     |
sql_1     | 1970-04-28 06:32:08.010 GMT [1] LOG:  starting PostgreSQL 13.3 on arm-unknown-linux-musleabihf, compiled by gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424, 32-bit
sql_1     | 1970-04-28 06:32:08.010 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
sql_1     | 1970-04-28 06:32:08.010 GMT [1] LOG:  listening on IPv6 address "::", port 5432
sql_1     | 1970-04-28 06:32:08.010 GMT [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
sql_1     | 1970-04-28 06:32:08.010 GMT [1] LOG:  startup process (PID 20) was terminated by signal 11: Segmentation fault
sql_1     | 1970-04-28 06:32:08.010 GMT [1] LOG:  aborting startup due to startup process failure
sql_1     | 1970-04-28 06:32:08.010 GMT [1] LOG:  database system is shut down
szuru_sql_1 exited with code 1

before i got this log

The files belonging to this database system will be owned by user "postgres".
sql_1     | This user must also own the server process.
sql_1     |
sql_1     | The database cluster will be initialized with locale "en_US.utf8".
sql_1     | The default database encoding has accordingly been set to "UTF8".
sql_1     | The default text search configuration will be set to "english".
sql_1     |
sql_1     | Data page checksums are disabled.
sql_1     |
sql_1     | fixing permissions on existing directory /var/lib/postgresql/data ... ok
sql_1     | creating subdirectories ... ok
sql_1     | selecting dynamic shared memory implementation ... posix
sql_1     | selecting default max_connections ... 100
sql_1     | selecting default shared_buffers ... 128MB
sql_1     | selecting default time zone ... GMT
sql_1     | creating configuration files ... ok
sql_1     | running bootstrap script ... ok
sql_1     | sh: locale: not found
sql_1     | 1970-05-04 08:10:16.010 GMT [31] WARNING:  no usable system locales were found
sql_1     | performing post-bootstrap initialization ... ok
sql_1     | syncing data to disk ... ok
sql_1     |
sql_1     |
sql_1     | Success. You can now start the database server using:
sql_1     |
sql_1     |     pg_ctl -D /var/lib/postgresql/data -l logfile start
sql_1     |
sql_1     | initdb: warning: enabling "trust" authentication for local connections
sql_1     | You can change this by editing pg_hba.conf or using the option -A, or
sql_1     | --auth-local and --auth-host, the next time you run initdb.
sql_1     | waiting for server to start....1970-05-04 08:10:16.010 GMT [36] LOG:  starting PostgreSQL 13.3 on arm-unknown-linux-musleabihf, compiled by gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424, 32-bit
sql_1     | 1970-05-04 08:10:16.010 GMT [36] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
sql_1     | .........1970-05-04 08:10:16.010 GMT [36] LOG:  startup process (PID 37) was terminated by signal 11: Segmentation fault
sql_1     | 1970-05-04 08:10:16.010 GMT [36] LOG:  aborting startup due to startup process failure
sql_1     | .1970-05-04 08:10:16.010 GMT [36] LOG:  database system is shut down
sql_1     | pg_ctl: could not start server
sql_1     | Examine the log output.
sql_1     |  stopped waiting

same issues over and over again docker-compose.yml is pulling szuru:lastest so it should work, I have no idea what im doing wrong

y0nei commented 2 years ago

i tested it on vms and it works just fine on ubuntu server (i have the classic raspi os on my pi)

sgsunder commented 2 years ago

Can you post the result of docker info | grep -i architecture?

y0nei commented 2 years ago
zim@pibuntu:~$ docker info | grep -i architecture
errors pretty printing info
y0nei commented 2 years ago

@sgsunder sorry wrong machine

WARNING: No memory limit support
WARNING: No swap limit support
WARNING: No kernel memory limit support
WARNING: No oom kill disable support
Architecture: armv7l

maybe its an issue with me running on armv7 and not having updated versions of dependencies

y0nei commented 2 years ago

i have a rasberry pi 4 on shipping so i will test it there too once it arrives

squeevee commented 2 years ago

I've gotten very similar errors to these trying to get szurubooru to work on a raspberry pi 4 running debian. I've now got it working, with two major tweaks:

I had to edit the Dockerfile for client and server, change every instance of $BUILDPLATFORM to linux/arm/v7 and NOT have DOCKER_BUILDKIT in my environment when running docker-compose build

It only seems to work using the Docker Engine package provided by Moby rather than the one in the Debian distro, see https://docs.docker.com/engine/install/debian/

The "temporary problem" error message in apk seems to be related to a change to Alpine 3.13 which required special workarounds to work with older versions of Docker and libseccomp on 32-bit host systems. At the time Alpine 3.13 was released, Debian's packages had not met the new version requirements; they now do, but for some reason if BuildKit is used I get that error again (seemingly regardless of which package I use).

I don't have a specific guess why the Debian package for Docker Engine doesn't work, except that the Moby package has higher versions of containerd and runc. I'm pretty sure I was using the Debian package six months ago and running szurubooru without major problems, but I've wiped this pi since then so who's to say.

EDIT: I've only now found out the Pi 4 has a 64-bit CPU. I must have just assumed it was 32-bit and installed that version of the OS, then never gone back and checked. Amazing.