Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket: address family not supported by protocol #33581

Open
JensTimmerman opened this issue Feb 13, 2025 · 2 comments
Open

socket: address family not supported by protocol #33581

JensTimmerman opened this issue Feb 13, 2025 · 2 comments
Labels

Comments

@JensTimmerman
Copy link

Description

With the database config

[database]
DB_TYPE = postgres
HOST = /run/postgresql/
NAME = gitea
USER = gitea
PASSWD =  lel
SSL_MODE = disable
#PATH = /var/lib/gitea/data/gitea.db
LOG_SQL = true

I'm getting 2025/02/13 11:05:35 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: dial unix /run/postgresql/.s.PGSQL.5432: socket: address family not supported by protocol

Gitea Version

1.23.3

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

git version 2.43.5

Operating System

Rocky Linux release 9.4 (Blue Onyx)

How are you running Gitea?

deployed using https://github.com/roles-ansible/ansible_role_gitea in an lxc container on proxmox

Database

None

@lunny
Copy link
Member

lunny commented Feb 13, 2025

What's your postgres version?

@JensTimmerman
Copy link
Author

JensTimmerman commented Feb 13, 2025

[jens@gitea ~]$ psql --version
psql (PostgreSQL) 13.14

I updated to 13.18 but no difference

[jens@gitea ~]$ psql --version
psql (PostgreSQL) 13.18
[root@gitea ~]# tail -f /var/lib/gitea/log/gitea.log
2025/02/13 22:10:47 ...eful/manager_unix.go:144:handleSignals() [W] PID 82022. Received SIGTERM. Shutting down...
2025/02/13 22:10:47 .../graceful/manager.go:168:doHammerTime() [W] Setting Hammer condition
2025/02/13 22:10:48 .../graceful/manager.go:184:doTerminate() [W] Terminating
2025/02/13 22:10:48 ...eful/manager_unix.go:154:handleSignals() [W] PID: 82022. Background context for manager closed - context canceled - Shutting down...
2025/02/13 22:10:49 ...es/setting/mailer.go:215:loadMailerFrom() [W] connecting over insecure SMTP protocol to non-local address is not recommended
2025/02/13 22:10:49 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: dial unix /run/postgresql/.s.PGSQL.5432: socket: address family not supported by protocol
2025/02/13 22:10:52 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #2/10 failed. Error: dial unix /run/postgresql/.s.PGSQL.5432: socket: address family not supported by protocol
2025/02/13 22:10:55 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #3/10 failed. Error: dial unix /run/postgresql/.s.PGSQL.5432: socket: address family not supported by protocol
2025/02/13 22:10:58 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #4/10 failed. Error: dial unix /run/postgresql/.s.PGSQL.5432: socket: address family not supported by protocol
2025/02/13 22:11:01 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #5/10 failed. Error: dial unix /run/postgresql/.s.PGSQL.5432: socket: address family not supported by protocol
2025/02/13 22:11:04 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #6/10 failed. Error: dial unix /run/postgresql/.s.PGSQL.5432: socket: address family not supported by protocol
2025/02/13 22:11:07 routers/common/db.go:36:InitDBEngine() [E] ORM engine initialization attempt #7/10 failed. Error: dial unix /run/postgresql/.s.PGSQL.5432: socket: address family not supported by protocol

pg_hba.conf contains

local all postgres    peer
local gitea gitea    trust

the gitea user can connect to the socket via local no password auth

[root@gitea ~]# sudo -u gitea psql -U gitea -d gitea -h /var/run/postgresql
could not change directory to "/root": Permission denied
psql (13.18)
Type "help" for help.

gitea=>

the socket file exists in the expected location

[root@gitea ~]# ls /run/postgresql/ -alh
total 4.0K
drwxr-xr-x  2 postgres postgres  80 Feb 13 22:11 .
drwxr-xr-x 21 root     root     580 Feb 13 22:10 ..
srwxrwxrwx  1 postgres postgres   0 Feb 13 22:11 .s.PGSQL.5432
-rw-------  1 postgres postgres  62 Feb 13 22:11 .s.PGSQL.5432.lock

This worked last month, broke after update to 1.23.3, it worked on 1.22 IIRC, I can try to do a disect in the coming days.

Commenting out the password in the ini file has no effect

it works if I add this to ph_hba.conf

host    all     gitea     127.0.0.1/32    trust

and change host in ini to HOST = 127.0.0.1
but I prefer to use the unix socket vs tcp, since that's how I configure postgres on all my other services and that worked for years until this update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants