Two weeks ago, I installed ubuntu 18.04 in the windows Linux Subsystem

In there, I installed postgresql 11 using sudo apt-get install postgresql-11

At the time, I could start my postgresql using this command

sudo -u postgres /usr/lib/postgresql/11/bin/pg_ctl -D /etc/postgresql/11/main -l /var/log/postgresql/postgresql-11-main.log start

so far so good.

Two weeks later, I try to start this postgresql engine using the same command and I get this error "FATAL: could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": No such file or directory"

I created that folder, gave it chmod 777 to avoid permission problems.

Then I get LOG: database system was interrupted; last known up at 2019-02-16 17:57:02 STD PANIC: could not flush dirty data: Function not implemented LOG: startup process (PID 94) was terminated by signal 6: Aborted

Any idea what might be wrong?


There have been recent changes in PostgreSQL related to fsync that turn out to be problematic with the Windows Linux Subsystem. The specific PANIC error you mention is currently discussed on the PG mailing list, with a proposed patch:

WSL (windows subsystem on linux) users will need to turn fsync off as of 11.2

Note that the workaround suggested in the subject, turning fsync to off, is not for production use. It's only okay if you're playing around with Postgres on WSL, and don't really care about the durability of your data. Some say that WSL itself is not for production use anyway.

The fact that /var/run/postgresql does not exist is completely unrelated. /var/run is typically mounted on a RAM disk and is created by the startup scripts that you're side-stepping by using your manual launch procedure. The typical normal procedure is something like systemctl start postgresql, which works when everything is configured normally, and takes care of creating this directory with the proper permissions.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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