LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-17-2013, 12:59 AM   #1
Doug Hutcheson
Member
 
Registered: Jun 2009
Location: Philippines
Distribution: Fedora 36; Homebrew desktop with Ryzen 5600G and 32Gb. Using Red Hat since 1998
Posts: 304

Rep: Reputation: 22
Postgresql 9.2 will not run with a 9.1 database


I have just upgraded my Fedora system from 17 to 19. In the process, my version of Postgresql was upgraded from 9.1 to 9.2.

In the documentation at http://www.postgresql.org/docs/9.2/s...upgrading.html, it says
Quote:
To update between compatible versions, you simply replace the executables while the server is down and restart the server. The data directory remains unchanged — minor upgrades are that simple.
On my upgraded system, the postgresql.service fails to start. The status looks like this:
Code:
[root@cardraeh ~]# systemctl status postgresql.service
postgresql.service - PostgreSQL database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled)
   Active: failed (Result: exit-code) since Sat 2013-08-17 15:19:16 EST; 56s ago
  Process: 21885 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=1/FAILURE)

Aug 17 15:19:15 cardraeh.farm.home systemd[1]: Starting PostgreSQL database server...
Aug 17 15:19:16 cardraeh.farm.home systemd[1]: postgresql.service: control process exited, code=exited status=1
Aug 17 15:19:16 cardraeh.farm.home systemd[1]: Failed to start PostgreSQL database server.
Aug 17 15:19:16 cardraeh.farm.home systemd[1]: Unit postgresql.service entered failed state.
/var/log/messages looks like this:
Code:
Aug 17 15:19:15 cardraeh postgresql-check-db-dir[21885]: An old version of the database format was found.
Aug 17 15:19:16 cardraeh postgresql-check-db-dir[21885]: Use "postgresql-setup upgrade" to upgrade to version 9.2.
Aug 17 15:19:16 cardraeh postgresql-check-db-dir[21885]: See /usr/share/doc/postgresql-9.2.4/README.rpm-dist for more information.
Aug 17 15:19:16 cardraeh systemd[1]: postgresql.service: control process exited, code=exited status=1
Aug 17 15:19:16 cardraeh systemd[1]: Unit postgresql.service entered failed state.
Running "postgresql-setup upgrade" gives this:
Code:
[root@cardraeh ~]# postgresql-setup upgrade
Redirecting to /bin/systemctl stop  postgresql.service
Upgrading database: failed

See /var/lib/pgsql/pgupgrade.log for details.
The pgupgrade.log looks like this:
Code:
Performing Consistency Checks
-----------------------------
Checking current, bin, and data directories                 ok
Checking cluster versions                                   ok

connection to database failed: fe_sendauth: no password supplied


could not connect to old postmaster started with the command:
"/usr/lib64/pgsql/postgresql-9.1/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_directory='/var/lib/pgsql'" start
Failure, exiting
It looks as though I have to specify a password to the postgresql-setup process, but there is no man page for postgresql-setup and running it with -h does not help:
Code:
[root@cardraeh ~]# postgresql-setup -h
Usage: /bin/postgresql-setup {initdb|upgrade} [ service_name ]
The only way I can get the service to start is to initialise a new 9.2 data instance. Because I failed to do a pg_dumpall before upgrading Fedora, I don't have a dumped instance of the database, so I can't recreate the database cluster in 9.2.

What am I doing wrong? Where do I start to debug this problem?

Any and all help will be gratefully received.
 
Old 08-17-2013, 01:04 PM   #2
PECONET009
Member
 
Registered: Sep 2006
Location: Finland.
Distribution: kali linux.
Posts: 156

Rep: Reputation: 21
Lightbulb Upgrade from fedora 17 to 19 is not good..

Quote:
Originally Posted by Doug Hutcheson View Post
I have just upgraded my Fedora system from 17 to 19. In the process, my version of Postgresql was upgraded from 9.1 to 9.2.

In the documentation at http://www.postgresql.org/docs/9.2/s...upgrading.html, it says

On my upgraded system, the postgresql.service fails to start. The status looks like this:
Code:
[root@cardraeh ~]# systemctl status postgresql.service
postgresql.service - PostgreSQL database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled)
   Active: failed (Result: exit-code) since Sat 2013-08-17 15:19:16 EST; 56s ago
  Process: 21885 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=1/FAILURE)

Aug 17 15:19:15 cardraeh.farm.home systemd[1]: Starting PostgreSQL database server...
Aug 17 15:19:16 cardraeh.farm.home systemd[1]: postgresql.service: control process exited, code=exited status=1
Aug 17 15:19:16 cardraeh.farm.home systemd[1]: Failed to start PostgreSQL database server.
Aug 17 15:19:16 cardraeh.farm.home systemd[1]: Unit postgresql.service entered failed state.
/var/log/messages looks like this:
Code:
Aug 17 15:19:15 cardraeh postgresql-check-db-dir[21885]: An old version of the database format was found.
Aug 17 15:19:16 cardraeh postgresql-check-db-dir[21885]: Use "postgresql-setup upgrade" to upgrade to version 9.2.
Aug 17 15:19:16 cardraeh postgresql-check-db-dir[21885]: See /usr/share/doc/postgresql-9.2.4/README.rpm-dist for more information.
Aug 17 15:19:16 cardraeh systemd[1]: postgresql.service: control process exited, code=exited status=1
Aug 17 15:19:16 cardraeh systemd[1]: Unit postgresql.service entered failed state.
Running "postgresql-setup upgrade" gives this:
Code:
[root@cardraeh ~]# postgresql-setup upgrade
Redirecting to /bin/systemctl stop  postgresql.service
Upgrading database: failed

See /var/lib/pgsql/pgupgrade.log for details.
The pgupgrade.log looks like this:
Code:
Performing Consistency Checks
-----------------------------
Checking current, bin, and data directories                 ok
Checking cluster versions                                   ok

connection to database failed: fe_sendauth: no password supplied


could not connect to old postmaster started with the command:
"/usr/lib64/pgsql/postgresql-9.1/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_directory='/var/lib/pgsql'" start
Failure, exiting
It looks as though I have to specify a password to the postgresql-setup process, but there is no man page for postgresql-setup and running it with -h does not help:
Code:
[root@cardraeh ~]# postgresql-setup -h
Usage: /bin/postgresql-setup {initdb|upgrade} [ service_name ]
The only way I can get the service to start is to initialise a new 9.2 data instance. Because I failed to do a pg_dumpall before upgrading Fedora, I don't have a dumped instance of the database, so I can't recreate the database cluster in 9.2.

What am I doing wrong? Where do I start to debug this problem?

Any and all help will be gratefully received.
Have you backed up your data?
You might need to do a FULL install of Fedora 19 instead of an upgrade.
During the upgrade between Fedora 17 and Fedora 19 you might have noticed (if you were looking as it was upgrading) that it could not upgrade some items due to some changes of features in Fedora 19.
If you do a FULL install of fedora 19, your postgresql might just about work as it should.
Hope it all works out for you.
 
Old 08-17-2013, 01:52 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,633

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Doug Hutcheson View Post
I have just upgraded my Fedora system from 17 to 19. In the process, my version of Postgresql was upgraded from 9.1 to 9.2.

The only way I can get the service to start is to initialise a new 9.2 data instance. Because I failed to do a pg_dumpall before upgrading Fedora, I don't have a dumped instance of the database, so I can't recreate the database cluster in 9.2.

What am I doing wrong? Where do I start to debug this problem?
It looks like you've covered all your bases, but there is a bug report on the RedHat Bugzilla site that appears to be related:
https://bugzilla.redhat.com/show_bug.cgi?id=896161

...and it specifically mentions Fedora 17 to 19 upgrades. The tips in there may help you. Also, the pg_upgrade tool may be of use as well:
http://www.postgresql.org/docs/curre...pgupgrade.html
 
Old 08-18-2013, 01:07 AM   #4
Doug Hutcheson
Member
 
Registered: Jun 2009
Location: Philippines
Distribution: Fedora 36; Homebrew desktop with Ryzen 5600G and 32Gb. Using Red Hat since 1998
Posts: 304

Original Poster
Rep: Reputation: 22
Thanks for the helpful replies.

Quote:
Originally Posted by TB0ne View Post
It looks like you've covered all your bases, but there is a bug report on the RedHat Bugzilla site that appears to be related:
https://bugzilla.redhat.com/show_bug.cgi?id=896161
Yes, it does look like the same issue. Thanks for posting. I don't see how to apply a fix, though.
Quote:
Originally Posted by TB0ne View Post
Also, the pg_upgrade tool may be of use as well:
http://www.postgresql.org/docs/curre...pgupgrade.html
Trouble is, this requires me to have a repository of Postgres 9.1 binaries, which I think is at /usr/lib64/pgsql/postgresql-9.1/bin. When I invoke pg_upgrade, I get this:
Code:
bash-4.2$ pg_upgrade -d data_9.1 -D data -b /usr/lib64/pgsql/postgresql-9.1/bin -B /bin
Performing Consistency Checks
-----------------------------
Checking current, bin, and data directories                 ok
Checking cluster versions                                   ok

connection to database failed: fe_sendauth: no password supplied


could not connect to old postmaster started with the command:
"/usr/lib64/pgsql/postgresql-9.1/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "data_9.1" -o "-p 50432 -b  -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directory='/var/lib/pgsql'" start
Failure, exiting
I notice that the command line for the old database includes '-p 50432', whereas postgres usually runs at 5432. Not sure if this is a problem, as I am not sure of what pg_upgrade is trying to do (I assume it tries to start the old postgres on port 50432 and the new one at 5432, so it can draw data from the old server and pump it straight into the new version, but that is a guess on my behalf).

I feel the answer may be to reinstall version 9.1, run pg_dumpall, then reinstall 9.2 and load the dump. How do I force an install of 9.1 over the top of 9.2 on my Fedora 19 system?

Later:
I managed to coerce the system to boot 9.1 and 9.2 instances on their respective databases and was then able to run pg_dumpall, to extract my data from the old db. I was then able to run psql -f <dumpfile> postgres. All is now as I want it.

Thanks for those who helped me clarify my thinking.

Last edited by Doug Hutcheson; 08-18-2013 at 01:52 AM. Reason: Solved it!
 
Old 08-18-2013, 10:37 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,633

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Doug Hutcheson View Post
Thanks for the helpful replies.
Yes, it does look like the same issue. Thanks for posting. I don't see how to apply a fix, though
There is a package listed, released 8/15/2013, postgresql-9.2.4.7.fc19. Which version do you have? You can download it here:
http://koji.fedoraproject.org/koji/p...?packageID=655

Quote:
Trouble is, this requires me to have a repository of Postgres 9.1 binaries, which I think is at /usr/lib64/pgsql/postgresql-9.1/bin.
No worries. First, be sure to copy your postgresql data files (i.e. your databases) to a different location, just to be safe. Then, remove the existing postgresql 9.2 packages manually, either through your GUI based package manager or RPM. After that, you can scroll down on the link given above, and download a 9.1 package and install it. From there, you can fire up your old 9.1 database and do an export (in case its needed), then try the patched 9.2 packages above.

Quote:
I notice that the command line for the old database includes '-p 50432', whereas postgres usually runs at 5432. Not sure if this is a problem, as I am not sure of what pg_upgrade is trying to do (I assume it tries to start the old postgres on port 50432 and the new one at 5432, so it can draw data from the old server and pump it straight into the new version, but that is a guess on my behalf).

I feel the answer may be to reinstall version 9.1, run pg_dumpall, then reinstall 9.2 and load the dump. How do I force an install of 9.1 over the top of 9.2 on my Fedora 19 system?

Later:
I managed to coerce the system to boot 9.1 and 9.2 instances on their respective databases and was then able to run pg_dumpall, to extract my data from the old db. I was then able to run psql -f <dumpfile> postgres. All is now as I want it.

Thanks for those who helped me clarify my thinking.
Well done....I was a bit late answering, though, but glad you got it sorted.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot create database in postgreSQL please help arvindk.monu Linux - Server 1 12-27-2010 02:01 AM
Postgresql database server linuxengineer Linux - Server 3 11-28-2010 10:54 PM
sharing postgresql database manikandan_vs Linux - Newbie 1 10-02-2010 02:30 PM
I need help securing my postgresql database... trist007 Linux - Security 12 01-10-2010 07:38 PM
PostgreSQL database design? justemail Linux - General 1 05-26-2009 08:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration