前言
最近在卸載PostgreSQL數(shù)據(jù)庫的出錯(cuò)了,無奈只能一步步的進(jìn)行排查分析解決,下面將解決的過程分享出來,給同樣遇到這個(gè)問題的朋友們參考學(xué)習(xí),下面話不多說了,來一起看看詳細(xì)的介紹吧。
出錯(cuò)輸出:
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):
子進(jìn)程 已安裝 pre-removal 腳本 返回了錯(cuò)誤號(hào) 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):
子進(jìn)程 已安裝 pre-removal 腳本 返回了錯(cuò)誤號(hào) 2
/var/lib/dpkg/info/postgresql-client-9.1.postinst: 7: .: Can't open /usr/share/postgresql-common/maintscripts-functions
dpkg:清理時(shí)出錯(cuò):
子進(jìn)程 已安裝 post-installation 腳本 返回了錯(cuò)誤號(hào) 2
在處理時(shí)有錯(cuò)誤發(fā)生:
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
(正在讀取數(shù)據(jù)庫 ... 系統(tǒng)當(dāng)前共安裝有 146453 個(gè)文件和目錄。)
Removing postgresql-9.1 (9.1.18-0ubuntu0.12.04) ...
Removing postgresql-client-9.1 (9.1.18-0ubuntu0.12.04) ...
其實(shí)感覺是第一個(gè)命令刪除了dpkg關(guān)于postgresql的元數(shù)據(jù)信息,然后使用autoremove命令的時(shí)候,dpkg以為postgresql沒有安裝,然后提示卸載成功了。
總結(jié)
以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作能帶來一定的幫助,如果有疑問大家可以留言交流,謝謝大家對(duì)腳本之家的支持。
您可能感興趣的文章:- 在Ubuntu中安裝Postgresql數(shù)據(jù)庫的步驟詳解
- Ubuntu 16.04設(shè)置PostgreSQL開機(jī)啟動(dòng)的方法