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

Mon Oct 9 10:38:41 UTC 2017
hw <hw at adminart.net>

Anand Buddhdev <anandb at ripe.net> writes:

> On 05/10/2017 11:32, hw wrote:
>>> That directory isn't temporary.  The files almost always are, but not
>>> the directories.  As I said, whatever it is you're doing, it's wrong. 
>>> I wouldn't continue to keep a setup like that as it's not standard
>>> practice to keep data in /var/run that isn't temporary.
>> Well, what am I supposed to do?  The socket (or what it was) needs to be
>> put somewhere, and IIRC, it wasn´t my choice to put it there but is a
>> default.  With mariadb, there are some defaults you can´t reasonably
>> change because other software expects files where they usually are.  And
>> I don´t want to change that, I just want mariadb and lighttpd and other
>> things to start on reboots rather than being broken because someone
>> decided that files/directories they require are to be deleted on reboots
>> before they can start.
> I can't believe people are still asking this question after being given
> appropriate advice. So let me repeat it, and don't ask again unless
> you've read this properly:

I haven´t had time to read all of this thread before today.

> 1. /var/run is a symlink to /run, which is a tmpfs mounted in RAM.
> 2. At reboot, /run vanishes, and EVERYTHING that was in it, vanishes
> with it.
> 3. For this reason, systemd ships with a utility called
> systemd-tmpfiles, which is run early in the boot process, to create any
> appropriate files and directories in /run. Packages that require
> directories to be present in /run (for keeping PID files or sockets),
> should ship with the appropriate tmpfiles.d snippets to have these
> directories created for them on boot.
> 4. Finally, if you as a sysadmin are using a package from a repo that
> isn't CentOS or EPEL, and this package is not following the CentOS
> packaging protocol for data in /run, then it is YOUR own responsibility
> to fix the package, or create your own tmpfiles.d snippet to create the
> required directories.

Lighttpd is from epel.

> 5. Learn about systemd-tmpfiles by reading the man pages of
> "systemd-tmpfiles" and "tmpfiles.d".
> This is as clear as crystal. If, despite this instruction, you cannot,
> or do not want to work with CentOS as it was intended, then stop whining
> about things here.

I´m not whining, and it´s not my fault that someone came up with the
extremely stupid idea to use a ramdisk for /var/run.  It´s also not my
fault that lighttpd appears not to be packaged the way it would need to
be, and the same goes for the mariadb packages provided for Centos by
the mariadb people.

Perhaps you should complain to whomever made this change for not waiting
until all packages have been modified and to the package managers who
didn´t modify them before actually deploying it, for not to mention the
stupidity of the idea, rather than accusing me of whining.

"Didn't work" is an error.