Please help me figure out why postgresql isn't playing nice with updating. I can't find anything on SO or Google that remedies this problem. This is a production server and a distribution reinstall is not really an option. apt-get install -f and apt-get autoclean/check will tell you to use apt-get install -f.
root@vps1484:/home# apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
libaio1
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
postgresql-9.1
Suggested packages:
oidentd ident-server locales-all
The following packages will be upgraded:
postgresql-9.1
1 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.
1 not fully installed or removed.
Need to get 0 B/4317 kB of archives.
After this operation, 193 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 98727 files and directories currently installed.)
Preparing to replace postgresql-9.1 9.1.13-0ubuntu0.13.10 (using .../postgresql-9.1_9.1.15-0ubuntu0.12.04_amd64.deb) ...
* Stopping PostgreSQL 9.1 database server [ OK ]
Unpacking replacement postgresql-9.1 ...
dpkg: error processing /var/cache/apt/archives/postgresql-9.1_9.1.15-0ubuntu0.12.04_amd64.deb (--unpack):
trying to overwrite '/usr/share/postgresql/9.1/man/man1/pg_basebackup.1.gz', which is also in package postgresql-client-9.1 9.1.13-0ubuntu0.13.10
Errors were encountered while processing:
/var/cache/apt/archives/postgresql-9.1_9.1.15-0ubuntu0.12.04_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@vps1484:/home# sudo rm /usr/share/postgresql/9.1/man/man1/*
root@vps1484:/home# sudo rm /var/cache/apt/archives/*
rm: cannot remove '/var/cache/apt/archives/partial': Is a directory
root@vps1484:/home# sudo rmdir /var/cache/apt/archives
rmdir: failed to remove '/var/cache/apt/archives': Directory not empty
root@vps1484:/home# apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
libaio1
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
postgresql-9.1
Suggested packages:
oidentd ident-server locales-all
The following packages will be upgraded:
postgresql-9.1
1 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.
1 not fully installed or removed.
Need to get 4317 kB of archives.
After this operation, 193 kB disk space will be freed.
Do you want to continue [Y/n]? y
Get:1 http://ca.archive.ubuntu.com/ubuntu/ precise-security/main postgresql-9.1 amd64 9.1.15-0ubuntu0.12.04 [4317 kB]
Fetched 4317 kB in 0s (5940 kB/s)
(Reading database ... 98727 files and directories currently installed.)
Preparing to replace postgresql-9.1 9.1.13-0ubuntu0.13.10 (using .../postgresql-9.1_9.1.15-0ubuntu0.12.04_amd64.deb) ...
* Stopping PostgreSQL 9.1 database server [ OK ]
Unpacking replacement postgresql-9.1 ...
dpkg: error processing /var/cache/apt/archives/postgresql-9.1_9.1.15-0ubuntu0.12.04_amd64.deb (--unpack):
trying to overwrite '/usr/share/postgresql/9.1/man/man1/pg_basebackup.1.gz', which is also in package postgresql-client-9.1 9.1.13-0ubuntu0.13.10
Errors were encountered while processing:
/var/cache/apt/archives/postgresql-9.1_9.1.15-0ubuntu0.12.04_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@vps1484:/home# >
Best Answer
This is how I fixed my issue:
`dpkg -l | grep postgres
will show you the postgresql packages that have been installed. Run:
with each package name, separated by a space, following remove.