红联Linux门户
Linux帮助

Ubuntu下Postgresql卸载出错的解决办法

发布时间:2015-09-29 15:36:06来源:linux网站作者:TheOneGIS

出错输出:

Removing postgresql-9.1 (9.1.18-0ubuntu0.12.04) ...
/var/lib/dpkg/info/postgresql-9.1.prerm: 9: .: Can't open /usr/share/postgresql-common/maintscripts-functions
dpkg: error processing package postgresql-9.1 (--remove):
子进程 已安装 pre-removal 脚本 返回了错误号 2
dpkg: postgresql-client-9.1: dependency problems, but removing anyway as you requested:
postgresql-9.1 依赖于 postgresql-client-9.1.

Removing postgresql-client-9.1 (9.1.18-0ubuntu0.12.04) ...
/var/lib/dpkg/info/postgresql-client-9.1.prerm: 10: .: Can't open /usr/share/postgresql-common/maintscripts-functions
dpkg: error processing package postgresql-client-9.1 (--remove):
子进程 已安装 pre-removal 脚本 返回了错误号 2
/var/lib/dpkg/info/postgresql-client-9.1.postinst: 7: .: Can't open /usr/share/postgresql-common/maintscripts-functions
dpkg:清理时出错:
子进程 已安装 post-installation 脚本 返回了错误号 2
在处理时有错误发生:
postgresql-9.1
postgresql-client-9.1
E: Sub-process /usr/bin/dpkg returned an error code (1)


使用下面的命令:

sudo rm -r /var/lib/dpkg/info/postgresq*


然后是

sudo apt-get autoremove postgresql*


最后可以看到:

dpkg:警告:files list file for package 'postgresql-9.1' missing; assuming package has no files currently installed
dpkg:警告:files list file for package 'postgresql-client-9.1' missing; assuming package has no files currently installed
(正在读取数据库 ... 系统当前共安装有 146453 个文件和目录。)
Removing postgresql-9.1 (9.1.18-0ubuntu0.12.04) ...
Removing postgresql-client-9.1 (9.1.18-0ubuntu0.12.04) ...


其实感觉是第一个命令删除了dpkg关于postgresql的元数据信息,然后使用autoremove命令的时候,dpkg以为postgresql没有安装,然后提示卸载成功了。


Postgresql 9.1添加用户Ubuntu12.04:http://www.linuxdiyf.com/linux/14379.html

fedora22用rpm包安装配置postgresql数据库:http://www.linuxdiyf.com/linux/13212.html

Fedora21升级到Fedora22后,PostgreSQL无法启动:http://www.linuxdiyf.com/linux/12657.html

CentOS 6.5下PostgreSQL故障切换实现:http://www.linuxdiyf.com/linux/12605.html

Linux安装PostgreSQL 9.4:http://www.linuxdiyf.com/linux/12237.html