1

This day I tried to remove apache2. It's bundled with Ubuntu Lucid, which I don't need. I used apt-get remove apache2 to remove it. But somehow, the initscript was still there, in "/etc/init.d/". I tried the apt-get purge command, but the result was the same.

How come the apt-get command fails not remove initscript, even though the script was made by apache2 package.

tshepang
  • 377
  • 2
  • 12
pepito
  • 21
  • 5

5 Answers5

3

The init script is not removed because it is considered to be a configuration file, or "conffile" (because some people might want to tweak their init scripts). In Debian (and derived distributions) conffiles are kept on the system when packages are uninstalled, to make it easier if you want to re-install them later.

If you're sure that you want to remove the conffiles as well, then you should pass the --purge option to apt-get or aptitude.

womble
  • 95,029
  • 29
  • 173
  • 228
  • Yeah I tried the `--purge` option as well as `apt-get purge apache2`. But it still did not work out well. I read the man, it said `remove --purge is equivalent to the purge command`. So the two commands I used is exactly the same. It's funny to know that this kind of thing do not happen in debian. – pepito Mar 17 '12 at 08:47
  • @jollyroger I believe this is the best answer. Many thanks! – pepito Mar 17 '12 at 09:50
  • Moved my comment as a separate answer. – jollyroger Mar 17 '12 at 23:02
1

Have you tried apt-get remove apache2 --purge ?

jollyroger
  • 1,650
  • 11
  • 19
proy
  • 1,179
  • 8
  • 10
1

A more low-level method to remove the package is:

dpkg --purge apache2.2-common

(I checked the right packages name for you is: apache2.2-common)

cstamas
  • 6,607
  • 24
  • 42
  • Yeah this one worked! Only I had to remove apache2-mpm-work first. Because there's dependency problem. – pepito Mar 17 '12 at 08:59
1

Use:

dpkg --purge --force-depends apache2.2-common

then:

apt-get install apache2.2-common

The --force-depends makes sure it just removes that package only. It will break your dependencies, but since you're immediately reinstalling it afterwards, it shouldn't be an issue.

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
0

The exact owner of the init script is apache2.2-common, not the apache2. The apt-get purge apache2 command will purge the apache2 package but only remove apache2.2-common as its dependency. You should name all packages you want to purge to actually purge them or use the reciept from https://serverfault.com/a/326306/52873.

jollyroger
  • 1,650
  • 11
  • 19