请帮我弄清楚为什么postgresql不善于更新。我在SO或Google上找不到任何能解决这个问题的方法。这是一个生产服务器,发行版重新安装实际上不是一个选项。apt-获取安装-f和apt自动清洗/检查将告诉您使用apt安装-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# >发布于 2015-05-19 18:27:46
我就是这样解决问题的:
` `dpkg -l \ grep postgres
将显示已安装的postgresql包。运行:
sudo apt-get --purge remove 在删除后,使用每个包名(由空格分隔)。
root@vps1484:/home# dpkg -l | grep postgres
ii postgresql 9.3+146really9.1+148 all object-relational SQL database (supported version)
ii postgresql-9.1 9.1.13-0ubuntu0.13.10 amd64 object-relational SQL database, version 9.1 server
ii postgresql-client 9.3+146really9.1+148 all front-end programs for PostgreSQL (supported version)
ii postgresql-client-9.1 9.1.13-0ubuntu0.13.10 amd64 front-end programs for PostgreSQL 9.1
ii postgresql-client-common 148 all manager for multiple PostgreSQL client versions
ii postgresql-common 148 all PostgreSQL database-cluster manager
ii postgresql-contrib 9.3+146really9.1+148 all additional facilities for PostgreSQL (supported version)
iU postgresql-contrib-9.1 9.1.15-0ubuntu0.12.04 amd64 additional facilities for PostgreSQL
root@vps1484:/home# sudo apt-get --purge remove postgresql postgresql-9.1 postgresql-client postgresql-client-9.1 postgresql-client-comment postgresql-common postgresql-contrib postgresql-contrib-9.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package postgresql-client-comment
root@vps1484:/home# sudo apt-get --purge remove postgresql postgresql-9.1 postgresql-client postgresql-client-9.1 postgresql-client-common postgresql
-common postgresql-contrib postgresql-contrib-9.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libaio1
Use 'apt-get autoremove' to remove it.
The following packages will be REMOVED:
postgresql* postgresql-9.1* postgresql-client* postgresql-client-9.1* postgresql-client-common* postgresql-common* postgresql-contrib*
postgresql-contrib-9.1*
0 upgraded, 0 newly installed, 8 to remove and 8 not upgraded.
1 not fully installed or removed.
After this operation, 16.3 MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 98720 files and directories currently installed.)
Removing postgresql-contrib ...
Removing postgresql-contrib-9.1 ...
Removing postgresql ...
Removing postgresql-9.1 ...
* Stopping PostgreSQL 9.1 database server [ OK ]
Purging configuration files for postgresql-9.1 ...
Dropping cluster main...
Removing postgresql-client ...
Removing postgresql-client-9.1 ...
update-alternatives: warning: alternative /usr/share/postgresql/9.1/man/man1/psql.1.gz (part of link group psql.1.gz) doesn't exist; removing from list of alternatives
update-alternatives: warning: /etc/alternatives/psql.1.gz is dangling; it will be updated with best choice
Removing postgresql-common ...
* No PostgreSQL clusters exist; see "man pg_createcluster"
Removing 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
Purging configuration files for postgresql-common ...
dpkg: warning: while removing postgresql-common, directory '/var/lib/postgresql' not empty so not removed
Removing postgresql-client-common ...
Purging configuration files for postgresql-client-common ...
Processing triggers for man-db ...发布于 2019-06-10 06:07:39
转到这个位置cd /var/lib/dpkg
删除所有sudo rm -f postgresql-*
请注意,这不是一个正确的方法,但它是有效的。这是因为您没有正确卸载PostgreSQL。
https://dba.stackexchange.com/questions/101776
复制相似问题