22

I'm trying to remove a package where I deleted the /etc/init.d/disco-master file (in an attempt to remove the package manually). I want to remove the disco-master package. How do I do this now?

This is what happens when I do 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)

When I do sudo apt-get install --reinstall disco-master I get the following:

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).

When I do sudo apt-get -f install I get this:

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)

When I run sudo apt-get remove disco-node I get the following:

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).

When I did sudo dpkg -P --force-all disco-master I got:

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

1 Answer 1

25

Create a dummy initscript to fool dpkg:

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

Enter the following:

#!/bin/bash
exit 0

Save the file, set execution permission (sudo chmod 755 /etc/init.d/disco-master) and try to sudo apt-get remove disco-master again.

3
  • I did a similar thing to the OP only with salt-master package... this answer also worked for me!
    – Anentropic
    Oct 4, 2012 at 10:56
  • life saver Eric, u are great.
    – Peter Teoh
    Dec 9, 2014 at 11:13
  • 5
    Brilliant, I had: post-removal script returned error exit status 1.. So, I found that script /var/lib/dpkg/info/{package}.postrm, went through it to verify that I had done the things in it (delete configs/files etc), then modified it to the above.. IT WORKS.. Apt works again. Amazing. :D
    – Grizly
    Nov 25, 2015 at 3:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .