I'm trying to install postgresql 9.3 in my ubuntu lucid machine. The problem is that I'm getting this error when running apt-get install postgresql-9.3

=> apt-get install postgresql-9.3
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
Suggested packages:
  oidentd ident-server locales-all postgresql-doc-9.3
The following NEW packages will be installed:
  postgresql-9.3 postgresql-client-9.3
0 upgraded, 2 newly installed, 0 to remove and 700 not upgraded.
Need to get 8,944 kB of archives.
After this operation, 23.6 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://apt.postgresql.org/pub/repos/apt/ lucid-pgdg/main postgresql-client-9.3 amd64 9.3.2-1.pgdg10.4+1 [2,186 kB]
Get:2 http://apt.postgresql.org/pub/repos/apt/ lucid-pgdg/main postgresql-9.3 amd64 9.3.2-1.pgdg10.4+1 [6,758 kB]
Fetched 8,944 kB in 6s (1,294 kB/s)
Selecting previously unselected package postgresql-client-9.3.
(Reading database ... 48797 files and directories currently installed.)
Unpacking postgresql-client-9.3 (from .../postgresql-client-9.3_9.3.2-1.pgdg10.4+1_amd64.deb) ...
Selecting previously unselected package postgresql-9.3.
Unpacking postgresql-9.3 (from .../postgresql-9.3_9.3.2-1.pgdg10.4+1_amd64.deb) ...
Setting up postgresql-client-9.3 (9.3.2-1.pgdg10.4+1) ...
update-alternatives: error: alternative pg_basebackup.1.gz can't be slave of psql.1.gz: it is a slave of postmaster.1.gz
dpkg: error processing postgresql-client-9.3 (--configure):
 subprocess installed post-installation script returned error exit status 2
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of postgresql-9.3:
 postgresql-9.3 depends on postgresql-client-9.3; however:
  Package postgresql-client-9.3 is not configured yet.
dpkg: error processing postgresql-9.3 (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

I've been searching on google for two hours without solving the problem. Why is this happening and how could I solve it?

  • Do you have a different (older) version of PostgreSQL installed? Remove it first. Dec 23 '13 at 0:10
  • Yes. I'm trying to upgrade from 9.1 to 9.3 on a production server. So I was hoping to do some kind of "hot swap" with no downtime. Dec 23 '13 at 0:11
  • 1
    @MichaelHampton Can I remove my current version using apt-get remove postgresql-9.1 without losing any data? Dec 23 '13 at 0:20
  • @Oleander There are no database file differences between PG minor versions (eg, 9.1 => 9.3) so you do not need to do a full dump and restore. I would shutdown postgres, take a full backup of the database files (eg, tar czf /backup/pg.tgz /path/to/pgfiles/) then upgrade and restore the backup. You're playing with fire doing this on a production server though. I do not recommend proceeding until you completely understand the process, and have tested it on another box first.
    – fukawi2
    Dec 23 '13 at 4:35
  • @fukawi2 9.1 and 9.3 are major versions though, full dump and restore are needed (at least), but maybe pg_upgrade could help. Dec 23 '13 at 8:01

It seems there was a bug in the 9.1 packages, but it should be fixed.

As indicated in the linked thread the issue could be resolved by running :

update-alternatives --remove postmaster.1.gz /usr/share/postgresql/9.1/man/man1/postmaster.1.gz

and then reinstalling postgresql-9.1:

apt-get install -f
apt-get install --reinstall postgresql-9.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.