Summary
The NTP sync loop in /etc/init.d/oc-bootstrap is missing a trailing &, so it runs synchronously inside the boot() function. This blocks the rest of the boot sequence and, because ntpdate retries every 5 seconds until success, can leave the printer with an unset clock (showing 1970-01-01) and potentially other boot-time services never started.
Where the bug is
File: oc-patches/services/bootstrap-oc/oc-bootstrap in the cc-fw-tools-canvas repo (the currently active CC1 OpenCentauri patch tree).
Current code (lines 84–90):
# Synchronize time to NTP, and every 24 hours!
sh -c 'while true; do
until /usr/sbin/ntpdate pool.ntp.org; do
sleep 5
done
sleep 86400
done'
The final done' has no &, so the whole sh -c subprocess is foregrounded. The surrounding /etc/init.d/oc-bootstrap boot() function cannot return until the sh -c exits, and the sh -c only exits if ntpdate succeeds once and then the inner while true eventually terminates — which it never does because it loops forever every 24 hours.
In practice, the visible symptom is the system clock staying at 1970-01-01, which breaks file/print history timestamps, logs, and anything else relying on real time.
Reported by
Impact
- Clock is not synchronized at boot, so timestamps stay at 1970-01-01.
- Any code after the NTP block in
oc-bootstrap (inside the if [ -f /kip/etc/entware_release ] branch) may never execute, because the function never returns.
- File/print history shows
'--' or 1970 dates (already reported by davidt_1 in the same channel).
Suggested fix
Add & to background the NTP sync loop, matching other backgrounded loops in the same file (e.g. mount_usb_daemon &, udhcpc ... &, updatedb loop with &):
# Synchronize time to NTP, and every 24 hours!
sh -c 'while true; do
until /usr/sbin/ntpdate pool.ntp.org; do
sleep 5
done
sleep 86400
done' &
Optionally also consider:
- Adding a small initial
sleep or a network-readiness check before the first ntpdate attempt, so the retry loop isn't hammering pool.ntp.org during the first few seconds of boot.
- Logging
ntpdate output to /tmp or syslog for diagnostics.
Related issues
- The file/print history timestamp issues reported in
#patched-fw may be downstream of this bug.
Verification steps
- Build a firmware image with the fix.
- Flash to a CC1.
- Boot with no existing NTP sync.
- Check
date shortly after boot — should be current, not 1970-01-01.
- Check that the rest of
oc-bootstrap completed (e.g. SSH/Entware services are up, mount_usb_daemon is running).
- Verify
/usr/sbin/ntpdate is still retrying in the background by inspecting ps.
Summary
The NTP sync loop in
/etc/init.d/oc-bootstrapis missing a trailing&, so it runs synchronously inside theboot()function. This blocks the rest of the boot sequence and, becausentpdateretries every 5 seconds until success, can leave the printer with an unset clock (showing 1970-01-01) and potentially other boot-time services never started.Where the bug is
File:
oc-patches/services/bootstrap-oc/oc-bootstrapin thecc-fw-tools-canvasrepo (the currently active CC1 OpenCentauri patch tree).Current code (lines 84–90):
The final
done'has no&, so the wholesh -csubprocess is foregrounded. The surrounding/etc/init.d/oc-bootstrapboot()function cannot return until thesh -cexits, and thesh -conly exits ifntpdatesucceeds once and then the innerwhile trueeventually terminates — which it never does because it loops forever every 24 hours.In practice, the visible symptom is the system clock staying at
1970-01-01, which breaks file/print history timestamps, logs, and anything else relying on real time.Reported by
davidt_1on Discord#patched-fw: "Time seems to be set to 1/1/1970. Maybe something weird with the NTP scan" — https://discord.com/channels/1367538416539013122/1427058990759678103/1521500304666001520pdscomp(project maintainer) followed up confirming the NTP code was added to wait for network before syncing, and then noted: "ruh roh maybe missing an ampersand on that NTP service" — https://discord.com/channels/1367538416539013122/1427058990759678103/1521501506849865828Impact
oc-bootstrap(inside theif [ -f /kip/etc/entware_release ]branch) may never execute, because the function never returns.'--'or 1970 dates (already reported bydavidt_1in the same channel).Suggested fix
Add
&to background the NTP sync loop, matching other backgrounded loops in the same file (e.g.mount_usb_daemon &,udhcpc ... &,updatedbloop with&):Optionally also consider:
sleepor a network-readiness check before the firstntpdateattempt, so the retry loop isn't hammeringpool.ntp.orgduring the first few seconds of boot.ntpdateoutput to/tmpor syslog for diagnostics.Related issues
#patched-fwmay be downstream of this bug.Verification steps
dateshortly after boot — should be current, not 1970-01-01.oc-bootstrapcompleted (e.g. SSH/Entware services are up,mount_usb_daemonis running)./usr/sbin/ntpdateis still retrying in the background by inspectingps.