Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[logrotate] error in logs "Failed to start Rotate log files" #12392

Closed
ppikh opened this issue Oct 13, 2022 · 0 comments · Fixed by #12921
Closed

[logrotate] error in logs "Failed to start Rotate log files" #12392

ppikh opened this issue Oct 13, 2022 · 0 comments · Fixed by #12921
Assignees

Comments

@ppikh
Copy link
Contributor

ppikh commented Oct 13, 2022

Description

Error in logs happen: "Failed to start Rotate log files"

Steps to reproduce the issue:

It reproduces only in case when time is 12:00AM and logrotation started

There are two triggers for logrotate - One is the default debian logrotate timer which runs daily at 12:00 AM. The second one is the logrotate by cron job which SONiC has created and runs every 10 mins.

The SONiC cron job has a logic to kill any logrotate that is running. #2942

# Attempt to rotate system logs once every 10 minutes.
# First kill any logrotate process(es) if they are still running, as they're most likely hung
*/10 * * * * root /usr/bin/pkill -9 logrotate > /dev/null 2>&1; /usr/sbin/logrotate /etc/logrotate.conf > /dev/null 2>&1

The cron job in this case was aligned in such a way in runs at 12:00:01 which is 1 sec after the default timer triggers a logrotate. Since the cron finds a logrotate already running it kills it which results in the log

Oct  5 00:00:00.938784 r-tigon-21 INFO systemd[1]: Starting Rotate log files...
Oct  5 00:00:01.247788 r-tigon-21 WARNING systemd[1]: logrotate.service: Main process exited, code=killed, status=9/KILL
Oct  5 00:00:01.248858 r-tigon-21 WARNING systemd[1]: logrotate.service: Failed with result 'signal'.
Oct  5 00:00:01.249684 r-tigon-21 ERR systemd[1]: Failed to start Rotate log files.

From cron log:

Oct  5 00:00:01.226074 r-tigon-21 INFO CRON[541643]: (root) CMD (/usr/bin/pkill -9 logrotate > /dev/null 2>&1; /usr/sbin/logrotate /etc/logrotate.conf > /dev/null 2>&1)

This is non functional since the logrotate from cron will eventually accomplish the task.

However given there is already a cron running in SONiC the default daily logrotate can be disabled

Describe the results you received:

Got error in logs

Oct  5 00:00:01.249684 r-tigon-21 ERR systemd[1]: Failed to start Rotate log files.

Describe the results you expected:

No error in logs

Output of show version:

SONiC.202205_rc.17-12870dde8_Internal

Output of show techsupport:

Can not attach sysdump due to max limit of file 25Mb,
If someone want - can ask me and I will send this file in private message.

Additional information you deem important (e.g. issue happens only occasionally):

saiarcot895 added a commit to saiarcot895/sonic-buildimage that referenced this issue Dec 2, 2022
Debian is shipping a systemd timer unit for logrotate, but we're also
packaging in a cron job, which means both of them will run, potentially
at the same time. Remove our cron file, and add an override to the
shipped timer file to have it be run every 10 minutes.

Fixes sonic-net#12392.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
yxieca pushed a commit that referenced this issue Dec 8, 2022
Debian is shipping a systemd timer unit for logrotate, but we're also
packaging in a cron job, which means both of them will run, potentially
at the same time. Remove our cron file, and add an override to the
shipped timer file to have it be run every 10 minutes.

Fixes #12392.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this issue Dec 8, 2022
…net#12921)

Debian is shipping a systemd timer unit for logrotate, but we're also
packaging in a cron job, which means both of them will run, potentially
at the same time. Remove our cron file, and add an override to the
shipped timer file to have it be run every 10 minutes.

Fixes sonic-net#12392.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
mssonicbld pushed a commit that referenced this issue Dec 12, 2022
Debian is shipping a systemd timer unit for logrotate, but we're also
packaging in a cron job, which means both of them will run, potentially
at the same time. Remove our cron file, and add an override to the
shipped timer file to have it be run every 10 minutes.

Fixes #12392.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this issue Feb 3, 2023
…net#12921)

Debian is shipping a systemd timer unit for logrotate, but we're also
packaging in a cron job, which means both of them will run, potentially
at the same time. Remove our cron file, and add an override to the
shipped timer file to have it be run every 10 minutes.

Fixes sonic-net#12392.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
mssonicbld pushed a commit that referenced this issue Feb 4, 2023
Debian is shipping a systemd timer unit for logrotate, but we're also
packaging in a cron job, which means both of them will run, potentially
at the same time. Remove our cron file, and add an override to the
shipped timer file to have it be run every 10 minutes.

Fixes #12392.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants