Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Every time I try to start postgresql, I get this error:

* Starting PostgreSQL 9.2 database server                                       
* Error: Could not create log file /var/log/postgresql/postgresql-9.2-main.log

To start the server, I have to sudo mkdir the postgresql folder in /var/log/

How can I start postgresql automatically every time I boot up? I already have a postgres user on the Ubuntu 12.10 system.

share|improve this question

migrated from stackoverflow.com Nov 9 '12 at 3:29

This question came from our site for professional and enthusiast programmers.

    
It looks like your /var/log/postgresql directory is wiped out at each reboot, which is unusual and not standard. Maybe /var/log is mounted on temporary storage or there's a custom script doing rm -rf /var/log/* or some such thing. –  Daniel Vérité Nov 9 '12 at 2:45
    
That was it. It was getting wiped from the tmpfs. –  nicefinly Nov 10 '12 at 22:21

3 Answers 3

Change the owner of the /var/log/postgresql directory to the postgres user:

chown postgres /var/log/postgresql
share|improve this answer
    
I just tried that, but the server still doesn't start at boot. –  nicefinly Nov 9 '12 at 0:44

If you're using a .deb installation of Postgresql, it should be starting on boot up. However, since you're using a non-default Postgresql version -as I assume because Ubuntu 12.10 comes with 9.1.6-, probably it's not booting because of a non-compatible configuration. It's just a supposition.

Have a look at /etc/postgresql/9.2/main/start.conf, which should have the value auto to tell Ubuntu to start Postgresql on boot. (That file has fair simple docs about what each setting does).

share|improve this answer

** SOLUTION**

It turns out I had included the /var/log/ folder in the tmpfs to be wiped every time I reboot, since I mounted the cache and temp in RAM to speed things up.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.