当我尝试使用apt
或安装新包时apt-get
,我收到以下错误消息:
$ sudo apt install sl
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
因此,我遵循以下说明:
$ dpkg --configure -a
dpkg: error: requested operation requires superuser privilege
$ sudo dpkg --configure -a
Setting up icaclient (13.10.0.20) ...
这花了很长时间,所以过了一段时间后我按下 ctrl+c,结果是这样的:
^Cdpkg: error processing package icaclient (--configure):
installed icaclient package post-installation script subprocess was interrupted
Errors were encountered while processing:
icaclient
所以现在当我再次尝试安装一个包时,它看起来有效了:
$ sudo apt install sl
Reading package lists... Done
Building dependency tree
Reading state information... Done
sl is already the newest version (3.03-17build2).
The following packages were automatically installed and are no longer required:
libllvm7 linux-headers-4.15.0-50 linux-image-4.15.0-50-generic linux-modules-4.15.0-50-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 398 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
按 Y 键后:
Setting up icaclient (13.10.0.20) ...
Progress: [ 0%]
[...................................................]
现在它又卡住了,我无法通过 ctrl+c 退出。当我关闭终端屏幕时,它会从帖子的开头重复。
我该如何解决这个问题?
nb 我每天都使用 icaclient 应用程序,但我可能会再次安装它。
答案1
它挂在安装后脚本上,如上面的一条错误消息所述。经过一番搜索,我发现安装后脚本存储在/var/lib/dpkg/info/
所以我可以使用以下方法轻松修复它:
sudo rm /var/lib/dpkg/info/icaclient.postinst
之后我必须运行sudo dpkg --configure -a
并删除一些锁文件。
现在 apt 可以正常工作了!