On Fri, Jan 12, 2024 at 04:47:06PM +0100, Christian Gut wrote:

> Hi Otto,
> 
> 
> > On 12. Jan 2024, at 15:52, Otto Moerbeek <o...@drijf.net> wrote:
> > 
> > On Fri, Jan 12, 2024 at 02:35:47PM +0100, Christian Gut wrote:
> > 
> >> Hi,
> >> 
> >> Could somebody point me to documentation or tell me where OpenBSD gets the 
> >> time from, when the system has no RTC and ntpd is not working?
> >> 
> >> I am using an EdgeRouter / octeon and at every reboot, the date/time gets 
> >> reset to the exact same date.
> >> 
> >> I tried to read the source code of boot(9) and inittodr(9). I can see, 
> >> that there seems to be a fallback to some timestamp that comes from the 
> >> filesystem. Maybe when the root filesystem is mounted as of 
> >> ffs_mountroot() for example. But my understanding did not go so far to 
> >> identify from which file, directory, superblock or other filesystem 
> >> metadata the information really comes from.
> >> 
> >> It seems to me, that either my system is broken or something on octeon 
> >> does not work correctly for this fallback to happen correctly.
> >> 
> >> Kind Regards,
> >> Christian
> >> 
> > 
> > When there is no RTC or reading it fails, the "last written" timestamp
> > of the root filesystem is used. 
> 
> Somehow this does not seem to work on that system. 
> 
> > What are you observing exactly? You did not tell any details.  How
> > does ntpd fail? Please show some logs (/var/log/daemon should have some
> > lines).
> 
> I know why ntpd does not work. The system operates in a very constrained 
> environment. No ntp servers reachable, no https reachable.
> 
> I am okay if the time stays roughly the same during reboot. Like the same 
> day, even only some days off is okay. But on that 7.4 system it always gets 
> reset to Oct 9, 2023.
> 
> I checked the root filesystem. It is clean after reboot.
> When the system runs and time has been corrected the following output 
> suggests, that fallback from the filesystem should work correctly, but it 
> doesnt:
> 
> # file -s /dev/rsd0a

> /dev/rsd0a: Unix Fast File system [v2] (big-endian) last mounted on /, last 
> written at Fri Jan 12 16:45:42 2024, clean flag 0, readonly flag 0, number of 
> blocks 441848, number of data blocks 425527, number of cylinder groups 5, 
> block size 16384,
 fragment size 2048, average file size 16384, average 
> number of files in dir 64, pending blocks to free 0, pending inodes to free 
> 0, system-wide uuid 0, minimum percentage of free blocks 5, TIME optimization
> 
> Anything I could check?
> Maybe it has to do with the way Octeon boots?
> 
> Kind Regards,
> Christian

http://man.openbsd.org/octrtc seems to suggest EdgeRouter does not have
an RTC. A dmesg should give more certainty.

If you have ann RTC that is read but gives a wrong value you should see
a consistency check messages from inittodr().

So can you show the dmesg? It contains the relevant kernel messages at
the end and allow us to see if you actually have an RTC.

        -Otto

Reply via email to