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

Re: "combined" prerm script problem [Bug#337223: fail2ban: leaves garbage around after purge]



On Thu, Nov 03, 2005 at 12:00:20PM -0500, Yaroslav Halchenko wrote:
> Dear All,
> 
> I'm maintaining fail2ban package and got a bug report about garbage left
> after purge on the package. The problem lies in prerm script which first
> tries to stop fail2ban and then if stop was successfull removes .py[co]
> files (added by dh_python) which were compiled/installed on first
> start of fail2ban:
> 
> #!/bin/sh
> set -e
> # Automatically added by dh_installinit
> if [ -x "/etc/init.d/fail2ban" ]; then
>         if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
>                 invoke-rc.d fail2ban stop || exit 0
>         else
>                 /etc/init.d/fail2ban stop || exit 0
>         fi
> fi
> # End automatically added section

> # Automatically added by dh_python
> dpkg -L fail2ban |
>         awk '$0~/\.py$/ {print $0"c\n" $0"o"}' |
>         xargs rm -f >&2
> # End automatically added section
AFAICT this dh_installinit snippet should always be successful; play
with the s-s-daemon options as necessary to ensure that it is.
Killing a process is always possible, even if one has to use kill -9.

Then there is --oknodo which you could add to the options for
s-s-daemon (stop) in /etc/init.d/fail2ban, such that it should never
return a nonzero exist code.  I notice that /e/i.d/ssh (stop) uses
this, so it seems to be sufficiently conventional.

-- 
Clear skies,
Justin

> ----- Forwarded message from Jochen Voss <voss@debian.org> -----
> 
> Date: Thu, 03 Nov 2005 11:29:15 +0000
> From: Jochen Voss <voss@debian.org>
> To: Debian Bug Tracking System <submit@bugs.debian.org>
> Subject: Bug#337223: fail2ban: leaves garbage around after purge
> X-Spam-Level: 
> 
> Package: fail2ban
> Version: 0.5.4-7
> Severity: normal
> 
> Hi,
> 
> when I install and then purge fail2ban, some files are left lying around in
> /usr/share/fail2ban:
> 
>     voss@tarte [~] sudo aptitude purge fail2ban
>     Reading package lists... Done
>     Building dependency tree... Done
>     Reading extended state information      
>     Initializing package states... Done
>     Reading task descriptions... Done  
>     The following packages will be REMOVED:
>       fail2ban 
>     0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
>     Need to get 0B of archives. After unpacking 246kB will be freed.
>     Do you want to continue? [Y/n/?] y
>     Writing extended state information... Done
>     (Reading database ... 132413 files and directories currently installed.)
>     Removing fail2ban ...
>     Stopping fail2ban: Status of fail2ban: fail2ban is not running.
>     Not stopping fail2ban
>     invoke-rc.d: initscript fail2ban, action "stop" failed.
>     Purging configuration files for fail2ban ...
>     dpkg - warning: while removing fail2ban, directory `/usr/share/fail2ban/utils' not empty so not removed.
>     dpkg - warning: while removing fail2ban, directory `/usr/share/fail2ban/confreader' not empty so not removed.
>     dpkg - warning: while removing fail2ban, directory `/usr/share/fail2ban/logreader' not empty so not removed.
>     dpkg - warning: while removing fail2ban, directory `/usr/share/fail2ban/firewall' not empty so not removed.
>     dpkg - warning: while removing fail2ban, directory `/usr/share/fail2ban' not empty so not removed.
>     Reading package lists... Done             
>     Building dependency tree... Done
>     Reading extended state information      
>     Initializing package states... Done
>     Reading task descriptions... Done  
>     voss@tarte [~] ll /usr/share/fail2ban/
>     total 56
>     drwxr-xr-x  2 root root  4096 2005-11-03 11:23 confreader/
>     -rw-r--r--  1 root root 15916 2005-11-03 11:14 fail2ban.pyc
>     -rw-r--r--  1 root root 15916 2005-11-03 11:14 fail2ban.pyo
>     drwxr-xr-x  2 root root  4096 2005-11-03 11:23 firewall/
>     drwxr-xr-x  2 root root  4096 2005-11-03 11:23 logreader/
>     drwxr-xr-x  2 root root  4096 2005-11-03 11:23 utils/
>     -rw-r--r--  1 root root   469 2005-11-03 11:14 version.pyc
>     -rw-r--r--  1 root root   469 2005-11-03 11:14 version.pyo
> 
> These files should be deleted when the package is purged.



Reply to: