[config-package-dev] config-package, package removal

Geoffrey Thomas geofft at ldpreload.com
Wed Jan 14 22:45:23 EST 2015


Hi Tyler,

I think that the error message you're getting is from some apt command not 
liking files in apt.conf.d with multiple periods in the filename, not from 
dpkg or config-package-dev. (I'm not entirely sure why apt is getting 
called, but perhaps you have something else in your prerm that calls an 
apt command?)

But since apt.conf.d is a directory, not a file, you don't need to use the 
displace mechanism to replace a file in it. You can use the hide mechanism 
to suppress the original file, and then just install a new file with a 
different name or number. Specifically, put 
"/etc/apt/apt.conf.d/50unattended-upgrades" in debian/mypackage.hide, and 
in debian/mypackage.install, list a file named something else, say
"50mypackage-unattended-upgrades". apt will look at every file in this 
directory, regardless of name -- the displace mechanism is primarily 
useful when you have a single configuration file with a predetermined 
name (like /etc/ntp.conf).

The website mentions this in the documentation of the hide operation, but 
maybe it's not very clear.

-- 
Geoffrey Thomas
https://ldpreload.com
geofft at ldpreload.com

On Tue, 13 Jan 2015, Tyler Retzlaff wrote:

> I've been using config-package successfully for diverting configuration
> files for custom configuration.  Recently, I've hit a problem where
> uninstalling a package that contains a diversion complains that the file
> is being ignored because it has an invalid filename extension.
>
> mypackage.deb has 2 diversions, one for /etc/ntp.conf and one for
> /etc/apt/apt.conf.d/50unattended-upgrades
>
> My package.displace file looks as follows.
>
> /etc/apt/apt.conf.d/50unattended-upgrades.mypackage
> /etc/ntp.conf.mypackage
>
> I observe the following when installing and then removing the package.
>
> e.g.
> $ dpkg -i mypackage.deb
>
> seems to work fine
>
> $ ls -l /etc/ntp.conf*
> lrwxrwxrwx 1 root root   14 Jan 13 19:25 /etc/ntp.conf -> ntp.conf.mypackage
> -rw-r--r-- 1 root root 1936 Oct  9  2013 /etc/ntp.conf.dpkg-new
> -rw-r--r-- 1 root root  574 Jan 13 17:59 /etc/ntp.conf.mypackage
> -rw-r--r-- 1 root root 1936 Dec 20 11:51 /etc/ntp.conf.mypackage-orig
>
> $ ls -l /etc/apt/apt.conf.d/50unattended-upgrades*
> lrwxrwxrwx 1 root root   27 Jan 13 19:25
> /etc/apt/apt.conf.d/50unattended-upgrades -> 50unattended-upgrades.mypackage
> -rw-r--r-- 1 root root 2326 Jan 13 17:59
> /etc/apt/apt.conf.d/50unattended-upgrades.mypackage
> -rw-r--r-- 1 root root 2331 Apr  2  2014
> /etc/apt/apt.conf.d/50unattended-upgrades.mypackage-orig
>
> However when I try to remove the package I get.
>
> $ apt-get remove --purge mypackage
> Removing 'diversion of /etc/ntp.conf to /etc/ntp.conf.mypackage-orig by
> mypackage'
> Removing 'diversion of /etc/apt/apt.conf.d/50unattended-upgrades to
> /etc/apt/apt.conf.d/50unattended-upgrades.mypackage-orig by mypackage'
> N: Ignoring file '50unattended-upgrades.mypackage-orig' in directory
> '/etc/apt/apt.conf.d/' as it has an invalid filename extension
> N: Ignoring file '50unattended-upgrades.mypackage' in directory
> '/etc/apt/apt.conf.d/' as it has an invalid filename extension
>
> $ ls -l /etc/ntp.conf*
> -rw-r--r-- 1 root root 1936 Dec 20 11:51 /etc/ntp.conf
> -rw-r--r-- 1 root root 1936 Oct  9  2013 /etc/ntp.conf.dpkg-new
>
> $ ls -l /etc/apt/apt.conf.d/50unattended-upgrades*
> -rw-r--r-- 1 root root 2331 Apr  2  2014
> /etc/apt/apt.conf.d/50unattended-upgrades
>
> Still the files are removed but I'm concerned about the inconsistency in
> warning I'm getting when removing the package.  I only get it for the
> diverted file in /etc/apt/apt.conf.d/ but not /etc.
>
> If I had to speculate (and I often do wildly) I'd say there is something
> going wrong in extension parsing where the diversion path contains
> additional '.' characters...?
>
> Would anyone be able to shed some light on what is going on here? Or
> better how to resolve/work around it? Or maybe I shouldn't be diverting
> files in that path and instead solving this problem another way?
>
> Kind regards,
>
> Tyler
>
> _______________________________________________
> config-package-dev mailing list
> config-package-dev at mit.edu
> http://mailman.mit.edu/mailman/listinfo/config-package-dev
>


More information about the config-package-dev mailing list