NTP vs systemd on RTC-less devices

Ask questions about Arch Linux ARM. Please search before making a new topic.

NTP vs systemd on RTC-less devices

Postby towolf » Thu Mar 20, 2014 10:19 pm

There was a thread here where it was suggested that adding a PostUpExec= line into a netctl profile would fix the problem of services coming up in 1970 and the jumping ahead 40 years.

I’ve installed a fresh alarmpi image on my Raspberry Pi and the problem is still there inspite of the suggested fix.

nginx.service has "After=syslog.target network.target", but it still comes up like this:
$this->bbcode_second_pass_code('', 'Active: active (running) since Thu 1970-01-01 00:00:07 UTC; 44 years 2 months ago')

So even though network.target is reached, the interface hasn’t been configured and NTP hasn’t had a chance to acquire time.

Is there another suggested fix for this? My hunch is that the solution must be to somehow tie into another target, like network-online.target, but even though this already exists, it is not hooked up anywhere.

The problem is that the nginx module for rtmp video fails to purge video cache because of the jump in system time and fills up /tmp.
towolf
 
Posts: 12
Joined: Mon Oct 07, 2013 10:23 pm

Re: NTP vs systemd on RTC-less devices

Postby WarheadsSE » Thu Mar 20, 2014 10:32 pm

pacman -Ss fakeclock

And yeah, not having an RTC causes this.
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: NTP vs systemd on RTC-less devices

Postby towolf » Thu Mar 20, 2014 11:31 pm

I’ve solved it now, after much head scratching, like this:

$this->bbcode_second_pass_code('', '# cat /etc/netctl/eth0
Description='A basic dhcp ethernet connection'
Interface=eth0
Connection=ethernet
IP=dhcp
ExecUpPost='logger -p err ***** that ***** && /usr/bin/ntpd -gq && systemctl start nginx && systemctl start ntpd || true'

## for DHCPv6
#IP6=dhcp
## for IPv6 autoconfiguration
')

And disable nginx and ntpd.

So much for the wonderful auto-magic world of systemd.
towolf
 
Posts: 12
Joined: Mon Oct 07, 2013 10:23 pm

Re: NTP vs systemd on RTC-less devices

Postby moonman » Fri Mar 21, 2014 7:30 am

$this->bbcode_second_pass_code('', 'pacman -Sy fake-hwclock') would've solved your problem too, though it would be off by the amount of time your device was turned off.
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3387
Joined: Sat Jan 15, 2011 3:36 am

Re: NTP vs systemd on RTC-less devices

Postby towolf » Fri Mar 21, 2014 11:13 am

Yeah, that wouldn’t have helped much. Kind of a stupid idea for a clock package. "The time? Yeah sure, when I last wore my watch it was nine thirty, so it’s gotta be nine thirty now roundabouts"


It’s not a hugely demanding thing to ask of one’s init system to provide a feature that starts a service once the network is configured and has a route.

According to some systemd docs it is the responsibility of the networking setup to tie into network-online.target. Maybe that’s something to add to netctl then.
towolf
 
Posts: 12
Joined: Mon Oct 07, 2013 10:23 pm


Return to User Questions

Who is online

Users browsing this forum: No registered users and 8 guests