Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo Embedded (http://www.linux-archive.org/gentoo-embedded/)
-   -   sysvinit: sanetime for boards without an rtc? (http://www.linux-archive.org/gentoo-embedded/556153-sysvinit-sanetime-boards-without-rtc.html)

Christopher Friedt 07-23-2011 05:10 PM

sysvinit: sanetime for boards without an rtc?
 
Hi folks,

I have a couple of boards that ship by default without RTC devices and
boot time always incurs the following nasty messages in multiplicity.

...
** One of the files in /etc/{conf.d,init.d} or /etc/rc.conf
** has a modification time in the future!
** One of the files in /etc/{conf.d,init.d} or /etc/rc.conf
** has a modification time in the future!
...

A very simple solution was be to maintain an /etc/sanetime file that
would set a time other than the epoch at boot. Something within the
last day, month, year, or decade even ;-)

There's a fallback sanetime in /etc/init.d/sanetime just in case
/etc/sanetime doesn't exist, and it works naturally because time is
monotonically increasing (last I checked).

Also, it would seem that /etc/clock doesn't fail gracefully when there
is no rtc, even when there are provisions to 'fakeit' for other
reasons.

...
** Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.Can
not access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.
** Failed to set clock You will need to set the clock yourself

* [ !! ]
...

It was just a matter of adding an /etc/init.d/sanetime script,
slightly patching /etc/init.d/clock & /sbin/rc (AFAIK this only works
for sysvinit, not openrc).

See the attached files.

Cheers,

C

PS: I was going to file a bug report, but it seems that the
certificate for bugs.gentoo.org has become invalid ATM.

Peter Volkov 07-28-2011 07:56 AM

sysvinit: sanetime for boards without an rtc?
 
Hi Christopher.

В Сбт, 23/07/2011 в 13:10 -0400, Christopher Friedt пишет:
> I have a couple of boards that ship by default without RTC devices
>
> PS: I was going to file a bug report, but it seems that the
> certificate for bugs.gentoo.org has become invalid ATM.

Please open a bug report. Certificates should be valid now. Probably
it's good idea to show this problem to openrc guys, so they could
review/suggest solution.

--
Peter.

Christopher Friedt 07-28-2011 01:28 PM

sysvinit: sanetime for boards without an rtc?
 
Done [1]!

It was google chrome that wouldn't give me the option to continue with
the bug report, so I just used a different browser.

Apparently though, a similar mechanism already exists for OpenRC
called swclock instead of hwclock, and they said I should just do
this:

rc-update del hwclock boot
rc-update add swclock boot

Still, that only exists for OpenRC, AFAIK, not the regular baselayout,
so any images that don't use OpenRC would need to be updated.

Thanks,

C

[1] https://bugs.gentoo.org/show_bug.cgi?id=376249

On Thu, Jul 28, 2011 at 3:56 AM, Peter Volkov <pva@gentoo.org> wrote:
> Hi Christopher.
>
> В Сбт, 23/07/2011 в 13:10 -0400, Christopher Friedt пишет:
>> I have a couple of boards that ship by default without RTC devices
>>
>> PS: I was going to file a bug report, but it seems that the
>> certificate for bugs.gentoo.org has become invalid ATM.
>
> Please open a bug report. Certificates should be valid now. Probably
> it's good idea to show this problem to openrc guys, so they could
> review/suggest solution.
>
> --
> Peter.
>
>
>

Christopher Friedt 07-28-2011 01:28 PM

sysvinit: sanetime for boards without an rtc?
 
Done [1]!

It was google chrome that wouldn't give me the option to continue with
the bug report, so I just used a different browser.

Apparently though, a similar mechanism already exists for OpenRC
called swclock instead of hwclock, and they said I should just do
this:

rc-update del hwclock boot
rc-update add swclock boot

Still, that only exists for OpenRC, AFAIK, not the regular baselayout,
so any images that don't use OpenRC would need to be updated.

Thanks,

C

[1] https://bugs.gentoo.org/show_bug.cgi?id=376249

On Thu, Jul 28, 2011 at 3:56 AM, Peter Volkov <pva@gentoo.org> wrote:
> Hi Christopher.
>
> В Сбт, 23/07/2011 в 13:10 -0400, Christopher Friedt пишет:
>> I have a couple of boards that ship by default without RTC devices
>>
>> PS: I was going to file a bug report, but it seems that the
>> certificate for bugs.gentoo.org has become invalid ATM.
>
> Please open a bug report. Certificates should be valid now. Probably
> it's good idea to show this problem to openrc guys, so they could
> review/suggest solution.
>
> --
> Peter.
>
>
>

Christopher Friedt 07-28-2011 01:28 PM

sysvinit: sanetime for boards without an rtc?
 
Done [1]!

It was google chrome that wouldn't give me the option to continue with
the bug report, so I just used a different browser.

Apparently though, a similar mechanism already exists for OpenRC
called swclock instead of hwclock, and they said I should just do
this:

rc-update del hwclock boot
rc-update add swclock boot

Still, that only exists for OpenRC, AFAIK, not the regular baselayout,
so any images that don't use OpenRC would need to be updated.

Thanks,

C

[1] https://bugs.gentoo.org/show_bug.cgi?id=376249

On Thu, Jul 28, 2011 at 3:56 AM, Peter Volkov <pva@gentoo.org> wrote:
> Hi Christopher.
>
> В Сбт, 23/07/2011 в 13:10 -0400, Christopher Friedt пишет:
>> I have a couple of boards that ship by default without RTC devices
>>
>> PS: I was going to file a bug report, but it seems that the
>> certificate for bugs.gentoo.org has become invalid ATM.
>
> Please open a bug report. Certificates should be valid now. Probably
> it's good idea to show this problem to openrc guys, so they could
> review/suggest solution.
>
> --
> Peter.
>
>
>

Ed W 07-29-2011 03:35 PM

sysvinit: sanetime for boards without an rtc?
 
On 28/07/2011 14:28, Christopher Friedt wrote:
> Apparently though, a similar mechanism already exists for OpenRC
> called swclock instead of hwclock, and they said I should just do
> this:
>
> rc-update del hwclock boot
> rc-update add swclock boot

You beat me too it!

Yes, this just bumps the clock forward monotonically. Usually this is a
useful improvement, but you may also need a cron job to touch your clock
file if you don't expect the shutdown script to run...

Openrc has quite a few nice tweaks tucked away in it. Worth looking
through the more obscure options

Cheers

Ed W


All times are GMT. The time now is 11:51 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.