问题
I recently did a fresh install of Ubuntu 18.04 on Windows 10 using the Windows Subsystem for Linux (WSL). I then installed PostgreSQL 10 and was able to start the database server successfully. I then logged into the server via PGAdmin 4.4 and installed the PostGIS 2.5.2 extension. I was then about to import data via pg_restore when PGAdmin said it had lost its connection to the PostgreSQL server. I tried restarting and I got the following errors in my log:
2019-04-04 15:46:12.561 DST [47] LOG: listening on IPv4 address "0.0.0.0", port 5432
2019-04-04 15:46:12.561 DST [47] LOG: listening on IPv6 address "::", port 5432
2019-04-04 15:46:12.563 DST [47] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2019-04-04 15:46:12.614 DST [48] LOG: database system was shut down at 2019-04-04 15:42:36 DST
2019-04-04 15:46:12.661 DST [47] LOG: database system is ready to accept connections
2019-04-04 15:46:13.247 DST [55] [unknown]@[unknown] LOG: incomplete startup packet
2019-04-04 15:46:53.541 DST [49] PANIC: could not flush dirty data: Function not implemented
2019-04-04 15:46:53.543 DST [47] LOG: checkpointer process (PID 49) was terminated by signal 6: Aborted
2019-04-04 15:46:53.543 DST [47] LOG: terminating any other active server processes
2019-04-04 15:46:53.543 DST [68] postgres@postgres WARNING: terminating connection because of crash of another server process
2019-04-04 15:46:53.543 DST [68] postgres@postgres DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
2019-04-04 15:46:53.543 DST [68] postgres@postgres HINT: In a moment you should be able to reconnect to the database and repeat your command.
2019-04-04 15:46:53.543 DST [52] WARNING: terminating connection because of crash of another server process
2019-04-04 15:46:53.543 DST [52] DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
2019-04-04 15:46:53.543 DST [52] HINT: In a moment you should be able to reconnect to the database and repeat your command.
2019-04-04 15:46:53.549 DST [47] LOG: all server processes terminated; reinitializing
2019-04-04 15:46:53.569 DST [69] LOG: database system was interrupted; last known up at 2019-04-04 15:46:12 DST
2019-04-04 15:46:53.569 DST [69] PANIC: could not flush dirty data: Function not implemented
2019-04-04 15:46:53.575 DST [47] LOG: startup process (PID 69) was terminated by signal 6: Aborted
2019-04-04 15:46:53.575 DST [47] LOG: aborting startup due to startup process failure
2019-04-04 15:46:53.579 DST [47] LOG: database system is shut down
2019-04-04 15:46:53.579 DST [70] postgres@postgres FATAL: the database system is in recovery mode
I tried a fresh install of Ubuntu 18.04 and PostgreSQL 10 and the same thing happened again! I had a previous install of the setup described above which was working fine. Does anyone have suggestions as to what could be causing this issue?
UPDATE: A answered the question below.
回答1:
So after some further research, I found that with the newest PostgreSQL update the previous 'could not flush dirty data' Warnings were escalated to Panics, I fixed the problem by leaving fsync=on and add data_sync_retry = true to postgresql.conf. I hope this is useful to anyone else who is having the same problem. It looks like the problem is known and will be fixed in the future see, https://github.com/Microsoft/WSL/issues/645.
回答2:
It looks like the WSL doesn't support all of the needed syscalls for PostgreSQL. Have you tried installing the Windows version? You can obtain it here:
https://www.postgresql.org/download/windows/
来源:https://stackoverflow.com/questions/55519413/postresql-10-fails-to-start-on-ubuntu-18-04-running-on-windows-subsystem-for-lin