When rotating any file in /var/log as per the configuration in /etc/logrotate.[conf|d], logrotate tries to create new temporary (see logrotate-3.8.0-atomic-create.patch) in /var/log. For me this results in the following error: "error: error creating unique temp file: Bad address" This is because the "open" function throws en error, setting errno of EFAULT, meaning that, according to "man 2 open", the pathname points outside your accessible address space. I have created a patch for this, that creates the new files in /tmp and then moves them to the correct position. Reproducible: Always Steps to Reproduce: 1. Configure a file in /var/log to be rotated 2. Run logrotate -fv /etc/logrotate.conf 3. Cry. Actual Results: Logrotate reports the error: "error: error creating unique temp file: Bad address" This is bad, because it has already moved the original files but not created the new ones, potentially breaking logging applications. Expected Results: Correctly move the files, replace them with empty, new files. I have SELinux running, however it is in permissive mode so it shoudn't cause any problems. But even if this is the culprit, this should be fixed. Creating temporary files in the /tmp folder seems sensible to me anyway.
Created attachment 316057 [details, diff] Proposed patch that creates temporary files in '
Sorry for the delay. Very busy now. I'll take a closer look in the following days. Thanks for reporting.
I've been unable to reproduce this problem in a permissive selinux machine. It rotates the logs here with no problem. ¿Can you post the output of logrotate -fv /etc/logrotate.conf to check if the fscreate security context is properly set before the temp file creation? You should get in your log something like: fscreate context set to system_u:object_r:unlabeled_t right before the message "renamig /var/log/file.log to /var/log/file..." Cheers.
I temporarily fixed the issue with my patch, which worked for my machine at the time. However, in order to give you your log output, I've updated and/or recompiled all the selinux libraries and logrotate from scratch and it now works perfectly. Dunno what caused the error in the first place, but at the time I could reproduce it every time I tried to run logrotate -f /etc/logrotate.conf. Maybe some selinux functionality or something was not compiled correctly at the time, or broken after an emerge -DNu, but as the current stable version of selinux and logrotate work without a problem now, I'm marking this as RESOLVED-INVALID. Thanks for your time though and sorry for apparently wasting it.
No problem. Glad it's working fine at your side :-)