Chrony with GPS fallback; robust antenna supply; all GNSS constellations
Time: chrony replaces timesyncd, with NICT/JP-pool NTP primary and gpsd SHM as an offline-only refclock; makestep any time and fake-hwclock cover the battery-less RTC. Antenna: the modem cleared the supply again after the service set it, so the service is now idempotent, configurable (ANTENNA=active|passive, passive keeps it off) and re-checked by a 30 s timer. gpsd: a gpsdctl udev hook spawned a stray gpsd without -n at boot that blocked the real service; gpsd.service now binds to the NMEA device. GNSS: CGNSSMODE=15 (GLONASS, BeiDou, Galileo, QZSS) and all supported NMEA sentences; both persist across a modem reset. Adds sim7600-at. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,10 +8,11 @@ date: 2026-10-08
|
||||
|
||||
| Item | State |
|
||||
|------|-------|
|
||||
| Network time | `systemd-timesyncd`, primary `ntp.nict.jp` (stratum 1), synced over whichever uplink holds the default route (Ethernet / WiFi / LTE) |
|
||||
| Network time | **chrony** (since 2026-10-09; was `systemd-timesyncd`), primary `ntp.nict.jp` (stratum 1) + JP pool + Ubuntu pools, over whichever uplink holds the default route |
|
||||
| Timezone | `Asia/Tokyo` (was `Asia/Yakutsk`: same +09:00 and no DST either, but the wrong place) |
|
||||
| Clock across power-off | **Not kept.** The RTC has no backup battery (see below) |
|
||||
| GPS time | Not yet. Waiting on a GNSS fix (see [SIM7600 report](SIM7600-SETUP.md)) |
|
||||
| GPS time | chrony refclock `GPS` (gpsd SHM 0), fallback only; used when offline with a fix |
|
||||
| Boot clock without network | `fake-hwclock` restores the last saved time (replaces timesyncd's saved timestamp) |
|
||||
|
||||
## RTC loses time when powered off
|
||||
|
||||
@@ -41,11 +42,33 @@ FallbackNTP=ntp.ubuntu.com 0.jp.pool.ntp.org 1.jp.pool.ntp.org 2.jp.pool.ntp.org
|
||||
|
||||
`sudo systemctl restart systemd-timesyncd`, then check with `timedatectl timesync-status` (server, stratum, offset).
|
||||
|
||||
## Later: GPS as a time source
|
||||
## Chrony with GPS fallback (2026-10-09)
|
||||
|
||||
timesyncd only speaks NTP. Once GNSS has a fix, replace it with `chrony`, configured with:
|
||||
Replaced `systemd-timesyncd` (removed by the `chrony` package) so GPS can serve as an offline time source.
|
||||
|
||||
- the same NTP servers as above, which remain the default whenever any uplink exists, and
|
||||
- a gpsd refclock (`refclock SHM 0`), which takes over when offline.
|
||||
```
|
||||
sudo apt install chrony fake-hwclock
|
||||
```
|
||||
|
||||
NMEA over the USB serial port carries no PPS signal, so GPS time alone is only good to tens of milliseconds. That is plenty for log timestamps.
|
||||
`/etc/chrony/conf.d/10-yukart.conf`:
|
||||
|
||||
```
|
||||
server ntp.nict.jp iburst prefer
|
||||
pool 2.jp.pool.ntp.org iburst maxsources 2
|
||||
refclock SHM 0 refid GPS precision 1e-1 offset 0.0 delay 0.5 poll 3
|
||||
```
|
||||
|
||||
- **NTP stays primary.** The GPS refclock's generous `precision`/`delay` give it a large root distance, so any reachable NTP server wins.
|
||||
It steers the clock only offline with a fix. NMEA over USB has no PPS, so GPS time is good to ~tens of ms, plenty for log timestamps.
|
||||
- **`offset 0.0` is a placeholder.** Tune it once NTP and a GNSS fix are both available: `chronyc sourcestats` shows the GPS offset
|
||||
against NTP.
|
||||
- **`makestep 1 -1`** in `/etc/chrony/chrony.conf` (was `1 3`): step the clock whenever it's > 1 s off, not only in the first three
|
||||
updates, because with no RTC battery a stale clock may only meet its first source (a late GPS fix) well into an offline drive.
|
||||
chrony's config format has no inline comments; the explanation sits on its own line above.
|
||||
- **`fake-hwclock`** saves the time hourly and at shutdown and restores it at boot, so an offline boot starts near the last shutdown
|
||||
instead of the RTC's reset date. This replaces what timesyncd's `/var/lib/systemd/timesync/clock` did.
|
||||
- gpsd must run with **`-n`** to feed SHM without a client. See the SIM7600 report: a stray gpsd started by a `gpsdctl` udev hook ran
|
||||
without it, now fixed.
|
||||
|
||||
Check: `chronyc -n sources` (`^*` = selected NTP server, `#` = GPS refclock), `chronyc tracking`.
|
||||
At setup: synced to `ntp-a3.nict.go.jp` (stratum 1); `GPS` listed with no samples (antenna detached indoors).
|
||||
|
||||
Reference in New Issue
Block a user