Skip to content

debian pg_autoctl create posgresql v17 issue (pg_ctl: too many command-line arguments) #1076

@PatrickBzh

Description

@PatrickBzh

Hi pg_auto_failover'Team

I'm testing pg_auto_failover for a future production use in our institute...

Testing platform :

  • Debian 12
  • pg apt repository : apt.postgresql.org
  • pg_auto_failover : version 2.1-3.pgdg120+1
  • monitor : PG16 on vpostgres-test3, port 3000, auth=trust (test purpose)
  • node 1 : PG17 on vpostgres-test1, port 8432, auth=trust (test purpose)

Working fine with pg16 (monitor, & postgresql node), but I'm facing an issue when creating a pg17 node (I was not able to create a monitor on pg17 as well)
I've got an arror when pg_autoctl call PG17 init_db :

19:04:12 346162 INFO  pgctl.c:1569: Initialising a PostgreSQL cluster at "/pg_data/17-test/instance"
19:04:12 346162 INFO  pgctl.c:1570: /usr/lib/postgresql/17/bin/pg_ctl initdb -s -D /pg_data/17-test/instance --option '--auth=trust'
19:04:12 346162 ERROR pgctl.c:1552: pg_ctl: too many command-line arguments (first is "--silent")
19:04:12 346162 ERROR pgctl.c:1552: Try "pg_ctl --help" for more information.
19:04:12 346162 FATAL pgctl.c:1585: Failed to initialize Postgres cluster at "/pg_data/17-test/instance", see above for details

When I specifiy a PG16 pg_ctl, everything's fine ...

here is the full log when creating a new PG17 instance from scratch

export PG_USER='postgres'
export PG_VERSION=17
export PG_INSTANCE_NAME=test
export PG_PORT=8432

pg_autoctl create postgres   \
  --pgctl "/usr/lib/postgresql/${PG_VERSION}/bin/pg_ctl"  \
  --pgdata "/pg_data/${PG_VERSION}-${PG_INSTANCE_NAME}/instance"  \
  --pgport "${PG_PORT}"  \
  --listen '*'  \
  --username  "${PG_USER}"  \
  --dbname     "${PG_USER}"  \
  --name        "${PG_INSTANCE_NAME}-PGTEST1"  \
  --hostname        $(hostname --fqdn)  \
  --formation       "${PG_INSTANCE_NAME}"  \
  --monitor         'postgres://[email protected]:3000/pg_auto_failover?sslmode=require'  \
  --pg-hba-lan  \
  --candidate-priority    50  \
  --replication-quorum    true  \
  --auth trust  \
  --ssl-self-signed  \
  --run
  -vvv

19:04:12 346159 TRACE config.c:166: SetConfigFilePath: "/export/home/postgresql/.config/pg_autoctl/pg_data/17-test/instance/pg_autoctl.cfg"
19:04:12 346159 TRACE config.c:194: SetStateFilePath: "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.state"
19:04:12 346159 TRACE config.c:209: SetKeeperStateFilePath: "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.init"
19:04:12 346159 TRACE config.c:237: SetNodesFilePath: "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/nodes.json"
19:04:12 346159 TRACE config.c:263: SetPidFilePath: "/tmp/pg_autoctl/pg_data/17-test/instance/pg_autoctl.pid"
19:04:12 346159 TRACE pgsetup.c:1620: pgsetup_validate_ssl_settings
19:04:12 346159 INFO  pgsetup.c:1729: Using default --ssl-mode "require"
19:04:12 346159 INFO  pgsetup.c:1732: Using --ssl-self-signed: pg_autoctl will create self-signed certificates, allowing for encrypted network traffic
19:04:12 346159 WARN  pgsetup.c:1735: Self-signed certificates provide protection against eavesdropping; this setup does NOT protect against Man-In-The-Middle attacks nor Impersonation attacks.
19:04:12 346159 WARN  pgsetup.c:1738: See https://www.postgresql.org/docs/current/libpq-ssl.html for details
19:04:12 346159 TRACE keeper_config.c:324: keeper_config_init
19:04:12 346159 TRACE pgsetup.c:1456: nodeKindFromString: "standalone" ➜ 1
19:04:12 346159 DEBUG pgsetup.c:122: pg_setup_init: /usr/lib/postgresql/17/bin/pg_ctl version 17.4
19:04:12 346159 TRACE pgsetup.c:455: Failed to open file "/pg_data/17-test/instance/postmaster.pid": No such file or directory
19:04:12 346159 TRACE config.c:166: SetConfigFilePath: "/export/home/postgresql/.config/pg_autoctl/pg_data/17-test/instance/pg_autoctl.cfg"
19:04:12 346159 TRACE config.c:194: SetStateFilePath: "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.state"
19:04:12 346159 TRACE config.c:209: SetKeeperStateFilePath: "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.init"
19:04:12 346159 TRACE keeper_config.c:558: keeper_config_write_file "/export/home/postgresql/.config/pg_autoctl/pg_data/17-test/instance/pg_autoctl.cfg"
19:04:12 346159 TRACE keeper_pg_init.c:69: keeper_pg_init: monitor is enabled
19:04:12 346159 TRACE supervisor.c:452: supervisor_init
19:04:12 346159 TRACE signals.c:37: set_signal_handlers
19:04:12 346159 TRACE pidfile.c:55: create_pidfile(346159): "/tmp/pg_autoctl/pg_data/17-test/instance/pg_autoctl.pid"
19:04:12 346159 DEBUG supervisor.c:100: Starting pg_autoctl postgres service
19:04:12 346159 DEBUG service_postgres_ctl.c:81: pg_autoctl started postgres controller in subprocess 346161
19:04:12 346159 INFO  supervisor.c:113: Started pg_autoctl postgres service with pid 346161
19:04:12 346159 DEBUG supervisor.c:100: Starting pg_autoctl node-active service
19:04:12 346161 INFO  service_postgres_ctl.c:151:  /usr/bin/pg_autoctl do service postgres --pgdata /pg_data/17-test/instance -vvv
19:04:12 346159 DEBUG service_keeper_init.c:154: pg_autoctl node installer process started in subprocess 346162
19:04:12 346159 INFO  supervisor.c:113: Started pg_autoctl node-active service with pid 346162
19:04:12 346162 TRACE pgsetup.c:455: Failed to open file "/pg_data/17-test/instance/postmaster.pid": No such file or directory
19:04:12 346162 TRACE pgsetup.c:455: Failed to open file "/pg_data/17-test/instance/postmaster.pid": No such file or directory
19:04:12 346162 DEBUG state.c:116: Writing current state to "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.state.new"
19:04:12 346162 DEBUG state.c:174: rename "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.state.new" to "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.state"
19:04:12 346162 TRACE primary_standby.c:163: local_postgres_set_status_path: /pg_data/17-test/instance
19:04:12 346162 TRACE primary_standby.c:177: local_postgres_set_status_path: /tmp/pg_autoctl/pg_data/17-test/instance/pg_autoctl.pg
19:04:12 346162 TRACE primary_standby.c:200: local_postgres_unlink_status_file: /tmp/pg_autoctl/pg_data/17-test/instance/pg_autoctl.pg
19:04:12 346162 TRACE monitor.c:209: monitor_init: postgres://[email protected]:3000/pg_auto_failover?sslmode=require
19:04:12 346162 DEBUG state.c:49: Reading current state from "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.state"
19:04:12 346162 DEBUG pgsql.c:536: Connecting to [monitor] "postgres://[email protected]:3000/pg_auto_failover?sslmode=require"
19:04:12 346161 DEBUG cli_common.c:1192: Managing PostgreSQL installation at "/pg_data/17-test/instance"
19:04:12 346161 TRACE config.c:166: SetConfigFilePath: "/export/home/postgresql/.config/pg_autoctl/pg_data/17-test/instance/pg_autoctl.cfg"
19:04:12 346161 TRACE config.c:194: SetStateFilePath: "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.state"
19:04:12 346161 TRACE config.c:209: SetKeeperStateFilePath: "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.init"
19:04:12 346161 TRACE config.c:237: SetNodesFilePath: "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/nodes.json"
19:04:12 346161 TRACE config.c:263: SetPidFilePath: "/tmp/pg_autoctl/pg_data/17-test/instance/pg_autoctl.pid"
19:04:12 346161 TRACE signals.c:37: set_signal_handlers
19:04:12 346161 TRACE config.c:166: SetConfigFilePath: "/export/home/postgresql/.config/pg_autoctl/pg_data/17-test/instance/pg_autoctl.cfg"
19:04:12 346161 TRACE config.c:194: SetStateFilePath: "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.state"
19:04:12 346161 TRACE config.c:209: SetKeeperStateFilePath: "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.init"
19:04:12 346161 TRACE config.c:237: SetNodesFilePath: "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/nodes.json"
19:04:12 346161 TRACE config.c:263: SetPidFilePath: "/tmp/pg_autoctl/pg_data/17-test/instance/pg_autoctl.pid"
19:04:12 346161 DEBUG config.c:287: Probing configuration file "/export/home/postgresql/.config/pg_autoctl/pg_data/17-test/instance/pg_autoctl.cfg"
19:04:12 346161 TRACE ini_file.c:131: pg_autoctl.role = keeper
19:04:12 346161 DEBUG config.c:320: ProbeConfigurationFileRole: keeper
19:04:12 346161 DEBUG keeper_config.c:419: Reading configuration from /export/home/postgresql/.config/pg_autoctl/pg_data/17-test/instance/pg_autoctl.cfg
19:04:12 346161 TRACE ini_file.c:131: pg_autoctl.role = keeper
19:04:12 346161 TRACE ini_file.c:131: pg_autoctl.monitor = postgres://[email protected]:3000/pg_auto_failover?sslmode=require
19:04:12 346161 TRACE ini_file.c:131: pg_autoctl.formation = test
19:04:12 346161 TRACE ini_file.c:131: pg_autoctl.group = -1
19:04:12 346161 TRACE ini_file.c:131: pg_autoctl.name = test-PGTEST1
19:04:12 346161 TRACE ini_file.c:131: pg_autoctl.hostname = vpostgres-test1-ope.ifremer.fr
19:04:12 346161 TRACE ini_file.c:131: pg_autoctl.nodekind = standalone
19:04:12 346161 TRACE ini_file.c:131: postgresql.pgdata = /pg_data/17-test/instance
19:04:12 346161 TRACE ini_file.c:131: postgresql.pg_ctl = /usr/lib/postgresql/17/bin/pg_ctl
19:04:12 346161 TRACE ini_file.c:131: postgresql.username = ricdba
19:04:12 346161 TRACE ini_file.c:131: postgresql.dbname = ricdba
19:04:12 346161 TRACE ini_file.c:131: postgresql.port = 8432
19:04:12 346161 TRACE ini_file.c:131: postgresql.proxyport = 0
19:04:12 346162 DEBUG pgsql.c:1032: BEGIN;
19:04:12 346161 TRACE ini_file.c:131: postgresql.listen_addresses = *
19:04:12 346161 TRACE ini_file.c:131: postgresql.auth_method = trust
19:04:12 346162 DEBUG pgsql.c:1032: SELECT * FROM pgautofailover.register_node($1, $2, $3, $4, $5, $6, $7, $8, $9::pgautofailover.replication_state, $10, $11, $12, $13);
19:04:12 346161 TRACE ini_file.c:131: postgresql.hba_level = app
19:04:12 346162 DEBUG pgsql.c:1064: 'test', 'vpostgres-test1-ope.ifremer.fr', '8432', 'ricdba', 'test-PGTEST1', '0', '-1', '-1', 'init', 'standalone', '50', 'true', 'default'
19:04:12 346161 TRACE ini_file.c:131: ssl.active = 1
19:04:12 346161 TRACE ini_file.c:131: ssl.sslmode = require
19:04:12 346161 TRACE ini_file.c:131: replication.maximum_backup_rate = 100M
19:04:12 346161 TRACE ini_file.c:131: replication.backup_directory = /pg_data/17-test/backup/vpostgres-test1-ope.ifremer.fr
19:04:12 346161 TRACE ini_file.c:131: timeout.network_partition_timeout = 20
19:04:12 346161 TRACE ini_file.c:131: timeout.prepare_promotion_catchup = 30
19:04:12 346161 TRACE ini_file.c:131: timeout.prepare_promotion_walreceiver = 5
19:04:12 346161 TRACE ini_file.c:131: timeout.postgresql_restart_failure_timeout = 20
19:04:12 346161 TRACE ini_file.c:131: timeout.postgresql_restart_failure_max_retries = 3
19:04:12 346161 TRACE ini_file.c:131: timeout.listen_notifications_timeout = 0
19:04:12 346161 TRACE ini_file.c:131: timeout.citus_master_update_node_lock_cooldown = 0
19:04:12 346161 TRACE ini_file.c:131: timeout.citus_coordinator_wait_max_retries = 0
19:04:12 346161 TRACE ini_file.c:131: timeout.citus_coordinator_wait_timeout = 0
19:04:12 346161 TRACE ini_file.c:131: citus.role = primary
19:04:12 346161 TRACE pgsetup.c:1456: nodeKindFromString: "standalone" ➜ 1
19:04:12 346161 TRACE keeper_config.c:529: keeper_config_pgsetup_init
19:04:12 346162 INFO  monitor.c:912: Registered node 3 "test-PGTEST1" (vpostgres-test1-ope.ifremer.fr:8432) in formation "test", group 0, state "single"
19:04:12 346162 INFO  keeper.c:1718: Writing keeper state file at "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.state"
19:04:12 346162 DEBUG state.c:116: Writing current state to "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.state.new"
19:04:12 346161 DEBUG pgsetup.c:122: pg_setup_init: /usr/lib/postgresql/17/bin/pg_ctl version 17.4
19:04:12 346161 TRACE pgsetup.c:455: Failed to open file "/pg_data/17-test/instance/postmaster.pid": No such file or directory
19:04:12 346161 TRACE pidfile.c:55: create_pidfile(346161): "/tmp/pg_autoctl/pg_data/17-test/instance/pg_autoctl_postgres.pid"
19:04:12 346161 TRACE pgsetup.c:455: Failed to open file "/pg_data/17-test/instance/postmaster.pid": No such file or directory
19:04:12 346162 DEBUG state.c:174: rename "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.state.new" to "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.state"
19:04:12 346162 TRACE state.c:236: state.pg_control_version: 0
19:04:12 346162 TRACE state.c:237: state.system_identifier: 0
19:04:12 346162 TRACE state.c:238: state.pg_autoctl_state_version: 1
19:04:12 346162 TRACE state.c:240: state.current_node_id: 3
19:04:12 346162 TRACE state.c:241: state.current_group: 0
19:04:12 346162 TRACE state.c:242: state.current_nodes_version: 0
19:04:12 346162 TRACE state.c:245: state.current_role: init
19:04:12 346162 TRACE state.c:246: state.assigned_role: single
19:04:12 346162 TRACE state.c:248: state.last_monitor_contact: Mon Mar 31 19:04:12 2025
19:04:12 346162 TRACE state.c:251: state.last_secondary_contact: 0
19:04:12 346162 TRACE state.c:254: state.xlog_lag : -1
19:04:12 346162 TRACE state.c:256: state.keeper_is_paused: 0
19:04:12 346162 TRACE state.c:257: state.pg_version: 0
19:04:12 346162 DEBUG keeper_config.c:881: mkdir -p "/pg_data/17-test/backup/node_3"
19:04:12 346162 DEBUG keeper_config.c:759: keeper_config_update: backup directory = /pg_data/17-test/backup/node_3
19:04:12 346162 TRACE keeper_config.c:558: keeper_config_write_file "/export/home/postgresql/.config/pg_autoctl/pg_data/17-test/instance/pg_autoctl.cfg"
19:04:12 346162 TRACE pgsetup.c:455: Failed to open file "/pg_data/17-test/instance/postmaster.pid": No such file or directory
19:04:12 346162 TRACE pgsetup.c:455: Failed to open file "/pg_data/17-test/instance/postmaster.pid": No such file or directory
19:04:12 346162 TRACE pgsetup.c:455: Failed to open file "/pg_data/17-test/instance/postmaster.pid": No such file or directory
19:04:12 346162 INFO  state.c:693: Writing keeper init state file at "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.init"
19:04:12 346162 DEBUG state.c:694: keeper_init_state_create: version = 1
19:04:12 346162 DEBUG state.c:696: keeper_init_state_create: pgInitState = PGDATA does not exist
19:04:12 346162 DEBUG pgsql.c:1032: COMMIT;
19:04:12 346162 DEBUG pgsql.c:459: Disconnecting from [monitor] "postgres://[email protected]:3000/pg_auto_failover?sslmode=require"
19:04:12 346162 INFO  keeper_pg_init.c:237: Successfully registered as "single" to the monitor.
19:04:12 346162 TRACE keeper_pg_init.c:462: reach_initial_state: init to single
19:04:12 346162 INFO  fsm.c:814: FSM transition from "init" to "single": Start as a single node
19:04:12 346162 INFO  fsm_transition.c:72: Initialising postgres as a primary
19:04:12 346162 DEBUG state.c:812: Reading current init state from "/export/home/postgresql/.local/share/pg_autoctl/pg_data/17-test/instance/pg_autoctl.init"
19:04:12 346162 INFO  pgctl.c:1569: Initialising a PostgreSQL cluster at "/pg_data/17-test/instance"
19:04:12 346162 INFO  pgctl.c:1570: /usr/lib/postgresql/17/bin/pg_ctl initdb -s -D /pg_data/17-test/instance --option '--auth=trust'
19:04:12 346162 ERROR pgctl.c:1552: pg_ctl: too many command-line arguments (first is "--silent")
19:04:12 346162 ERROR pgctl.c:1552: Try "pg_ctl --help" for more information.
19:04:12 346162 FATAL pgctl.c:1585: Failed to initialize Postgres cluster at "/pg_data/17-test/instance", see above for details
19:04:12 346162 FATAL fsm_transition.c:123: Failed to initialize a PostgreSQL instance at "/pg_data/17-test/instance", see above for details
19:04:12 346162 DEBUG fsm.c:832: Transition function returned: false
19:04:12 346162 ERROR fsm.c:853: Failed to transition from state "init" to state "single", see above.
19:04:12 346159 ERROR supervisor.c:692: pg_autoctl service node-active exited with exit status 12
19:04:12 346159 DEBUG supervisor.c:829: supervisor_may_restart: service "node-active" restarted 1 times, most recently at Mon Mar 31 19:04:12 2025, 0 seconds ago
19:04:12 346159 INFO  supervisor.c:777: Restarting service node-active

pg_auto_failover documentation says that it works on PG17...
May I do something wrong ?

Many thanks for your reply !

Patrick.

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