Bug 1729938 - postgresql-setup --upgrade is completely broken
Summary: postgresql-setup --upgrade is completely broken
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: postgresql
Version: 30
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Patrik Novotný
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-15 11:23 UTC by mikey
Modified: 2019-07-15 12:13 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:


Attachments (Terms of Use)

Description mikey 2019-07-15 11:23:04 UTC
Description of problem:

The upgrade script appears to not know where to find the PGDATA dir and there appears to be no way of telling it. 

It complains about the /var/lib/psql/data-old directory and the following line was failing:

"/usr/lib64/pgsql/postgresql-10/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/var/lib/pgsql/data-old" -o "-p 5432 -b  -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/var/lib/pgsql'" start

Changing it to: 


sudo -u postgres "/usr/lib64/pgsql/postgresql-10/bin/pg_ctl" -w -l "/var/lib/pgsql/pg_upgrade_server.log" -D "/var/lib/pgsql/data" -o "-p 5432 -b  -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/var/lib/pgsql'" start

Does work for that step but it fails again later looking for data-old.

Using --datadir with the command is deprecated, instead --unit is recommended. 

Running:

sudo -u postgres postgresql-setup --upgrade --unit /usr/lib/systemd/system/postgresql.service

Fails because PGDATA is not set, but it is in the Environment= in that file.

Comment 1 Pavel Raiskup 2019-07-15 12:13:03 UTC
Per postgresql-setup --help:
....
  --unit=UNIT_NAME           The UNIT_NAME is used to select proper unit
                             configuration (unit == service or initscript name
                             on non-systemd systems).  For example, if you want
                             to work with unit called
                             'postgresql@com_example.service', you should use
                             'postgresql@com_example' (without trailing .service
                             string).  When no UNIT_NAME is explicitly passed,
                             the 'postgresql' string is used by default.
...

Yes, we should support both absolute name of service file, and with/without
the `.service` suffix -- but it is not yet supported.


Note You need to log in before you can comment on or make changes to this bug.