-
Notifications
You must be signed in to change notification settings - Fork 164
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
Downloaded logs from OrangePi5 are not chronological when run on robot #1307
Comments
Updating the version of Ubuntu will directly address this problem, but it may not be desirable to update to a very recent version until it has been thoroughly tested. In the meantime, we could keep track of the boots in the logs and that would allow us to disentangle them with a tool like this simple python script:
|
Are you sure those are actually unique boots? Is there any other cause that could make those happen? |
Very reasonable questions. I've been researching it and I think that there is strong evidence that this is the cause, but I haven't had the time to definitively prove that it is the root cause, so I've updated my original report to call it a "Proposed Root Cause". Here is some additional support for suggested root cause. Every time the system boots, it generates a random boot id which is stored at I had access to our robot today and downloaded logs and also ran The jumbled logs come from coprocessors on robots, but they don't happen for me on my coprocessor connected to my home router, since it has access to a timeserver every time it boots. The sources I linked describe this exact same behavior for coprocessors that don't have access to a way to set and maintain the clock. They also provide fixes that should correct the problem if we upgrade to a distro with a newer version of systemd. I haven't come across any other explanation for this behavior. This isn't to say that there can't be one, but I think there is strong evidence pointing to the root cause that I described. I have some ideas for tracking the boots in order so that we can straighten out the logs. I'll submit a PR once I have time to get something working. |
Describe the bug
Many times, we ask for logs to help diagnose the problem, but the logs pulled from an OrangePi by journalctl have the results from all the boots mixed together like:
The entries above come from 5 different boots of the coprocessor. They also aren't necessarily in any chronological order, so when looking at them, you can't be sure that the earlier boots are listed first in the log output. The result is a tangled log that is nearly impossible to make sense of.
To Reproduce
Steps to reproduce the behavior:
Proposed Root Cause
The OrangePi doesn't have a real-time clock (RTC), so it must query a network time provider via NTP every time it boots to get the correct time. If an NTP server isn't available, then it defaults to using the time that the file
/var/lib/systemd/timesync/clock
was last updated. In versions of systemd prior to 250, this file is only updated when the system gets a valid response from a timeserver. A coprocessor mounted on a robot never connects to a timeserver, so this file is never updated and every time it boots, it sets the clock to the same time. When journalctl outputs the logs, it sorts the entries by the timestamps, which are the same across multiple boots, so the entries get mixed together. Ubuntu 22.04 (jammy) comes withsystemd
version 249.11.systemd
version 250 includesSaveIntervalSec
setting fortimesyncd
, which will update the clock file regularly regardless of it getting a timeserver connection. This provides a generally monotonic clock on any coprocessor, even it it never gets a valid time sync and lacks an RTC. Ubuntu versions from 23.04 include this feature.systemd
version 254 includes a fix that will order journal entries by boot ID if the system doesn't have a RTC. This version is available in Ubuntu 24.04 (pre-release as of 4/3/2024).Additional context
sd-journal: find a smart way to order log lines from different boots if neither has a useful wallclock time.
journald: support ordering journal entries by boot ID if no RTC is available
The text was updated successfully, but these errors were encountered: