Describe the bug
A clear and concise description of what the bug is.
I have
services.postgresql = with pkgs.stdenv; {
enable = true;
dataDir = "/data1/pgsql";
...
}
The error I got when starting the service is:
● postgresql.service - PostgreSQL Server
Loaded: loaded (/nix/store/jhcbg6fp13s9p66ppm0aj8d104l9fd0p-unit-postgresql.service/postgresql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2020-02-22 21:20:28 CET; 12min ago
Process: 2394 ExecStartPre=/nix/store/xd7sr8p0i14kx69rfh9803ckbdv72zmz-unit-script-postgresql-pre-start (code=exited, status=0/SUCCESS)
Process: 2398 ExecStart=/nix/store/14ljxa6jxxzbnzxdm649bmcmaksba3nv-unit-script-postgresql-start (code=exited, status=1/FAILURE)
Main PID: 2398 (code=exited, status=1/FAILURE)
IP: 0B in, 0B out
CPU: 26ms
Feb 22 21:20:28 compute1 14ljxa6jxxzbnzxdm649bmcmaksba3nv-unit-script-postgresql-start[2398]: The files belonging to this database system will be owned by user "postgres".
Feb 22 21:20:28 compute1 14ljxa6jxxzbnzxdm649bmcmaksba3nv-unit-script-postgresql-start[2398]: This user must also own the server process.
Feb 22 21:20:28 compute1 14ljxa6jxxzbnzxdm649bmcmaksba3nv-unit-script-postgresql-start[2398]: The database cluster will be initialized with locale "en_US.UTF-8".
Feb 22 21:20:28 compute1 14ljxa6jxxzbnzxdm649bmcmaksba3nv-unit-script-postgresql-start[2398]: The default database encoding has accordingly been set to "UTF8".
Feb 22 21:20:28 compute1 14ljxa6jxxzbnzxdm649bmcmaksba3nv-unit-script-postgresql-start[2398]: The default text search configuration will be set to "english".
Feb 22 21:20:28 compute1 14ljxa6jxxzbnzxdm649bmcmaksba3nv-unit-script-postgresql-start[2398]: Data page checksums are disabled.
Feb 22 21:20:28 compute1 14ljxa6jxxzbnzxdm649bmcmaksba3nv-unit-script-postgresql-start[2398]: initdb: could not access directory "/data1/pgsql": Permission denied
Feb 22 21:20:28 compute1 systemd[1]: postgresql.service: Main process exited, code=exited, status=1/FAILURE
Feb 22 21:20:28 compute1 systemd[1]: postgresql.service: Failed with result 'exit-code'.
Feb 22 21:20:28 compute1 systemd[1]: Failed to start PostgreSQL Server.
Describe the bug
A clear and concise description of what the bug is.
I have
The error I got when starting the service is: