Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

5 Answers

up vote 0 down vote accepted

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 http://serverfault.com/a/326306/52873.

share|improve this answer
add comment

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.

share|improve this answer
    
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 8:47
    
@jollyroger I believe this is the best answer. Many thanks! –  pepito Mar 17 '12 at 9:50
    
Moved my comment as a separate answer. –  jollyroger Mar 17 '12 at 23:02
add comment

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)

share|improve this answer
    
Yeah this one worked! Only I had to remove apache2-mpm-work first. Because there's dependency problem. –  pepito Mar 17 '12 at 8:59
add comment

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

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.