* ntpd to set clock prior to mount
@ 2013-11-14 23:23 Rex Vaughn
[not found] ` <CAF-o458j3=kA8FWMLzg9VSg-Pg5SrOjzPY4sN64U9kZv0i-j7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Rex Vaughn @ 2013-11-14 23:23 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA
I have a set of machines that don't have battery backups for the real
time clock. when the power is cycled on these machines, the real time
clock resets to the BIOS epoch time which is usually a year or two in
the past. Each time I boot, I get fsck failure because the superblock
time is in the future. I am aware of the e2fsck configuration file
that I can put into /etc with the broken_clock option, however I
still get log files that have the time set in the past. Having
invalid times in the log files can make debugging boot problems very
problematic.
I have hacked together a dracut ntpd module that will set the time but
it requires modifications to the network module to turn on the network
even when netroot is not set.
I guess I don't really have a question because what I have done seems
to work, but I was wondering what others think of this to see if it
might be a worthwhile addition to dracut or if I should just keep
going with my hacked version.
^ permalink raw reply [flat|nested] 5+ messages in thread[parent not found: <CAF-o458j3=kA8FWMLzg9VSg-Pg5SrOjzPY4sN64U9kZv0i-j7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: ntpd to set clock prior to mount [not found] ` <CAF-o458j3=kA8FWMLzg9VSg-Pg5SrOjzPY4sN64U9kZv0i-j7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2013-11-15 3:48 ` Nathanael Noblet [not found] ` <5285997D.5090005-sGhsi8tFlmY@public.gmane.org> 2013-11-15 13:28 ` Colin Guthrie 1 sibling, 1 reply; 5+ messages in thread From: Nathanael Noblet @ 2013-11-15 3:48 UTC (permalink / raw) To: Rex Vaughn, initramfs-u79uwXL29TY76Z2rM5mHXA On 11/14/2013 04:23 PM, Rex Vaughn wrote: > I have a set of machines that don't have battery backups for the real > time clock. when the power is cycled on these machines, the real time > clock resets to the BIOS epoch time which is usually a year or two in > the past. Each time I boot, I get fsck failure because the superblock > time is in the future. I am aware of the e2fsck configuration file > that I can put into /etc with the broken_clock option, however I > still get log files that have the time set in the past. Having > invalid times in the log files can make debugging boot problems very > problematic. > > I have hacked together a dracut ntpd module that will set the time but > it requires modifications to the network module to turn on the network > even when netroot is not set. So I'm looking at writing a module that requires network access but does not require netroot, so I'd be interested in any improvements to the network module that allowed for early networks. ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <5285997D.5090005-sGhsi8tFlmY@public.gmane.org>]
* Re: ntpd to set clock prior to mount [not found] ` <5285997D.5090005-sGhsi8tFlmY@public.gmane.org> @ 2013-11-15 14:52 ` Rex Vaughn 0 siblings, 0 replies; 5+ messages in thread From: Rex Vaughn @ 2013-11-15 14:52 UTC (permalink / raw) To: Nathanael Noblet; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA > > So I'm looking at writing a module that requires network access but does not > require netroot, so I'd be interested in any improvements to the network > module that allowed for early networks. > I am running RHEL6.4 which uses dracut-004, in that version I commented out the checks for netroot in parse-ip-opts.sh, ifup, and net-genrules.sh and in netroot I commented out the netroot check at the top and delayed the netroot check at the bottom to right before source_all netroot. I will post patch files in a second post. I decided to look at dracut-034 to see what changes would be necessary there, and those lines have changed to seemingly allow network in more conidtions than 004 did, but I have not figured out if those conditions are sufficient for me to turn on the network with a simple command line option. here are the patches I made to dracut-network-004-303.el6.noarch (from the RHEL6.4 distro): *** ./ifup --- ./ifup *************** *** 121,127 **** [ -f "/tmp/net.$netif.up" ] && exit 0 [ -f "/tmp/root.info" ] || exit 0 . /tmp/root.info ! [ -z "$netroot" ] && exit 0 # loopback is always handled the same way if [ "$netif" = "lo" ] ; then --- 121,127 ---- [ -f "/tmp/net.$netif.up" ] && exit 0 [ -f "/tmp/root.info" ] || exit 0 . /tmp/root.info ! #[ -z "$netroot" ] && exit 0 # loopback is always handled the same way if [ "$netif" = "lo" ] ; then *** ./parse-ip-opts.sh --- ./parse-ip-opts.sh *************** *** 17,28 **** . /lib/dracut-lib.sh # Check if ip= lines should be used ! if getarg ip= >/dev/null ; then ! if [ -z "$netroot" ] ; then ! echo "Warning: No netboot configured, ignoring ip= lines" ! return; ! fi ! fi # Don't mix BOOTIF=macaddr from pxelinux and ip= lines getarg ip= >/dev/null && getarg BOOTIF= >/dev/null && \ --- 17,28 ---- . /lib/dracut-lib.sh # Check if ip= lines should be used ! #if getarg ip= >/dev/null ; then ! # if [ -z "$netroot" ] ; then ! # echo "Warning: No netboot configured, ignoring ip= lines" ! # return; ! # fi ! #fi # Don't mix BOOTIF=macaddr from pxelinux and ip= lines getarg ip= >/dev/null && getarg BOOTIF= >/dev/null && \ *** ./net-genrules.sh --- ./net-genrules.sh *************** *** 14,20 **** } # Don't continue if we don't need network ! [ -z "$netroot" ] && return; # Write udev rules { --- 14,20 ---- } # Don't continue if we don't need network ! #[ -z "$netroot" ] && return; # Write udev rules { *** ./netroot --- ./netroot *************** *** 13,19 **** [ -e /tmp/root.info ] || exit 1 . /tmp/root.info [ -d $NEWROOT/proc ] && exit 0 ! [ -z "$netroot" ] && exit 1 # Let's see if we have to wait for other interfaces # Note: exit works just fine, since the last interface to be --- 13,19 ---- [ -e /tmp/root.info ] || exit 1 . /tmp/root.info [ -d $NEWROOT/proc ] && exit 0 ! #[ -z "$netroot" ] && exit 1 # Let's see if we have to wait for other interfaces # Note: exit works just fine, since the last interface to be *************** *** 65,73 **** handler=${netroot%%:*} handler=${handler%%4} handler="/sbin/${handler}root" - if [ -z "$netroot" ] || [ ! -e "$handler" ] ; then - die "No handler for netroot type '$netroot'" - fi # We're here, so we can assume that upping interfaces is now ok [ -z "$IFACES" ] && IFACES="$netif" --- 65,70 ---- *************** *** 96,101 **** --- 93,102 ---- esac fi [ -n "$dest" ] && arping -q -f -w 60 -I $netif $dest + + if [ -z "$netroot" ] || [ ! -e "$handler" ] ; then + die "No handler for netroot type '$netroot'" + fi # Source netroot hooks before we start the handler source_all netroot ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ntpd to set clock prior to mount [not found] ` <CAF-o458j3=kA8FWMLzg9VSg-Pg5SrOjzPY4sN64U9kZv0i-j7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2013-11-15 3:48 ` Nathanael Noblet @ 2013-11-15 13:28 ` Colin Guthrie 2013-11-15 15:49 ` Rex Vaughn 1 sibling, 1 reply; 5+ messages in thread From: Colin Guthrie @ 2013-11-15 13:28 UTC (permalink / raw) To: initramfs-u79uwXL29TY76Z2rM5mHXA 'Twas brillig, and Rex Vaughn at 15/11/13 00:23 did gyre and gimble: > I have a set of machines that don't have battery backups for the real > time clock. when the power is cycled on these machines, the real time > clock resets to the BIOS epoch time which is usually a year or two in > the past. Each time I boot, I get fsck failure because the superblock > time is in the future. I am aware of the e2fsck configuration file > that I can put into /etc with the broken_clock option, however I > still get log files that have the time set in the past. Having > invalid times in the log files can make debugging boot problems very > problematic. While I appreciate you don't have a question as such, I should really point out that for e2fsck to complain like this is totally broken. It should be fixed upstream so the config file is just a hack at best. Relying on system clocks for any kind of mount check is just fundamentally broken. Anyway, back to the case in point, if debugging is your main problem then systemd-journal is likely the best course of action. It will allow you to present your logs in such a way that the timestamp is monotonic from the boot time and thus has no relation to wall-clock time in any shape or form. This is much better for ordering or messages and such like. Requiring ntp and thus working network links etc. seems vastly overkill here if all you need is to sort out the time. But if it works for you, then great! :) Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited http://www.tribalogic.net/ Open Source: Mageia Contributor http://www.mageia.org/ PulseAudio Hacker http://www.pulseaudio.org/ Trac Hacker http://trac.edgewall.org/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ntpd to set clock prior to mount 2013-11-15 13:28 ` Colin Guthrie @ 2013-11-15 15:49 ` Rex Vaughn 0 siblings, 0 replies; 5+ messages in thread From: Rex Vaughn @ 2013-11-15 15:49 UTC (permalink / raw) To: initramfs-u79uwXL29TY76Z2rM5mHXA Colin Guthrie <gmane@...> writes: > While I appreciate you don't have a question as such, I should really > point out that for e2fsck to complain like this is totally broken. It > should be fixed upstream so the config file is just a hack at best. > Relying on system clocks for any kind of mount check is just > fundamentally broken. > > Anyway, back to the case in point, if debugging is your main problem > then systemd-journal is likely the best course of action. It will allow > you to present your logs in such a way that the timestamp is monotonic > from the boot time and thus has no relation to wall-clock time in any > shape or form. > > This is much better for ordering or messages and such like. > > Requiring ntp and thus working network links etc. seems vastly overkill > here if all you need is to sort out the time. > Since I am running into problems with e2fsck and no battery backup on the clock, I totally agree with you that the system clock check is fundamentally broken. :-) My application requires network access and accurate time in order to function properly, but I suppose in the strictest sense I don't need the time set prior to the root filesystem being mounted. I could wait until after boot and ensure that the clocks are set at that time. As to the debugging, I am more concerned with a system that goes out to a customer, they run into a problem and tell us the problem started on date x, now I need to go into the logs and find the date time that the problem occurred. Thank you for your input, it is appreciated. RBV ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-11-15 15:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-14 23:23 ntpd to set clock prior to mount Rex Vaughn
[not found] ` <CAF-o458j3=kA8FWMLzg9VSg-Pg5SrOjzPY4sN64U9kZv0i-j7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-15 3:48 ` Nathanael Noblet
[not found] ` <5285997D.5090005-sGhsi8tFlmY@public.gmane.org>
2013-11-15 14:52 ` Rex Vaughn
2013-11-15 13:28 ` Colin Guthrie
2013-11-15 15:49 ` Rex Vaughn
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.