如何手动从 Ubuntu 中强制删除软件包?

如何手动从 Ubuntu 中强制删除软件包?

我在 ServerFault 上发布了这篇文章,并得到了一些看起来有帮助的问题,但没有回答我能做什么。在低水平上,我可以做什么来完全消除干扰能力升级的软件包?

--

libssl-dev安装了一个软件包,可能是因为我不确定是否绕过了软件包管理器,并且它从软件包管理器中可见,但不会消失。

root@li393-189:/home/jonathan/python-amazon-product-api-0.2.5# aptitude purge l
ibssl-dev
The following packages will be REMOVED:  
  libssl-dev{p} 
The following partially installed packages will be configured:
  apt 
0 packages upgraded, 0 newly installed, 1 to remove and 84 not upgraded.
Need to get 0 B of archives. After unpacking 4,929 kB will be freed.
Do you want to continue? [Y/n/?] Y
Setting up apt (0.8.16~exp12ubuntu10.10) ...
gpg: Invalid option "--primary-keyring"
gpg: [don't know]: invalid packet (ctb=03)
gpg: read_keyblock: read error: invalid packet
gpg: enum_keyblocks(read) failed: invalid keyring
gpg: WARNING: nothing exported
dpkg: error processing apt (--configure):
 subprocess installed post-installation script returned error exit status 2
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 apt
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up apt (0.8.16~exp12ubuntu10.10) ...
gpg: Invalid option "--primary-keyring"
gpg: [don't know]: invalid packet (ctb=03)
gpg: read_keyblock: read error: invalid packet
gpg: enum_keyblocks(read) failed: invalid keyring
gpg: WARNING: nothing exported
dpkg: error processing apt (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 apt

我希望将当前安装的 libssl-dev 替换为新的软件包安装。我见过的 aptitude 配置还没有将其删除。

如何删除现有的软件包以便能够从头开始重新安装?

- 编辑 -

@Brigo,我尝试过使用 aptitude 而不仅仅是 apt-get,但是 apt-get 在我看来给出了一个明显的等价物:

root@li393-189:/home/jonathan/python-amazon-product-api-0.2.5# apt-get remove l我希望将当前安装的 libssl-dev 替换为新的软件包安装。我见过的 aptitude 配置还没有将其删除。

如何删除现有的软件包以便能够从头开始重新安装?

- 编辑 -

@Brigo,我尝试过使用 aptitude 而不仅仅是 apt-get,但是 apt-get 在我看来给出了一个明显的等价物:

root@li393-189:/home/jonathan/python-amazon-product-api-0.2.5# apt-get 删除 l
ibssl 开发
正在阅读包裹清单...完成
构建依赖树       
读取状态信息...完成
以下软件包将被删除:
  libssl 开发
0 已升级,0 已新安装,1 已删除,84 未升级。
1 未完全安装或拆卸。
执行此操作后,将释放 4,929 kB 磁盘空间。
您想继续[Y/n]吗?是
设置 apt (0.8.16~exp12ubuntu10.10) ...
gpg:gpg:无效选项“--primary-keyring”
[不知道]:无效数据包(ctb=03)
gpg:read_keyblock:读取错误:无效数据包
gpg:enum_keyblocks(读取)失败:无效的密钥环
gpg:警告:没有导出任何内容
dpkg:处理 apt 时出错(--configure):
 子进程安装的安装后脚本返回错误退出状态 2
处理时遇到错误:
 易于
E: 子进程 /usr/bin/dpkg 返回错误代码 (1)
root@li393-189:/home/jonathan/python-amazon-product-api-0.2.5#

- 编辑 -

这是建议的输出sh -x /usr/bin/apt-key update

root@li393-189:~# sh -x /usr/bin/apt-key update + 设置-e + 取消设置 GREP_OPTIONS + 临时文件 + 秘密密钥环=/tmp/tmp.yKRn2OqlH3 + trap rm -f '/tmp/tmp.yKRn2OqlH3' 0 HUP INT 退出 ILL ABRT FPE SEGV 管道术语 + GPG_CMD=gpg --忽略时间冲突 --no-options --no-default-keyring --secret-keyring /tmp/tmp.yKRn2OqlH3 + id -u + [ 0 -eq 0 ] + GPG_CMD=gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.yKRn2OqlH3 --trustdb-name /etc/apt/trustdb.gpg + GPG=gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.yKRn2OqlH3 --trustdb-name /etc/apt/trustdb.gpg + MASTER_KEYRING=/usr/share/keyrings/ubuntu-master-keyring.gpg + ARCHIVE_KEYRING=/usr/share/keyrings/ubuntu-archive-keyring.gpg + REMOVED_KEYS=/usr/share/keyrings/ubuntu-archive-removed-keys.gpg + ARCHIVE_KEYRING_URI=http://archive.ubuntu.com/ubuntu/project/ubuntu-archive-keyring.gpg + TMP_KEYRING=/var/lib/apt/keyrings/maybe-import-keyring.gpg + [ 更新 = --keyring ] + TRUSTEDFILE=/etc/apt/trusted.gpg + apt-config shell TRUSTEDFILE Apt::GPGV::TrustedKeyring + 评估 + apt-config shell TRUSTEDFILE Dir::Etc::Trusted/f + eval TRUSTEDFILE='/etc/apt/trusted.gpg' + TRUSTEDFILE=/etc/apt/trusted.gpg + [ -r /etc/apt/trusted.gpg ] + GPG=gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.yKRn2OqlH3 --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg + GPG=gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.yKRn2OqlH3 --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg + TRUSTEDPARTS=/etc/apt/trusted.gpg.d + apt-config shell TRUSTEDPARTS Dir::Etc::TrustedParts/d + eval TRUSTEDPARTS='/etc/apt/trusted.gpg.d/' + TRUSTEDPARTS=/etc/apt/trusted.gpg.d/ + [ -d /etc/apt/trusted.gpg.d/ ] + run-parts --list /etc/apt/trusted.gpg.d/ --regex ^.*\.gpg$ + 命令=更新 + [ -z 更新 ] + 移位 + [更新!=帮助] + 哪个GPG + 更新 + [ ! -f /usr/share/keyrings/ubuntu-archive-keyring.gpg ] + 需要根目录 + id -u + [ 0 -ne 0 ] + gpg --ignore-time-conflict --no-options+ --no-default-keyring --secret-keyring /tmp/tmp.yKRn2OqlH3gpg --trustdb-name /etc/apt/trustdb.gpg --ignore-time -conflict --no-options --no-default-keyring --quiet --batch --secret-keyring /tmp/tmp.yKRn2OqlH3 --keyring --trustdb-name /etc/apt/trustdb.gpg /usr/共享/keyrings/ubuntu-archive-keyring.gpg --keyring /etc/apt/trusted.gpg --export --primary-keyring /etc/apt/trusted.gpg - 进口 gpg:无效选项“--primary-keyring” gpg: [不知道]: 无效数据包 (ctb=03) gpg:read_keyblock:读取错误:无效数据包 gpg:enum_keyblocks(读取)失败:无效的密钥环 gpg:警告:没有导出任何内容 + rm -f /tmp/tmp.yKRn2OqlH3

答案1

成立这个方法关于超级用户:

 sudo dpkg --remove --force-remove-reinstreq libssl-dev

相关内容