如果dpkg删除脚本失败,如何强制删除软件包?


16

我正在尝试删除在其中删除/etc/init.d/disco-master文件的软件包(试图手动删除该软件包)。我要删除disco-master包裹。我现在该怎么做?

这就是我要做的事情sudo apt-get remove disco-master

removing disco-master ...
invoke-rc.d: unknown initscript, /etc/init.d/disco-master not found.
dpkg: error processing disco-master (--remove):
 subprocess installed pre-removal script returned error exit status 100
Errors were encountered while processing:
 disco-master
E: Sub-process /usr/bin/dpkg returned an error code (1)

当我sudo apt-get install --reinstall disco-master得到以下信息时:

You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 disco-master : Depends: disco-node (= 0.4.2+nmu1) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

当我这样做时sudo apt-get -f install

Unpacking disco-node (from .../disco-node_0.4.2+nmu1_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/disco-node_0.4.2+nmu1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/disco/master/ebin/disco.app', which is also in package disco-master 0.4.1
No apport report written because MaxReports is reached already
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/disco-node_0.4.2+nmu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

运行时,sudo apt-get remove disco-node我得到以下信息:

Package disco-node is not installed, so not removed
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 disco-master : Depends: disco-node (= 0.4.1) but it is not going to be installed
                Depends: python-disco (= 0.4.1) but 0.4.2+nmu1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

sudo dpkg -P --force-all disco-master我得到时:

Removing disco-master ...
invoke-rc.d: unknown initscript, /etc/init.d/disco-master not found.
dpkg: error processing disco-master (--purge):
 subprocess installed pre-removal script returned error exit status 100
Errors were encountered while processing:
 disco-master

3
尝试跑步sudo dpkg -P --force-all disco-master
netcoder

那...附加到问题上了。
fodon,2012年

Answers:


18

创建一个虚拟初始化脚本来欺骗dpkg:

sudo nano /etc/init.d/disco-master

输入以下内容:

#!/bin/bash
exit 0

保存文件,设置执行权限(sudo chmod 755 /etc/init.d/disco-master),然后重试sudo apt-get remove disco-master


我只用salt-master软件包对OP做过类似的事情...这个答案也对我有用!
Anentropic

救生员埃里克,你很棒。
Peter Teoh 2014年

3
太棒了,我有:post-removal script returned error exit status 1..因此,我找到了该脚本/var/lib/dpkg/info/{package}.postrm,并通过该脚本来验证自己是否已完成其中的工作(删除配置/文件等),然后将其修改为以上内容。 。惊人。:D
Grizly
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.