[sclug] Re: Network startup on Debian
Graham
lists at Information-Cascade.co.uk
Tue Oct 24 22:07:46 UTC 2006
> Message: 2
> Date: Mon, 23 Oct 2006 20:12:51 +0100
> From: David Given <dg at cowlark.com>
> Subject: [sclug] Network startup on Debian
> To: sclug <sclug at sclug.org.uk>
> Message-ID: <453D1433.3060605 at cowlark.com>
> Content-Type: text/plain; charset="utf-8"
>
> Here's a good old fashioned Linux question!
>
> I've got this Debian box. (My Amstrad E3, if anyone cares.) It's hardware
> clock is borked, so every time it boots it resets to 1970.
Thats unusual, you have checked the battery?
How is the battery-drain-reset-cmos jumper?
> Fine, I think. This is what ntpdate and openntpd is for. A quick (well, very
> slow) aptitude run later, and ntpdate is working fine.
>
> Reboot. Oh, dear.
>
> There are two things going on: firstly, the boot sequence only runs ntpdate
> *after* the filesystem is mounted, which means that it continually things it's
> been several thousand days since the filesystem was last fscked, and so it
> sits there for half an hour grinding through it; and secondly, this thing is
> connected to the 'net via a zd1201 USB wireless thingy, which wants firmware.
> Linux's idiotic firmware loader runs in user space. The USB driver tries to
> find the firmware when the kernel boots, before the firmware loader has
> loaded. So after booting I have to unplug and reinsert the thingy in order to
> make the network come up.
>
> Any suggestions?
tune2fs -i 0 /dev/sdz9
This sets an infinite check interval,
so that the fs is never checked BECAUSE OF TIME
tune2fs -c 28 /dev/sdz9
This sets a mount count interval,
which might be 28 days later.
On that day you will of course be in a hurry.
You can also run fsck manually (-p), maybe from boot
touch /forcefsck # /etc/init.d/checkroot.sh
init 6
If you are bored, you could create an initrd,
which sets the system clock from the ext2 (ext3) superblock.
That will also give you a 'monotonic' clock, which has some
sensible recent value, not 1970, and helps when your LAN is down.
> http://e2fsprogs.sourceforge.net
echo stats | debugfs /dev/sdz9 # shows superblock
echo stat / | debugfs /dev/sdz9
less e2fsprogs/lib/ext2fs/ext2_fs.h #
struct ext2_super_block {
...
__u32 s_mtime; /* Mount time */
__u32 s_wtime; /* Write time */
...
You can also mount the filesystem readonly, and get the date of
an often touched file. Thats less coding.
You could also setup the USB device from initrd.
--
Graham
P.S. I've just attempted the above, but not using efsprogs.
Its really easy to read the superblock, at offset 1024.
Then pick off the lo_hi byte ordered time fields.
Using the ext2 library would be 'proper'
More information about the Sclug
mailing list