Re: Removing conffiles AND directories in /etc
On Sat, Oct 25, 2014 at 12:42:01PM +0200, Enrico Zini wrote:
> I have a bug (#764235) in which after I remove all conffiles in
> /etc/debtags with dpkg-maintscripthelper, the /etc/debtags directory
> itself is left around.
> This is what happens:
> # dpkg -i debtags_1.12.2_amd64.deb
> (Reading database ... 370467 files and directories currently installed.)
> Preparing to unpack ../debtags_1.12.2_amd64.deb ...
> Unpacking debtags (1.12.2) over (1.11) ...
> dpkg: warning: unable to delete old directory '/etc/debtags/sources.list.d': Directory not empty
> dpkg: warning: unable to delete old directory '/etc/debtags': Directory not empty
> dpkg: warning: unable to delete old directory '/etc/apt.conf.d': Directory not empty
> Setting up debtags (1.12.2) ...
> Removing obsolete conffile /etc/debtags/sources.list.d/source-example ...
> Removing obsolete conffile /etc/debtags/sources.list ...
> Processing triggers for man-db (18.104.22.168-2) ...
> So, dpkg-maintscripthelper seems to do "Removing obsolete conffile"
> after dpkg tries to delete old directories, so dpkg fails.
> I'd be surprised if I were the first to encounter this problem: what is
> the appropriate and clean way to get rid of *all* conffiles for a
> package, including the directory that contains them?
I have never used dpkg-maintscripthelper myself, but the documentation
suggests that dpkg-maintscripthelper is not able to do that (the
directory part) yet:
Current implementation: in the preinst, it checks if the conffile was modified and renames it either to
conffile.dpkg-remove (if not modified) or to conffile.dpkg-backup (if modified). In the postinst, the
latter file is renamed to conffile.dpkg-bak and kept for reference as it contains user modifications
but the former will be removed. If the package upgrade aborts, the postrm reinstalls the original conf‐
file. During purge, the postrm will also delete the .dpkg-bak file kept up to now.
I would report this as a dpkg bug.