logrotate.service fails due to bad year (1970)

This forum is for topics specific to the Raspberry Pi and Arch Linux ARM

logrotate.service fails due to bad year (1970)

Postby funkyboris » Sun Jan 11, 2015 12:10 am

I have the following problem using the logrotate service to keep my journal tidy:

$this->bbcode_second_pass_code('', '
jan 11 00:00:00 example systemd[1]: Starting Rotate log files...
jan 11 00:00:00 example logrotate[19531]: error: bad year 1970 for file /var/log/wtmp in state file /var/lib/logrotate.status
jan 11 00:00:00 example systemd[1]: logrotate.service: main process exited, code=exited, status=1/FAILURE
jan 11 00:00:00 example systemd[1]: Failed to start Rotate log files.
jan 11 00:00:00 example systemd[1]: Unit logrotate.service entered failed state.
jan 11 00:00:00 example systemd[1]: logrotate.service failed.
')

I use the SystemMaxUse=256M in /etc/systemd/journald.conf to instruct logrotate to clean up the logs if they become too large.

Now, this is perhaps a perfectly reasonable behavior for a normal server system running Arch on hardware with a RTC. The Raspberry Pi, however, was not lucky enough to be born with one.

Can anybody recommend settings that will help mitigate this? I could, of course, clean up the logs manually, but i would rather have the service do it if at all possible (That, or get a RTC, which would probably also solve it).
funkyboris
 
Posts: 8
Joined: Thu Mar 20, 2014 7:20 pm

Re: logrotate.service fails due to bad year (1970)

Postby sdjf » Sun Jan 11, 2015 4:35 am

I am wondering if there is a way to not have the service start until after your Pi has reset it's date to a current one, after rebooting.

Have you just left your Pi in 1970 instead of giving it a current date manually? I have my pi record the current date in unix time every minute or so, and a cron job that checks a few minutes after each hour, to make sure the date is a current one, and which resets it to the last date recorded, if it detects an old date. the time is off a little bit, but it is good enough to make my logs easier to decipher, once the time is changed automatically.
sdjf
 
Posts: 178
Joined: Wed May 08, 2013 1:55 pm

Re: logrotate.service fails due to bad year (1970)

Postby pepedog » Sun Jan 11, 2015 8:40 am

There is a package called fake-hwclock
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: logrotate.service fails due to bad year (1970)

Postby pepedog » Sun Jan 11, 2015 1:51 pm

Test
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 34 guests

cron