hw
2017-Oct-09 10:38 UTC
[CentOS] how to prevent files and directories from being deleted?
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.
Jonathan Billings
2017-Oct-09 15:54 UTC
[CentOS] how to prevent files and directories from being deleted?
On Mon, Oct 09, 2017 at 12:38:41PM +0200, hw wrote:> 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.I think that the important learning points today are: 1.) CentOS7 (and any other distro that uses systemd) will have /run as a tmpfs filesystem, and /var/run points to /run on CentOS7, so even if you think this disagrees with the FHS, that's the way it is for CentOS. 2.) If you are using non-CentOS packages (and that includes EPEL) to run a service, you might need to create your own tmpfiles.d files. This is just a fact of life now. You can also file bugs against the software telling them that /var/run is ephemeral so don't store important files there. 3.) Systemd developers aren't going to sit around and wait for developers to change how they put files. They've made a lot of significant changes to how systems are managed, for better or for worst, and as people who maintain CentOS systems, we've got to learn to use it appropriately. There's a lot of conversations that end, "This is how it's done." "But that's stupid!" "Well, tough, that's how it is..." when managing computers, and I'm sure this won't be the last like it. (I remember early in my career wondering why creat() was spelled that way...) -- Jonathan Billings <billings at negate.org>
Alexander Dalloz
2017-Oct-09 18:32 UTC
[CentOS] how to prevent files and directories from being deleted?
Am 09.10.2017 um 17:54 schrieb Jonathan Billings:> I think that the important learning points today are: > > 1.) CentOS7 (and any other distro that uses systemd) will have /run as > a tmpfs filesystem, and /var/run points to /run on CentOS7, so even if > you think this disagrees with the FHS, that's the way it is for > CentOS.And fun fact: not only RHEL 7 and thus CentOS 7 does so, but too Debian 9 and Ubuntu 16.04 LTS (I have no newer test install of that distro). And frankly speaking, I don't see any indication that this violates with the FHS and that /var/run must persist reboots. Can we please end this stupid discussion? Enough arguments have been exchanged to make clear that packages are broken if they ignore the fact that /var/run content is ephemeral. Alexander
Anand Buddhdev
2017-Oct-09 21:49 UTC
[CentOS] how to prevent files and directories from being deleted?
On 09/10/2017 12:38, hw wrote:>> 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.Then it's a big bug, and you should immediately file a bug report for it, so that the packager can fix it. Packages in CentOS as well as EPEL aren't perfect, and sometimes need to be fixed. We can help by filing bug reports.> 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.CentOS 7 was released in August 2015, which is over 2 years ago. Any package that hasn't adapted to CentOS 7's temporary /var/run by now is badly broken. I would either avoid using it, or file a bug report for it (and use my own tmpfiles.d file in the meantime). Or, you can download the SRPM of the package, introduce a tmpfiles.d snippet and rebuild the package yourself. You have many choices to make it work properly.> 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.I shouldn't, because I'm not using the package in question. I *have* used other packages from EPEL, where I've seen this problem, and I've filed bug reports for them, repackaged them myself, or used my own custom tmpfiles.d file to work around the package's deficiency. Anand