Bug 808256 - postgresql-setup upgrade fails with 'invalid old port number'
postgresql-setup upgrade fails with 'invalid old port number'
Status: CLOSED DUPLICATE of bug 802835
Product: Fedora
Classification: Fedora
Component: postgresql (Show other bugs)
All Linux
unspecified Severity medium
: ---
: ---
Assigned To: Tom Lane
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2012-03-29 19:34 EDT by Ian Donaldson
Modified: 2012-03-30 10:00 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-03-30 10:00:22 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Ian Donaldson 2012-03-29 19:34:12 EDT
Description of problem:

Upgrading from FC15 to FC16, postgres wouldn't start and mentioned
we had to run: postgresql-setup upgrade

However this failed and the log contained this:

invalid old port number
Failure, exiting

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. postgresql-setup upgrade
Actual results:

# postgresql-setup upgrade
Redirecting to /bin/systemctl  stop postgresql.service
Upgrading database: failed

See /var/lib/pgsql/pgupgrade.log for details.

# cat /var/lib/pgsql/pgupgrade.log
invalid old port number
Failure, exiting

Expected results:


Additional info:

Inspection of /usr/bin/postgresql-setup shows it extracting the port
from /lib/systemd/system/postgresql.service, but its extraction code
isn't coping with the commented mention of the port in there as well.

A quick fix is to modify this in /usr/bin/postgresql-setup:

--- postgresql-setup.orig       2012-02-27 16:46:03.000000000 +0000
+++ postgresql-setup    2012-03-29 23:13:27.777872259 +0000
@@ -35,8 +35,8 @@
 # Get port number and data directory from the service file
-PGPORT=`sed -n 's/Environment=PGPORT=//p' "${SERVICE_FILE}"`
-PGDATA=`sed -n 's/Environment=PGDATA=//p' "${SERVICE_FILE}"`
+PGPORT=`sed -n 's/^Environment=PGPORT=//p' "${SERVICE_FILE}"`
+PGDATA=`sed -n 's/^Environment=PGDATA=//p' "${SERVICE_FILE}"`
Comment 1 Tom Lane 2012-03-30 10:00:22 EDT
This is dealt with already in 9.1.3-2 and later.

*** This bug has been marked as a duplicate of bug 802835 ***

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