[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Apache2 won't remove.



On Mon, Feb 26, 2007 at 21:34:32 +0000, pChan -- wrote:
> I am trying to remove apache2. But before that, I did something stupid. I
> "rm apache2" in /etc/init.d
> 
> So now, if I try to remove apache2-mpm-worker...
> sd-6340:/etc/init.d# apt-get remove apache2-mpm-worker
> Reading Package Lists... Done
> Building Dependency Tree... Done
> The following packages will be REMOVED:
>  apache2 apache2-mpm-worker
> 0 upgraded, 0 newly installed, 2 to remove and 8 not upgraded.
> Need to get 0B of archives.
> After unpacking 586kB disk space will be freed.
> Do you want to continue? [Y/n] y
> (Reading database ... 19200 files and directories currently installed.)
> Removing apache2 ...
> Removing apache2-mpm-worker ...
> invoke-rc.d: unknown initscript, /etc/init.d/apache2 not found.
> dpkg: error processing apache2-mpm-worker (--remove):
> subprocess pre-removal script returned error exit status 100
> Errors were encountered while processing:
> apache2-mpm-worker
> E: Sub-process /usr/bin/dpkg returned an error code (1)
> 
> 
> I have absolutely no idea what to do, as it depends on apache2.initd to
> remove.

/etc/init.d/apache2 comes from package "apache2-common" (Sarge) or
"apache2.2-common" (Etch and Sid). My proposed solution assumes that you
are using Sarge; if you are using Etch/Sid then you have replace all
instances of "apache2-common" with "apache2.2-common".

I think your best option is to extract the missing file from the .deb
package and to put it into /etc/init.d. First you have to see if the
.deb file is still in your package cache. Its path will be something
like

/var/cache/apt/archives/apache2-common_<version-arch>.deb

where <version-arch> is a string that denotes the version and your
architecture (e.g. i386). You have to find the .deb file which
corresponds to the currently installed version of apache2-common. If you
cannot find the file you can try to download it again with

apt-get --download-only apache2-common

Next you have to extract the files from this package. You can do this
with the command

dpkg-deb -X /var/cache/apt/archives/apache2-common_<version-arch>.deb /tmp

This will extract all files from the package to /tmp. Your missing
initscript should be at

/tmp/etc/init.d/apache

Maybe you will be able to remove apache if you copy this file to
/etc/init.d. Make sure that you set reasonable ownership and file
permissions, similar to those of the other scripts in /etc/init.d. 

-- 
Regards,
          Florian



Reply to: