[CentOS] how to prevent files and directories from being deleted?

Mon Oct 9 15:41:53 UTC 2017
Jonathan Billings <billings at negate.org>

On Mon, Oct 09, 2017 at 02:06:35PM +0200, hw wrote:
> > If the EPEL package did too, then there could be serious problems with
> > that package. However, I see that it has a
> > /usr/lib/tmpfiles.d/lighttpd.conf, so it is ok.
> 
> Hm, then how come it´s so troublesome?
> 
> I have /usr/lib/tmpfiles.d/httpd.conf.  It seems to have remained
> because I had httpd (which is apache) installed and then switched to
> lighttpd and removed httpd.
> 
> httpd is no longer installed.  The only installed package referring to
> it is apache-commons-logging, and I don´t know why it hasn´t been
> removed.
> 
> The contents of /usr/lib/tmpfiles.d/httpd.conf indicate that this file
> is for apache.  Why hasn´t this file been removed when httpd was
> removed?
> 
> There is no file lighttpd.conf in /usr/lib/tmpfiles.d.
> 
> Does this mean that both packages, httpd and lighttpd, have serious
> problems because they do not remove and do not install files correctly?

You are right, the EPEL version of lighttpd doesn't have a tmpfiles.d
file.  I foolishly expected the Fedora package to be similar to the
EPEL package, but looking at the RPM spec file, it only installs the
tmpfiles.d file for Fedora 15 or greater.  Probably worth filing a bug
against EPEL about that.

I can't explain why your httpd tmpfiles.d file is still there, other
than if it was saved as part of an upgrade/removal because of local
changes. (and even then, it should have a .rpmsave extension, I
think).  It's not marked as a config file in the RPM, so that's
unlikely.

It is owned by the httpd package:
$ rpm -qf /usr/lib/tmpfiles.d/httpd.conf
httpd-2.4.6-67.el7_4.2.x86_64


-- 
Jonathan Billings <billings at negate.org>