Today as I was installing PostgreSQL 9.04 on a new server I encountered the following error:
\[root@host ~\]# /usr/local/etc/rc.d/postgresql initdb
su: unknown login: %%PG_USER%%
Something obviously went wrong when the port was being installed. Most likely it’s a bug in the build-instructions for the port. No stress though, as there is an easy fix. Just open up _/usr/local/etc/rc.d/postgresql_
and modify the line
postgresql\_user=${postgresql\_user:-"%%PG_USER%%"}
with
postgresql\_user=${postgresql\_user:-"pgsql"}
(or I suppose you could add “postgresql_user=pgsql” to rc.conf).
You should now be able to initiate PostgreSQL.
Enjoyed this post? Check out my podcast!
If you found this interesting, you might enjoy "Nerding Out with Viktor" - my podcast where I dive deep into tech, entrepreneurship, and security with industry experts.