Re: Bug#520763: hwclock: NVRAM flat battery sets date to 1904
- To: Jörg Sommer <joerg@alea.gnuu.de>
- Cc: Mark Purcell <msp@debian.org>, 520763@bugs.debian.org, 520763-submitter@bugs.debian.org, bryanh@giraffe-data.com, debian-powerpc@lists.debian.org
- Subject: Re: Bug#520763: hwclock: NVRAM flat battery sets date to 1904
- From: Rogério Brito <rbrito@ime.usp.br>
- Date: Sat, 16 May 2009 20:14:19 -0300
- Message-id: <20090516231419.GC1649@ime.usp.br>
- Mail-followup-to: Jörg Sommer <joerg@alea.gnuu.de>, Mark Purcell <msp@debian.org>, 520763@bugs.debian.org, 520763-submitter@bugs.debian.org, bryanh@giraffe-data.com, debian-powerpc@lists.debian.org
- In-reply-to: <20090516171810.GA29692@alea.gnuu.de>
- References: <200905161458.01877.msp@debian.org> <20090516171810.GA29692@alea.gnuu.de>
Hi, Jörg.
On May 16 2009, Jörg Sommer wrote:
> I would much more prefer to get prompted for the correct time, because
> with a wrong time fsck fail due to the last fsck is in the future.
The basic idea is sound.
> But I don't know how to do prompting in init scripts correctly.
But the problem here is that prompting in init scripts shouldn't be
done. At least, a lot of users wouldn't like to have to attend the boot
up process. Not without a timeout in the read, at least. Controlled by
the system administrator.
And, please, do remember that while we are discussing this on
debian-powerpc, other arches suffer from the very same problem too (dead
battery/lack of power leading to clock being set waaaaay before the
current date).
> And to guess if the hardware clock is wrong I think we can look at the
> installation time of the module directory of the kernel.
> /boot/vmlinux-$(uname -r) is possible, too.
I already suggested something that is slightly more general (even though
I think that it is a hack):
* save the date on every shutdown (say, somewhere under /var or a
similar place that is guaranteed to be there when the system
boots---we have to be sure that the place isn't mounted readonly
when saving the date and that it will be available for reading);
* upon boot, if any saved date is used, then use it. Otherwise, set a
dummy date (taken, say, as the most recent from the kernel, the
filesystem being mounted or some fixed date that is known to be
"valid"---the date of the release of the package, perhaps).
I do think that this is a dirty hack, but it is a bit more flexible than
just asking the user.
> I propose this patch:
And this doesn't mean that the possibility of asking the user is
completely ignored. Just put a configuration variable there defaulting
to allow unattended boots to proceed, while still providing the
opportunity for the sysadmin to do what you proposed in your patch.
Regards,
--
Rogério Brito : rbrito@{mackenzie,ime.usp}.br : GPG key 1024D/7C2CAEB8
http://www.ime.usp.br/~rbrito : http://meusite.mackenzie.com.br/rbrito
Projects: algorithms.berlios.de : lame.sf.net : vrms.alioth.debian.org
Reply to: