![xplico 安装失败导致 apt 和 dpkg 损坏](https://linux22.com/image/1184717/xplico%20%E5%AE%89%E8%A3%85%E5%A4%B1%E8%B4%A5%E5%AF%BC%E8%87%B4%20apt%20%E5%92%8C%20dpkg%20%E6%8D%9F%E5%9D%8F.png)
我尝试在 Ubuntu 21.10 中安装适用于 Ubuntu 16.04 的 xplico 版本,sudo bash -c 'echo "deb http://repo.xplico.org/ $(lsb_release -s -c) main" >> /etc/apt/sources.list' && sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 791C25CE && sudo apt update && sudo apt install xplico
然后出现“删除后脚本子进程返回错误退出状态 127”错误。
xplico 安装失败后,出现此错误消息,并且无法安装或删除其他应用程序,因为必须先删除 xplico:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
xplico
0 upgraded, 0 newly installed, 1 to remove and 52 not upgraded.
1 not fully installed or removed.
After this operation, 86.8 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 213087 files and directories currently installed.)
Removing xplico (1.2.2) ...
/var/lib/dpkg/info/xplico.postrm: 23: /etc/apache2: Permission denied
dpkg: error processing package xplico (--remove):
installed xplico package post-removal script subprocess returned error exit status 127
dpkg: too many errors, stopping
Errors were encountered while processing:
xplico
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
我应该怎么办?
答案1
您需要删除 xplico 软件包,但您安装的 xplico 版本适用于 Ubuntu 16.04,而您正在运行 Ubuntu 21.10。也许这就是您收到post-removal script subprocess returned error exit status 127
错误消息的原因。exit status 127
是过期密钥的退出代码。过期密钥来自 2016 年,我没有找到任何更新它的方法,但您可以在不更新过期密钥的情况下恢复 apt 和 dpkg 的正常使用。
删除您在尝试安装 xplico 时添加的过期密钥。
sudo apt-key del 791C25CE
在 nano 文本编辑器中编辑
/var/lib/dpkg/info/xplico.postrm
(如果存在)并将sudoedit /var/lib/dpkg/info/xplico.postrm
其内容替换为:#!/bin/bash set -e /bin/true
Nano 文本编辑器键盘快捷键
使用键盘组合键Ctrl+O然后按 将Enter文件保存到当前位置。
使用键盘组合键Ctrl+X退出 nano。编辑你的文件
/var/lib/dpkg/status
,删除 xplico 及其描述,并保存更改/var/lib/dpkg/status
。然后运行sudo dpkg --configure -a && sudo apt -f install
。上述命令可能不起作用。如果是这样,请运行以下附加命令来强制卸载 xplico。
sudo mv /var/lib/dpkg/info/postinst /var/lib/dpkg/info/postinst.bak sudo mv /var/lib/dpkg/info/postrm /var/lib/dpkg/info/postrm.bak sudo mv /var/lib/dpkg/info/preinst /var/lib/dpkg/info/preinst.bak sudo dpkg --remove --force-remove-reinstreq xplico
然后尝试使用以下方法更新系统sudo apt update