Nethunter Postgresql service socket permission denied

40 Views Asked by At

I have kali nethunter on my Redmi Note 11. It is rooted, bootloader unlocked, with a custom kernel from XDA. The problem is that the kernel has CONFIG_ANDROID_PARANOID_NETWORK enabled and because of it postgresql can't start. I don't have the kernel sources to disable CONFIG_ANDROID_PARANOID_NETWORK and recompile.

┌──(root㉿kali)-[/]
└─# service postgresql start
Starting PostgreSQL 16 database server: mainError: /usr/lib/postgresql/16/bin/pg_ctl /usr/lib/postgresql/16/bin/pg_ctl start -D /var/lib/postgresql/16/main -l /var/log/postgresql/postgresql-16-main.log -s -o  -c config_file="/etc/postgresql/16/main/postgresql.conf"  exited with status 1:
2024-03-15 23:52:23.987 UTC [9875] LOG:  starting PostgreSQL 16.2 (Debian 16.2-1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 13.2.0-13) 13.2.0, 64-bit
2024-03-15 23:52:23.987 UTC [9875] LOG:  could not create IPv6 socket for address "::1": Permission denied
2024-03-15 23:52:23.987 UTC [9875] LOG:  could not create IPv4 socket for address "127.0.0.1": Permission denied
2024-03-15 23:52:23.987 UTC [9875] WARNING:  could not create listen socket for "localhost"
2024-03-15 23:52:23.987 UTC [9875] FATAL:  could not create any TCP/IP sockets
2024-03-15 23:52:23.990 UTC [9875] LOG:  database system is shut down
pg_ctl: could not start server
Examine the log output. ... failed!
 failed!

I already added "root" and "kali" users to aid_bt, aid_bt_net, aid_inet, aid_net_raw, aid_admin groups.

I need to make postgresql have the permissions of those groups.

1

There are 1 best solutions below

0
W3C W3C On

Nevermind, you just need to run

usermod -a -G aid_bt,aid_bt_net,aid_inet,aid_net_raw,aid_admin postgres

to bypass CONFIG_ANDROID_PARANOID_NETWORK

also add these groups beforehand (if any of GIDs are occupied delete the group inhabiting them):

groupadd -g 3001 aid_bt
groupadd -g 3002 aid_bt_net
groupadd -g 3003 aid_inet
groupadd -g 3004 aid_net_raw
groupadd -g 3005 aid_admin

i feel kinda dumb now for posting this question