<div dir="ltr">Hello,<br><br>I have an embedded system that does not have a real-time clock. I was<br>hoping to run journald on it, but have run into some problems.<br><br>My problem is that my system currently does not guarantee a monotonically<br>increasing time, and that seems to confuse journald a bit.<br><br>Btw: I've tested this on v243-stable.<br><br>(The system syncs over NTP, but there are some issues with this as well, more on that later)<br><br>I originally found the problem since there were boots missing. E.g)<br><br># journalctl --list-boots<br>-4 44cabeed86e34d09a4eca0dbff43b19f Mon 2020-08-03 14:27:59 UTC—Tue 2020-09-15 09:13:52 UTC<br>-3 71164e7d83a9448c9e70bb59b6190a45 Tue 2020-09-15 09:13:52 UTC—Tue 2020-09-15 09:14:48 UTC<br>-2 2e565a1c8dc84d4e95055e4cb4d0cc25 Tue 2020-09-15 09:14:48 UTC—Tue 2020-09-15 09:16:11 UTC<br>-1 3c672d6fb8084f5fa5923a1ae5e0e53d Tue 2020-09-15 09:16:11 UTC—Tue 2020-09-15 09:31:52 UTC<br> 0 afc0d98f275e4999aa061c7bb61b85d2 Tue 2020-09-15 09:33:35 UTC—Tue 2020-09-15 09:56:12 UTC<br><br># journalctl -F _BOOT_ID  <br>44cabeed86e34d09a4eca0dbff43b19f<br>71164e7d83a9448c9e70bb59b6190a45<br>1465a36c753f43df92bcc0a76d8e763e<br>2e565a1c8dc84d4e95055e4cb4d0cc25<br>3c672d6fb8084f5fa5923a1ae5e0e53d<br>afc0d98f275e4999aa061c7bb61b85d2<br>302cc41b146c4b3c88f06df102913c3f<br><br>I've poked around in the source code think I found the reason for<br>this: journal_file_compare_locations() (in journal-file.c) compares<br>seqnum if within the the same seqnum_id, but uses current_realtime if<br>not within the same seqnum_id. Since my realtime can't be trusted I<br>sometimes have journalfiles within the same seqnum_id which "jumps"<br>back in time. That combined with the traversal in real_journal_next()<br>gives a stochastic behaviour.<br><br>I have tried fixing my clock to give a monotonically increasing<br>clock. But: I want my system to boot as fast as possible, even without<br>a NTP-syncronized time. And I've noticed that if I shutdown before<br>getting a NTP time timesyncd will not have touched the "clock" file,<br>and I end up in the situation above.<br><br>Now to my question: What is the best practice in using journald on<br>systems without RTC? It it even "supported"?<br><br>/Regards,<br>Magnus Berglund<br><br><br><br></div>