首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >apt无法删除包(postgresql)

apt无法删除包(postgresql)
EN

Unix & Linux用户
提问于 2022-01-12 11:34:35
回答 1查看 2K关注 0票数 0

我试图在我的ubuntu21.10客户端上安装postgres。

代码语言:javascript
复制
sudo apt install postgresql postgresql-contrib

这导致了警告,但我还是决定安装它。这不是一件明智的事情,因为这会导致依赖问题(见下文),并最终导致包崩溃。

我试过:

代码语言:javascript
复制
sudo dpkg --configure -a
sudo apt -f install
sudo apt update
sudo apt autoremove

还有更多。它现在归结为postgresql 13期望某个文件,找不到它并终止卸载(或安装一个新的postgresql版本)。有谁知道如何从这种情况下卸载postgresql并使其变得有序吗?

代码语言:javascript
复制
$ sudo apt remove --purge postgresql
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package 'postgresql' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up postgresql-client-13 (13.5-0ubuntu0.21.10.1) ...
/var/lib/dpkg/info/postgresql-client-13.postinst: 7: .: cannot open /usr/share/postgresql-common/mai
ntscripts-functions: No such file
dpkg: error processing package postgresql-client-13 (--configure):
 installed postgresql-client-13 package post-installation script subprocess returned error exit stat
us 2
Errors were encountered while processing:
 postgresql-client-13
E: Sub-process /usr/bin/dpkg returned an error code (1)

原始安装:

代码语言:javascript
复制
$ sudo apt install postgresql postgresql-contrib
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  postgresql-13 postgresql-client-13
Suggested packages:
  postgresql-doc postgresql-doc-13
The following NEW packages will be installed:
  postgresql postgresql-13 postgresql-client-13 postgresql-contrib
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 16.2 MB of archives.
After this operation, 46.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://nl.archive.ubuntu.com/ubuntu impish-updates/main amd64 postgresql-client-13 amd64 13.5-0ubuntu0.21.10.1 [1,145 kB]
Get:2 http://nl.archive.ubuntu.com/ubuntu impish-updates/main amd64 postgresql-13 amd64 13.5-0ubuntu0.21.10.1 [15.0 MB]
Get:3 http://nl.archive.ubuntu.com/ubuntu impish/main amd64 postgresql all 13+226 [4,624 B]
Get:4 http://nl.archive.ubuntu.com/ubuntu impish/main amd64 postgresql-contrib all 13+226 [4,636 B]
Fetched 16.2 MB in 5s (3,223 kB/s)            
Preconfiguring packages ...
Selecting previously unselected package postgresql-client-13.
dpkg: warning: files list file for package 'postgresql-14' missing; assuming package has no files cu
rrently installed
dpkg: warning: files list file for package 'postgresql-client-common' missing; assuming package has 
no files currently installed
dpkg: warning: files list file for package 'postgresql-client-14' missing; assuming package has no f
iles currently installed
dpkg: warning: files list file for package 'postgresql-common' missing; assuming package has no file
s currently installed
(Reading database ... 444111 files and directories currently installed.)
Preparing to unpack .../postgresql-client-13_13.5-0ubuntu0.21.10.1_amd64.deb ...
Unpacking postgresql-client-13 (13.5-0ubuntu0.21.10.1) ...
Selecting previously unselected package postgresql-13.
Preparing to unpack .../postgresql-13_13.5-0ubuntu0.21.10.1_amd64.deb ...
Unpacking postgresql-13 (13.5-0ubuntu0.21.10.1) ...
Selecting previously unselected package postgresql.
Preparing to unpack .../postgresql_13+226_all.deb ...
Unpacking postgresql (13+226) ...
Selecting previously unselected package postgresql-contrib.
Preparing to unpack .../postgresql-contrib_13+226_all.deb ...
Unpacking postgresql-contrib (13+226) ...
Setting up postgresql-client-13 (13.5-0ubuntu0.21.10.1) ...
/var/lib/dpkg/info/postgresql-client-13.postinst: 7: .: cannot open /usr/share/postgresql-common/mai
ntscripts-functions: No such file
dpkg: error processing package postgresql-client-13 (--configure):
 installed postgresql-client-13 package post-installation script subprocess returned error exit stat
us 2
dpkg: dependency problems prevent configuration of postgresql-13:
 postgresql-13 depends on postgresql-client-13; however:
  Package postgresql-client-13 is not configured yet.

dpkg: error processing package postgresql-13 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of postgresql:
 postgresql depends on postgresql-13; however:
  Package postgresql-13 is not configured yet.

dpkg: error processing package postgresql (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of postgresql-contrib:
 postgresql-contrib depends on postgresql-contrib-13; however:
  Package postgresql-contrib-13 is not installed.
  Package postgresql-13 which provides postgresql-contrib-13 is not configured yet.

dpkg: error processing package postgresql-contrib (--configure):
 dependency problems - leaving unconfigured
Processing triggers for postgresql-comNo apport report written because the error message indicates i
ts a followup error from a previous failure.
                                            No apport report written because the error message indic
ates its a followup error from a previous failure.
                                                  No apport report written because MaxReports is rea
ched already
            mon (232.pgdg21.10+1) ...
Errors were encountered while processing:
 postgresql-client-13
 postgresql-13
 postgresql
 postgresql-contrib
E: Sub-process /usr/bin/dpkg returned an error code (1)

<#>更新

我尝试了@PersianGulf的建议:它确实要求删除postgresql 13,但仍然不能删除它。

代码语言:javascript
复制
$ sudo apt --force-yes remove postgresql-client-13
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  postgresql-client-13
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 3,609 kB disk space will be freed.
W: --force-yes is deprecated, use one of the options starting with --allow instead.
Do you want to continue? [Y/n] 
dpkg: warning: files list file for package 'postgresql-client-common' missing; assuming package has 
no files currently installed
dpkg: warning: files list file for package 'postgresql-client-14' missing; assuming package has no f
iles currently installed
(Reading database ... 446025 files and directories currently installed.)
Removing postgresql-client-13 (13.5-0ubuntu0.21.10.1) ...
/var/lib/dpkg/info/postgresql-client-13.prerm: 11: remove_client_version: not found
dpkg: error processing package postgresql-client-13 (--remove):
 installed postgresql-client-13 package pre-removal script subprocess returned error exit status 127
dpkg: too many errors, stopping
Errors were encountered while processing:
 postgresql-client-13
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
EN

回答 1

Unix & Linux用户

回答已采纳

发布于 2022-01-12 14:29:30

损坏是由于postgresql-client-common的问题。此软件包必须能够卸载其他软件包,但至少有一些内容丢失,从而导致

代码语言:javascript
复制
/var/lib/dpkg/info/postgresql-client-13.postinst: 7: .: cannot open /usr/share/postgresql-common/maintscripts-functions: No such file

dpkg对包的状态相当不满:

代码语言:javascript
复制
dpkg: warning: files list file for package 'postgresql-client-common' missing; assuming package has no files currently installed

要修复这些问题,您需要强制重新安装这个包,也许还需要重新安装postgreql-common

代码语言:javascript
复制
sudo apt reinstall postgreql-client-common

一旦完成,您应该能够删除PostgreSQL 13包。

票数 2
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/686042

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档