CasaOS icon indicating copy to clipboard operation
CasaOS copied to clipboard

[Bug] log files ending with number in /var/log have a timestamp set in future which breaks logrotate

Open sanyer opened this issue 2 years ago • 4 comments

Describe the bug

Both of my ZimaBoard PCs ran out of space because of the size of /var/log folder. Turns out, some log files were growing uncontrollably:

1.8G    /var/log/daemon.log
1.9G    /var/log/syslog
3.9G    /var/log/journal
7.8G    total

Which looked like a logrotate problem so I ran sudo logrotate --force /etc/logrotate.d/rsyslog and here is the output:

error: Compressing program wrote following message to stderr when compressing log /var/log/syslog.1:
gzip: stdin: warning: file timestamp out of range for gzip format
error: failed to compress log /var/log/syslog.1
error: Compressing program wrote following message to stderr when compressing log /var/log/daemon.log.1:
gzip: stdin: warning: file timestamp out of range for gzip format
error: failed to compress log /var/log/daemon.log.1
error: Compressing program wrote following message to stderr when compressing log /var/log/kern.log.1:
gzip: stdin: warning: file timestamp out of range for gzip format
error: failed to compress log /var/log/kern.log.1
error: Compressing program wrote following message to stderr when compressing log /var/log/auth.log.1:
gzip: stdin: warning: file timestamp out of range for gzip format
error: failed to compress log /var/log/auth.log.1
error: Compressing program wrote following message to stderr when compressing log /var/log/user.log.1:
gzip: stdin: warning: file timestamp out of range for gzip format
error: failed to compress log /var/log/user.log.1
error: Compressing program wrote following message to stderr when compressing log /var/log/debug.1:
gzip: stdin: warning: file timestamp out of range for gzip format
error: failed to compress log /var/log/debug.1
error: Compressing program wrote following message to stderr when compressing log /var/log/messages.1:
gzip: stdin: warning: file timestamp out of range for gzip format
error: failed to compress log /var/log/messages.1

Turns out, aforementioned log files have their timestamps set in future:

-rw-r-----   1 root              adm               14K Mar 17  2169 debug.1
-rw-------   1 root              root             5.3K Mar 17  2169 boot.log.5
-rw-r-----   1 root              adm               14K Mar 17  2169 user.log.1
-rw-r-----   1 root              adm              1.8K Mar 17  2169 auth.log.1
-rw-r-----   1 root              adm               88K Mar 17  2169 daemon.log.1
-rw-r-----   1 root              adm              187K Mar 17  2169 syslog.1
-rw-r-----   1 root              adm               88K Mar 17  2169 messages.1
-rw-r-----   1 root              adm               85K Mar 17  2169 kern.log.1

To Reproduce

Steps to reproduce the behavior:

  1. Go to folder /var/log
  2. Run ls -lhtr /var/log
  3. Scroll down to the end of output
  4. See the file dates

Expected behavior

Logs rotated on a default schedule and folder /var/log has a reasonable size.

System Time

               Local time: Thu 2023-08-10 23:36:28 CEST
           Universal time: Thu 2023-08-10 21:36:28 UTC
                 RTC time: Thu 2023-08-10 21:36:28
                Time zone: Europe/Amsterdam (CEST, +0200)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Additional context

Both of my ZimaBoard PCs were bought in May 2023.

sanyer avatar Aug 10 '23 21:08 sanyer

Thank you for your feedback, we will seriously address the issue, please give us some time.

LinkLeong avatar Aug 11 '23 03:08 LinkLeong

is this issue already resolved in the new update?

fauzanazhima avatar Jan 29 '24 07:01 fauzanazhima

this bug affects also me. now.

magowiz avatar May 20 '24 02:05 magowiz