Skip to content

Commit ea9defd

Browse files
fabiiw05claude
andcommitted
docs(MAINTAINING): note timesyncd vs networkd/NetworkManager conflict
The base Arch Linux ARM (rpi) tarball ships systemd-networkd enabled while customize.sh also enables NetworkManager, so both run at once. networkd claims the unplugged wired end0 and writes ONLINE_STATE=offline, which makes systemd-timesyncd never send an NTP packet. Combined with the uConsole having no RTC, the clock ends up badly off after boot. Document the symptom, root cause, the on-device permanent fix (disable/mask networkd, drop stale netif state, pin JP NTP servers), and a TODO to fix it at image-build time in customize.sh. Added to both EN and JA docs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 2cabe43 commit ea9defd

2 files changed

Lines changed: 87 additions & 0 deletions

File tree

MAINTAINING.ja.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,48 @@ Landlock is not supported by the kernel!` で停止する。自前カーネル
143143
[archlinuxarm.org](https://archlinuxarm.org/) のフロントページ告知・forum、GitHub の
144144
[archlinuxarm/PKGBUILDs](https://github.com/archlinuxarm/PKGBUILDs) を監視。
145145

146+
### 時刻同期 (systemd-timesyncd) と networkd / NetworkManager の競合
147+
148+
**症状**: 実機で `timedatectl``System clock synchronized: no` のまま、時刻が
149+
大きくずれる。`systemd-timesyncd``active` なのに `timedatectl show-timesync`
150+
`PacketCount=0` / `ServerName` 空で、**NTP パケットを 1 つも送っていない**
151+
`ping` や手動の UDP 123 クエリは通るのに、である)。
152+
153+
**原因(2 段構え)**:
154+
155+
1. **uConsole にはバッテリバックアップ RTC が無い**`timedatectl``RTC time: n/a`)。
156+
起動ごとに時刻がずれるため、ネットワーク同期が事実上必須。
157+
2. ベースの Arch Linux ARM (rpi) tarball は **`systemd-networkd` が有効**な状態で
158+
焼かれている。一方 `scripts/customize.sh`**NetworkManager を追加で有効化**する
159+
(L148 付近)。結果 **両者が二重起動**する。実接続 (`wlan0`) は NetworkManager
160+
管理だが、networkd は未接続の有線 (`end0`) を掴んで `configuring` のまま留まり、
161+
`/run/systemd/netif/state``ONLINE_STATE=offline` を書き込む。
162+
`systemd-timesyncd` はこの networkd 由来の online 状態を見て「オフライン」と判断し、
163+
**同期を開始しない**
164+
165+
**恒久対処(実機)**:
166+
167+
```sh
168+
# NetworkManager を採用しているので networkd 系は無効化して競合を解消
169+
sudo systemctl disable --now systemd-networkd.socket systemd-networkd \
170+
systemd-networkd-wait-online
171+
sudo systemctl mask systemd-networkd
172+
sudo rm -rf /run/systemd/netif # stale な offline 状態を除去
173+
# 日本の NTP サーバを明示(任意だが確実)
174+
sudo install -Dm644 /dev/stdin /etc/systemd/timesyncd.conf.d/10-japan.conf <<'CONF'
175+
[Time]
176+
NTP=ntp.nict.jp 0.jp.pool.ntp.org 1.jp.pool.ntp.org
177+
FallbackNTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org
178+
CONF
179+
sudo systemctl restart systemd-timesyncd
180+
timedatectl timesync-status # ServerName=ntp.nict.jp / synced になれば OK
181+
```
182+
183+
**TODO(イメージ側で根治)**: `scripts/customize.sh` の NetworkManager 有効化と
184+
同じ箇所で `systemctl disable systemd-networkd systemd-networkd.socket
185+
systemd-networkd-wait-online` を実行し、上記 `timesyncd.conf.d` を配置しておけば、
186+
以降のイメージはこの問題を最初から回避できる。
187+
146188
## 今後の方向性
147189

148190
- **カーネルの PKGBUILD 化**(ファイル注入をやめる)。pacman 管理下に入れば、

MAINTAINING.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,51 @@ Watch the front-page announcements and forum on
150150
[archlinuxarm.org](https://archlinuxarm.org/), and
151151
[archlinuxarm/PKGBUILDs](https://github.com/archlinuxarm/PKGBUILDs) on GitHub.
152152

153+
### Time sync (systemd-timesyncd) vs. networkd / NetworkManager conflict
154+
155+
**Symptom**: on the device `timedatectl` stays at `System clock synchronized: no`
156+
and the clock is badly off. `systemd-timesyncd` is `active`, yet
157+
`timedatectl show-timesync` shows `PacketCount=0` and an empty `ServerName`
158+
it **never sends a single NTP packet** (even though `ping` and a manual UDP 123
159+
query succeed).
160+
161+
**Root cause (two layers)**:
162+
163+
1. **The uConsole has no battery-backed RTC** (`timedatectl` reports
164+
`RTC time: n/a`), so the clock drifts on every boot and network sync is
165+
effectively mandatory.
166+
2. The base Arch Linux ARM (rpi) tarball ships with **`systemd-networkd`
167+
enabled**, while `scripts/customize.sh` additionally enables
168+
**NetworkManager** (around L148), so **both run at once**. The real link
169+
(`wlan0`) is managed by NetworkManager, but networkd claims the unplugged
170+
wired `end0`, stays stuck `configuring`, and writes
171+
`ONLINE_STATE=offline` into `/run/systemd/netif/state`.
172+
`systemd-timesyncd` reads that networkd-provided online state, concludes it
173+
is offline, and **never starts syncing**.
174+
175+
**Permanent fix (on device)**:
176+
177+
```sh
178+
# NetworkManager is our chosen manager, so disable networkd to remove the conflict
179+
sudo systemctl disable --now systemd-networkd.socket systemd-networkd \
180+
systemd-networkd-wait-online
181+
sudo systemctl mask systemd-networkd
182+
sudo rm -rf /run/systemd/netif # drop the stale offline state
183+
# Pin Japanese NTP servers (optional but reliable)
184+
sudo install -Dm644 /dev/stdin /etc/systemd/timesyncd.conf.d/10-japan.conf <<'CONF'
185+
[Time]
186+
NTP=ntp.nict.jp 0.jp.pool.ntp.org 1.jp.pool.ntp.org
187+
FallbackNTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org
188+
CONF
189+
sudo systemctl restart systemd-timesyncd
190+
timedatectl timesync-status # ServerName=ntp.nict.jp / synced == OK
191+
```
192+
193+
**TODO (fix in the image)**: in `scripts/customize.sh`, next to the
194+
NetworkManager enablement, also run `systemctl disable systemd-networkd
195+
systemd-networkd.socket systemd-networkd-wait-online` and drop the
196+
`timesyncd.conf.d` file above, so future images avoid this out of the box.
197+
153198
## Future directions
154199

155200
- **Package the kernel as a PKGBUILD** instead of file-injection. Under pacman

0 commit comments

Comments
 (0)