nagios2 won't remove/reinstall if /etc/nagios2/apache2.conf is deleted

Bug #256920 reported by Ethan
16
Affects Status Importance Assigned to Milestone
nagios2 (Ubuntu)
Won't Fix
Low
Unassigned
nagios3 (Ubuntu)
Fix Released
Low
aris pram

Bug Description

Binary package hint: nagios2-common

This was a fresh install of 8.04 with all updates. Nagios wasn't working properly so I tried to uninstall and reinstall. There was an issue uninstalling and I had to just unpack the package and then it uninstalled. Now upon reinstall I get the following error message.

Setting up nagios2-common (2.11-1ubuntu1.2) ...
Not replacing deleted config file /etc/nagios2/apache2.conf
Not replacing deleted config file /etc/nagios2/conf.d/host-gateway_nagios2.cfg
include file /etc/nagios2/apache2.conf does not exist!
dpkg: error processing nagios2-common (--configure):
 subprocess post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nagios2:
 nagios2 depends on nagios2-common (= 2.11-1ubuntu1.2); however:
  Package nagios2-common is not configured yet.
dpkg: error processing nagios2 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 nagios2-common
 nagios2
E: Sub-process /usr/bin/dpkg returned an error code (1)

Related branches

Revision history for this message
Thierry Carrez (ttx) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

I think the problem comes from the uninstall that left the system in an unstable state, rather than the reinstall.

Can you try purging nagios2 completely (sudo apt-get purge nagios2-common nagios2), then reinstall nagios2 ?
Do you remember what the original uninstall error was ?

Changed in nagios2:
status: New → Incomplete
Revision history for this message
Ethan (ethan-bonick) wrote :

The original uninstall error was about a file that didn't exist and I created it so it would uninstall, but then the uninstall crashed like shown below. This is what happens when I try to purge.

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  nagios2* nagios2-common*
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 3351kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 117004 files and directories currently installed.)
Removing nagios2 ...
Removing nagios2-common ...
dpkg: error processing nagios2-common (--purge):
 subprocess pre-removal script returned error exit status 1
Errors were encountered while processing:
 nagios2-common
E: Sub-process /usr/bin/dpkg returned an error code (1)

Revision history for this message
Thierry Carrez (ttx) wrote :

I think I reproduced it :
$ sudo apt-get install nagios2
$ sudo rm /etc/nagios2/apache2.conf
$ sudo apt-get remove nagios2-common

nagios2 cannot be removed (or reinstalled) if the /etc/nagios2/apache2.conf file is missing for whatever reason.

A workaround would be to :
$ sudo touch /etc/nagios2/apache2.conf
$ sudo apt-get purge nagios2 nagios2-common
$ sudo apt-get install nagios2

Please confirm that this fixes the issue for you.

Changed in nagios2:
importance: Undecided → Low
status: Incomplete → Confirmed
Revision history for this message
Ethan (ethan-bonick) wrote :

That fixes the uninstall. Upon trying to install nagios2, nagios2-common, nagios2-doc, nagios-images, nagios-plugins, nagios-plugins-basic, nagios-plugins-extra, and nagios-plugins-standard there is an apache reload error. I have attached the details screen shot from synaptic.

Revision history for this message
Ethan (ethan-bonick) wrote :

second screenshot

Revision history for this message
Thierry Carrez (ttx) wrote :

A lot of /etc files were apparently removed. This also prevents apache2 from restarting. You might need to purge/reinstall apache2, apache2-common... to restore the needed conf files like /etc/apache2/envvars.

It might be sufficient to just recreate the file manually :

$ sudo cat /etc/apache2/envvars << EOD
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
export APACHE_PID_FILE=/var/run/apache2.pid
EOD
$

However I would be surprised if envvars was the only file missing.

Revision history for this message
Ethan (ethan-bonick) wrote :

I did a complete removal and reinstall of apache2 and then reinstalled both apache and nagios. The install went without a hitch and the nagios-common package was installed properly.

Revision history for this message
Thierry Carrez (ttx) wrote :

Great ! So the problem probably came from some unwanted /etc file removals.

However, nagios2 could still be fixed to better support removal / reinstall in the case /etc/nagios2/apache2.conf has been deleted (gracefully ignore that rather than failing miserably).

Bug reproduction :
$ sudo apt-get install nagios2
$ sudo rm /etc/nagios2/apache2.conf
$ sudo apt-get remove nagios2-common

The problem probably lies in nagios2-common.prerm that could have a test case for missing /etc/nagios2/apache2.conf

Changed in nagios2:
status: Confirmed → Triaged
Revision history for this message
Thierry Carrez (ttx) wrote :

Same problem with nagios3 (same prerm code used). See:
$ sudo apt-get install nagios3
$ sudo rm /etc/nagios3/apache2.conf
$ sudo apt-get remove nagios3-common

Changed in nagios3:
importance: Undecided → Low
status: New → Triaged
Changed in nagios3:
assignee: nobody → stefanlsd
status: Triaged → In Progress
Revision history for this message
Stefan Lesicnik (stefanlsd) wrote :

nagios3 (3.0.2-1ubuntu1) intrepid; urgency=low

  * debian/nagios3-common.prerm:
    - Purge fails if /etc/nagios3/apache2.conf
      is missing (LP: #256920).
  * Update Maintainer.

 -- Stefan Lesicnik <email address hidden> Fri, 22 Aug 2008 15:28:20 +0200

Revision history for this message
Emanuele Gentili (emgent) wrote :

Uploaded Thanks

Changed in nagios3:
assignee: stefanlsd → emgent
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package nagios3 - 3.0.2-1ubuntu1

---------------
nagios3 (3.0.2-1ubuntu1) intrepid; urgency=low

  * debian/nagios3-common.prerm:
    - Purge fails if /etc/nagios3/apache2.conf
      is missing (LP: #256920).
  * Update Maintainer.

 -- Stefan Lesicnik <email address hidden> Fri, 22 Aug 2008 15:24:33 +0200

Changed in nagios3:
status: Fix Committed → Fix Released
Changed in nagios2:
status: Triaged → Fix Released
Revision history for this message
Thierry Carrez (ttx) wrote :

Still open for nagios2 / hardy. Not sure it's worthy of a SRU though.

Changed in nagios2:
status: Fix Released → Triaged
Revision history for this message
Stefan Lesicnik (stefanlsd) wrote :

Thanks Theirry,

I dont think this is worth the SRU as it causes no major problems and shouldnt happen under normal circumstances. To correct the problem - the user can just

touch /etc/nagios2/apache2.conf

and the purge will complete.

Revision history for this message
Thierry Carrez (ttx) wrote :

I agree with you. This is more a bug in a corner case that normal use shouldn't hit, with an easy workaround, so it's probably not worthy of an SRU. I'm closing it as Won't Fix, anyone wishing to try to push it through SRU : feel free to reopen it.

Changed in nagios2:
status: Triaged → Won't Fix
aris pram (aris-pra04)
Changed in nagios3 (Ubuntu):
assignee: Emanuele Gentili (emgent) → aris pram (aris-pra04)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.