我整个周末都在努力将现有的 postgresql 数据库从版本 8.4 升级到 9.1。在我将操作系统从 10.0.4 更新到 12.04 后,我拥有了两个版本的数据库。
我终于被激怒了,在一个错误的判断中,我强行从我的机器上删除了所有 8.4 相关的文件,使用:
find / -type d -name 8.4 2>/dev/null | xargs rm -rf {}
我决定删除它的更好方法是“apt-get remove postgresql-8.4”
当我尝试这样做时,apt-get 报告:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
postgresql-8.4
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 15.5 MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 304184 files and directories currently installed.)
Removing postgresql-8.4 ...
find: `/usr/share/postgresql/8.4/tsearch_data': No such file or directory
dpkg: error processing postgresql-8.4 (--remove):
subprocess installed pre-removal script returned error exit status 1
Errors were encountered while processing:
postgresql-8.4
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)
如何从我的机器上清除 postgresql 8.4?
[[编辑]]
我尝试后apt-get install --reinstall postgresql-8.4,出现以下错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
oidentd ident-server
The following NEW packages will be installed:
postgresql-8.4
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/5,599 kB of archives.
After this operation, 15.5 MB of additional disk space will be used.
Selecting previously unselected package postgresql-8.4.
(Reading database ... 304010 files and directories currently installed.)
Unpacking postgresql-8.4 (from .../postgresql-8.4_8.4.14-0ubuntu12.04.2_amd64.deb) ...
Setting up postgresql-client-8.4 (8.4.14-0ubuntu12.04.2) ...
update-alternatives: error: alternative path /usr/share/postgresql/8.4/man/man1/psql.1.gz doesn't exist.
dpkg: error processing postgresql-client-8.4 (--configure):
subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of postgresql-8.4:
postgresql-8.4 depends on postgresql-client-8.4; however:
Package postgresql-client-8.4 is not configured yet.
dpkg: error processing postgresql-8.4 (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
postgresql-client-8.4
postgresql-8.4
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)
好吧,这真的非常令人讨厌,因为那里有一个依赖嵌套,它不会随着通常的 apt-get purge、apt-get -f install 等一轮而消失。解决这个问题的唯一方法(我重新创建了你在虚拟机中的问题并经过测试)只是在那里放置一个目录以便首先删除。
root@yourbox:/# mkdir -p /usr/share/postgresql/8.4/tsearch_data
root@yourbox:/# apt-get purge postgresql-8.4
root@yourbox:/# apt-get autoremove
Run Code Online (Sandbox Code Playgroud)
由于有一个空目录可供删除,因此在我的虚拟机中,父包的初始清除和子包的自动删除都完成了,没有错误。
| 归档时间: |
|
| 查看次数: |
1702 次 |
| 最近记录: |