Skip to content

The new btcpayserver and nbxplorer break postgresql on nixos-unstable (25.11.20250704.5c724ed) #798

@naturallaw777

Description

@naturallaw777

After updating my machine (and to the new nix-bitcoin) postgresql does not start.

× postgresql.service - PostgreSQL Server
     Loaded: loaded (/etc/systemd/system/postgresql.service; linked; preset: ignored)
     Active: failed (Result: exit-code) since Sun 2025-07-06 08:01:10 CDT; 10s ago
   Duration: 10h 33min 16.423s
 Invocation: 971180248d404d7abdb4b46778c89d47
    Process: 786796 ExecStartPre=/nix/store/7cywp67dmjkmpm0xj71a0kc0drrkp52i-unit-script-postgresql-pre-start/bin/postgresql-pre-start (code=exited, status=0/SUCCESS)
    Process: 786860 ExecStart=/nix/store/ksq912f8yf6px5jz00d0sjfmvk3mw0az-postgresql-and-plugins-14.18/bin/postgres (code=exited, status=0/SUCCESS)
    Process: 786928 ExecStartPost=/nix/store/dc2a4d20imwb80dmnmxch42baphr18ww-unit-script-postgresql-post-start/bin/postgresql-post-start (code=exited, status=127)
   Main PID: 786860 (code=exited, status=0/SUCCESS)
         IP: 385B in, 385B out
         IO: 124K read, 32K written
   Mem peak: 13.6M
        CPU: 199ms

Jul 06 08:01:09 nixos postgresql-post-start[787028]: /nix/store/dc2a4d20imwb80dmnmxch42baphr18ww-unit-script-postgresql-post-start/bin/postgresql-post-start: line 4: -tAc: command not found
Jul 06 08:01:09 nixos systemd[1]: postgresql.service: Control process exited, code=exited, status=127/n/a
Jul 06 08:01:09 nixos postgres[786860]: [786860] LOG:  received fast shutdown request
Jul 06 08:01:10 nixos postgres[786860]: [786860] LOG:  aborting any active transactions
Jul 06 08:01:10 nixos postgres[786860]: [786860] LOG:  background worker "logical replication launcher" (PID 786922) exited with exit code 1
Jul 06 08:01:10 nixos postgres[786915]: [786915] LOG:  shutting down
Jul 06 08:01:10 nixos postgres[786860]: [786860] LOG:  database system is shut down
Jul 06 08:01:10 nixos systemd[1]: postgresql.service: Failed with result 'exit-code'.
Jul 06 08:01:10 nixos systemd[1]: Failed to start PostgreSQL Server.
Jul 06 08:01:10 nixos systemd[1]: postgresql.service: Consumed 199ms CPU time, 13.6M memory peak, 124K read from disk, 32K written to disk, 385B incoming IP traffic, 385B outgoing IP traffic.
Command 'systemd-run -E LOCALE_ARCHIVE -E NIXOS_INSTALL_BOOTLOADER --collect --no-ask-password --pipe --quiet --service-type=exec --unit=nixos-rebuild-switch-to-configuration /nix/store/c53sgimpsrkczhb6hk3n7pq4ry4pbdsa-nixos-system-nixos-25.11.20250704.5c724ed/bin/switch-to-configuration switch' returned non-zero exit status 4.

Looking further into it, here is the output of the error in the nix store /nix/store/dc2a4d20imwb80dmnmxch42baphr18ww-unit-script-postgresql-post-start/bin/postgresql-post-start

#!/nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37/bin/bash
set -e

$PSQL -tAc '
  ALTER DATABASE "btcpaydb" OWNER TO "btcpayserver";
  ALTER DATABASE "nbxplorer" OWNER TO "nbxplorer";
'

It seems this script needs to be updated as per this issue NixOS/nixpkgs#422835 ?

Thank you so much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions