[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: problem with util-linux-ng fsck and board with no clock



On Wednesday 26 August 2009, Andrew Sackville-West wrote:
> On Wed, Aug 26, 2009 at 01:57:20PM +0100, David Goodenough wrote:
> > I have an embedded board (a PCEngines Wrap board) which has no
> > persistent clock.  With earlier configurations I set the clock with
> > ntpdate once the network was up.
>
> interesting. I have no experience with this sort of installation, but
> have some observations/ideas that might help.
>
> > But with current sid I have a problem in that fsck in util-linux-ng  2.16
> > complains that the "Superblock last mount time (Sat Jan 1 00:01:08
> > 2000, now = Sat Jan 1 00:00:49) is in the future".
>
> it appears that the system is mounting prior to having set the clock
> as well, which makes sense.
>
> > Even if I do an fsck on the machine manually and then reboot, it always
> > fails.
>
> sure, because the mount time will always be later than the time at
> which it is trying to run fsck.
>
> > I have found some mentions on forums that swapping the order in which
> > init starts up helps, by ensuring that the system clock is set properly,
> > but I can not do that until much later when I have a network.
> >
> > Any ideas as to how to proceed.  Is there some way to supress this
> > time check?
>
> I know of no way to suppress this time check but have some ideas about
> how to get around it.
>
> You could create either a custom wrapper for the fsck script, or run
> your own script both before and after it. The one before to set the
> clock well into the future so that fsck is guaranteed to run well
> before "now". Then after fsck runs, set the clock back to 1/1/2000 so
> that the superblock last mount time will be nicely early again.
>
> or, you could set the clock back to "zero" right before mount every
> time. Since it takes about 49 seconds to get to fsck, you may be able
> to fool fsck on future boots by having the mount time some time prior
> to 0:00:49.
>
> or, as you mentioned, rework the order of things. I'm not sure how
> much of the system you need to run ntpdate, but if you move networking
> earlier and fsck later you should be able to make it work. You might
> have to fiddle with mount options for /, changing it to rw to get
> networking up and then back to ro for fsck.
>
> just some thoughts.
>
> hth
>
> A

Well I found a couple of things that are sort of relevant.

1) If you have a file /etc/e2fsck.conf and in there you have an option
buggy_init_scripts = 1 then it will ignore the time check.  BUT you have
to persuate initramfs to put this file in the initram or it will not be found
as the disk has not yet been mounted and by default it will not be put there.

2) If you put fastboot as a kernel option in lilo or grub the fsck check is 
skipped.  This is probaly not a good idea unless you use a journalled 
file system as otherwise your system could get corrupt.  But it seems
to work with ext3 if I boot the board through to the logon (which will 
already have written some log files) and then turn off the power and
reboot.  I could not find this documented anywhere, I just found that
there was a test for this in /etc/init.d/checkfs.sh so I do not know how
secure this is for the future.

There are a number of embedded boards like this without a battery
backed clock, so this problem will occur again.

David


Reply to: