FS#32359 - [postgresql] /var/lib/postgres/data not created when installed

Attached to Project: Arch Linux
Opened by David Barri (japgolly) - Thursday, 01 November 2012, 12:54 GMT
Last edited by Dan McGee (toofishes) - Friday, 25 January 2013, 21:09 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Dan McGee (toofishes)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

When postgresql is installed for the first time, it creates /var/lib/postgres as root:root and 755 perms, however when attempting to start postgresql service (at least thru systemd via: systemctl start postgresql.service) it fails with this error:
systemd[1]: Starting PostgreSQL database server...
postgres[1048]: "/var/lib/postgres/data" is missing or empty. Use a command like
postgres[1048]: su - postgres -c "initdb --locale en_US.UTF-8 -D '/var/lib/postgres/data'"
postgres[1048]: with relevant options, to initialize the database cluster.
systemd[1]: postgresql.service: control process exited, code=exited status=1
systemd[1]: Failed to start PostgreSQL database server.
systemd[1]: Unit postgresql.service entered failed state


I resolved by running the following commands:
sudo mkdir /var/lib/postgres/data
sudo chown postgres:postgres /var/lib/postgres/data
sudo -u postgres initdb -D /var/lib/postgres/data
This task depends upon

Closed by  Dan McGee (toofishes)
Friday, 25 January 2013, 21:09 GMT
Reason for closing:  Won't fix
Additional comments about closing:  It tells you exactly what to do when it fails. I am against automating this call as one might want to override locale options or other things when initdb-ing.

Loading...