Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking tkt for "set system time from browser time" [user devices bring IIAB clock up to date, e.g. when ntp & RTC not available] #1680

Closed
holta opened this issue May 19, 2019 · 19 comments

Comments

@holta
Copy link
Member

holta commented May 19, 2019

iiab/iiab-admin-console#204

Refs:
#71 Needless routines on Rpi (RTC, TZ)
#657 3 different RPi3 RTC's (DS3231) don't retain the time on IIAB 6.5/master

@holta holta added this to the 7.0 milestone May 19, 2019
@holta
Copy link
Member Author

holta commented May 23, 2019

@tim-moody, to document optional disabling of this auto-time-fixing feature in http://FAQ.IIAB.IO, what should we write?

@avni, please see the revised testing procedure @ iiab/iiab-admin-console#204 (comment)

@holta
Copy link
Member Author

holta commented May 30, 2019

@avni please see Item 2.d.ii. in today's (May 30, 2019) http://minutes.iiab.io

In short...we'd really like you to help make sure Randy Tate & all in Uganda are happy with IIAB's experimental new feature whereby RPi/IIAB servers' clocks are now auto-set by nearby iPhones, Androids, etc — this works when the IIAB is not using ntp i.e. truly offline — and the IIAB's clock appears more than 2 min behind the times etc.

Note the RPi/IIAB's clock is never moved backward, only forward, per the current implementation. So there will occasionally be a risk that its clock will "permanently" jump ahead too many hours/days/years if a nearby phone has its clock set wrong (!?)

So...after you've tested this feature (instructions @ #1680) please also try disabling the feature entirely as follows, e.g. if deployments/schools want a more unhackable-if-often-tardy clock:

  • Admin Console (http://box.lan/admin) > Content Menus > Menu Properties > Properties of Current Menu > uncheck "Check to Allow Power Off Link." (does not require an Ansible run thankfully!)
  • in the unlikely event apache_allow_sudo really was False in /etc/iiab/local_vars.yml, then you’d need an Ansible run

RSVP @avni please if possible! Then we can document to http://FAQ.IIAB.IO with your impressions well prior to IIAB 7.0's release around June 20th.

PS @tim-moody does Linux's fakeclock presumably continue to work, even when you disable the above, such that the system clock is saved to disk during most poweroffs for the next bootup?

@holta
Copy link
Member Author

holta commented Jun 27, 2019

@avni thanks for please testing the above on your new Raspberry Pi 4 Friday night (in ~48h from now) if you can!

@holta
Copy link
Member Author

holta commented Jul 1, 2019

@avni can you follow the instructions @ iiab/iiab-admin-console#204 (comment) prior to IIAB 7.0's release, to test out & confirm that auto-sync'ing of RPi 4's clock works, when a nearby iPhone begins browsing?

@holta holta changed the title Tracking tkt for "set system time from browser time" Tracking tkt for "set system time from browser time" [users bring RTC clock up to date, when ntp not available] Jul 6, 2019
@holta holta changed the title Tracking tkt for "set system time from browser time" [users bring RTC clock up to date, when ntp not available] Tracking tkt for "set system time from browser time" [user devices bring IIAB clock up to date, e.g. when ntp & RTC not available] Jul 7, 2019
@avni
Copy link
Member

avni commented Jul 7, 2019

Did the 10 minute turn-off test today. Some interesting results.

Prior to shutting off:
pi@box:~ $ date
Sun 07 Jul 2019 04:02:07 PM EDT

After restarting, prior to browsing:
pi@box:~ $ date
Sun 07 Jul 2019 03:20:12 PM EDT

After browsing:
pi@box:~ $ date
Sun 07 Jul 2019 04:32:18 PM EDT

@avni
Copy link
Member

avni commented Jul 7, 2019

Useragent: AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Safari/605.1.15
It's interesting that the RPi went backwards in time. I used the "shutdown" command to turn it off.

@avni
Copy link
Member

avni commented Jul 7, 2019

Did another 10 minute test with iOS. Same results:

after turning on: pi@box:~ $ date
Sun 07 Jul 2019 04:32:58 PM EDT

after accessing via iPhone iOS Safari:
pi@box:~ $ date
Sun 07 Jul 2019 05:25:23 PM EDT

@holta
Copy link
Member Author

holta commented Jul 8, 2019

@avni thanks so much for having confirmed that RPi IIAB clocks are updated automatically by nearby (recent?) iPhones and MacBook both, when the standard browser on those client devices are used!

If a mischievous kid abuses this feature (e.g. any kid can set the school's clock to 2030, or just an hour forward...saved by the bell ;) please note you can turn off this entire feature in http://box.lan/admin > Content Menus > Menu Properties > [ ] Check to Allow Browser to Update Server Time. > Save Menu

@tim-moody:

  1. Are there any other browsers/devices that should be tested?

  2. Does Linux's fake-hwclock respect manual uses of the date command bringing the time "back into the present", if the clock has been mischievously set "back to the future" by mischievous students/pranksters?

  3. Is it true that most all Linux browsers are ignored and/or are there others too?

@holta
Copy link
Member Author

holta commented Jul 9, 2019

@tim-moody:

  1. Are there any other browsers/devices that should be tested?
  2. Does Linux's fake-hwclock respect manual uses of the date command bringing the time "back into the present", if the clock has been mischievously set "back to the future" by mischievous students/pranksters?
  3. Is it true that most all Linux browsers are ignored and/or are there others too?
  1. Does clock-updating work with all port 80 URL's? Or only a subset, like IIAB's main page i.e. http://box, http://box.lan, and http://172.18.96.1 ?

@holta
Copy link
Member Author

holta commented Jul 9, 2019

The following paragraph was just added to IIAB 7.0's DRAFT Release Notes:

Update your IIAB's clock automatically even when it's offline, when nearby smartphones or laptops/devices browse to your IIAB. This helps low-end Raspberry Pi servers that contain no RTC (real-time clock), so they don't completely lose track of the current day and time.

Nearby smartphones and laptops/devices can update your IIAB's date and time automatically even when it's offline, simply by browsing to your IIAB home page (http://box). This helps low-end Raspberry Pi servers that contain no RTC (real-time clock), so they don't completely lose track of the current day and time.

Nearby smartphones and laptops/devices can update your IIAB's date and time automatically, simply by browsing to your IIAB home page (http://box). This can be a lifesaver in offline environments, with low-end Raspberry Pi servers that contain no RTC (i.e. real-time clock and coin cell battery), so they don't completely lose track of the current day and time.

Fix the clock's time and date in your IIAB automatically, simply by browsing to your IIAB home page (http://box) using a nearby smartphone or laptop/tablet/computer. This can be a lifesaver in offline environments, with low-end Raspberry Pi servers that contain no RTC (real-time clock) or coin cell battery.

@tim-moody
Copy link
Contributor

any mobile devices can be tried.
fake clock writes the time every 10 min I think. http://manpages.ubuntu.com/manpages/xenial/man8/fake-hwclock.8.html
3. yes
updating only works on the home page (if js-menu used) not on any others

@holta
Copy link
Member Author

holta commented Jul 9, 2019

fake clock writes the time every 10 min I think. http://manpages.ubuntu.com/manpages/xenial/man8/fake-hwclock.8.html

Small Correction: on Raspbian fake-hwclock runs 17 min past every hour:

root@box:~# more /etc/cron.hourly/fake-hwclock
#!/bin/sh
#
# Simple cron script - save the current clock periodically in case of
# a power failure or other crash

if (command -v fake-hwclock >/dev/null 2>&1) ; then
  fake-hwclock save
fi
root@box:~# grep hourly /etc/crontab
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
  1. Does Linux's fake-hwclock respect manual uses of the date command bringing the time "back into the present", if the clock has been mischievously set "back to the future" by mischievous students/pranksters?

@avni @tim-moody let's test this some day, just to be 100% sure!

@holta
Copy link
Member Author

holta commented Jul 9, 2019

FYI @avni's evidence suggests that fake-hwclock fails to run during graceful shutdowns (certainly on her RPi 4) even despite its man fake-hwclock documentation advertising that feature prominently:

The design expectation of fake-hwclock is that it will be run very late at shutdown and very early at boot.

Curious Aside: RPi's will almost always boot 17min past the hour, as a consequence of the above (:

Ref: #1855 "Debug/fix fake-hwclock so that it records time properly on RPi shutdown?"

@holta
Copy link
Member Author

holta commented Jul 9, 2019

updating only works on the home page (if js-menu used) not on any others

@tim-moody does RPi's clock get updated by browsers coming in over Ethernet/localhost too? (Or just browsers coming in over WiFi?)

@jvonau
Copy link
Contributor

jvonau commented Jul 9, 2019

I can't reproduce /etc/fake-hwclock.data failing to update with a reboot. As a data point could someone compare the behavior between reboot, shutdown, poweroff?

@holta
Copy link
Member Author

holta commented Jul 9, 2019

I can't reproduce /etc/fake-hwclock.data failing to update with a reboot. As a data point could someone compare the behavior between reboot, shutdown, poweroff?

Good idea. Let's try on 10.8.0.78 later, which is an RPi 4 essentially identical to @avni's with the #1855 issue.

@tim-moody
Copy link
Contributor

does RPi's clock get updated by browsers coming in over Ethernet/localhost too? (Or just browsers coming in over WiFi?)

any access to the page

@holta
Copy link
Member Author

holta commented Jul 15, 2019

This design/operations tkt is very useful to help gather feedback on how "offline" communities are facing laggardly clock issues, with or without an RTC (real-time clock) installed.

So I'm keeping it open and moving it to the IIAB 7.1 Milestone to help us keep refining this feature and its associated documentation.

@holta holta modified the milestones: 7.0, 7.1 Jul 15, 2019
@holta
Copy link
Member Author

holta commented Dec 21, 2019

Certainly good enough for now!

@holta holta closed this as completed Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants