LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 03-18-2009, 10:14 PM   #1
mk27
Member
 
Registered: Sep 2008
Distribution: fedora, gentoo, ubuntu
Posts: 148

Rep: Reputation: 23
#$%@! hwclock and everyone in it


I have a fedora 10 installation where hwclock does not work; it always reports errno 2 (Open of /dev/rtc failed, No such file or directory.) Currently, I have no idea how the system time is set since "hwclock" does not appear in any runlevel or init script.

I also know that /etc/localtime is a copy of an appropriate file from /usr/share/zoneinfo.
The hardware clock is set to localtime, but the value from "date" which seems to rule everything adjusts as if the clock were UTC, and it will not let me reset the timezone.

Of course, I can really set the clock in the BIOS to UTC -- but I have some other linux distos on the box which seem to be making their own way in the world and this all get screwed around with.

I do not care about setting the hardware clock via the OS; how can I get the OS to recognize my timezone and that the hardware clock is set to local time??????
 
Old 03-18-2009, 10:23 PM   #2
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 543Reputation: 543Reputation: 543Reputation: 543Reputation: 543Reputation: 543
First things first;
have you got a file on the machine called /etc/hardwareclock ?
If so, check that it contains the line "localtime".
If the file does not exist, create it, and put "localtime" into it.

I'm not sure if this will take effect immediately, (if any effect at all), or if you would need to reboot or go to init 1 and back, but it's a place to start.

As for the /dev/rtc not existing, I'd venture a guess that the kernel is not configured with the correct option(s) for the rtc device to exist.

You could manually create it, though I'm not sure if that will actually make it available for use.. It might though. The /dev/rtc device on a 2.6 kernel is a CHARACTER device, MAJOR 10, MINOR 135, which you can create with the 'mknod' command.

Last edited by GrapefruiTgirl; 03-18-2009 at 10:27 PM.
 
Old 03-18-2009, 11:01 PM   #3
mk27
Member
 
Registered: Sep 2008
Distribution: fedora, gentoo, ubuntu
Posts: 148

Original Poster
Rep: Reputation: 23
Quote:
Originally Posted by GrapefruiTgirl View Post
First things first;
have you got a file on the machine called /etc/hardwareclock ?
If so, check that it contains the line "localtime".
If the file does not exist, create it, and put "localtime" into it.
This didn't make a difference, but mknod and then hwclock --hctosys and everything's fine, thanks much. I also adjust something something in /etc/sysconfig/clock, I don't know if either of these those two things will matter since hwclock presumes localtime anyway, Or So I Have Been Told.

I do have a hand rolled kernel right now, but the stock kernel did the same thing. Part of the problem was the other install is debian lenny, which seems to work hwclock wise, meaning the behavior of the two systems mismatch and I am supposed to be developing software for the one but prefer using the other setup to work in, so I have to keep swithching back and forth. BTW I have not seen a kernel option to do with the hardware clock in a long time.

So what should I do now, just stick the mknod and --hctosys in rc.local? Or will that be too late? There is an init script called "udev-post", maybe that will be a good place...the inittab on in this thing is one line! Sigh.
 
Old 03-18-2009, 11:16 PM   #4
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 543Reputation: 543Reputation: 543Reputation: 543Reputation: 543Reputation: 543
Code:
# Set the system time from the hardware clock using hwclock --hctosys.

if [ -x /sbin/hwclock ]; then
  # Check for a broken motherboard RTC clock (where ioports for rtc are
  # unknown) to prevent hwclock causing a hang:
  if ! grep -q -w rtc /proc/ioports ; then
    CLOCK_OPT="--directisa"
  fi
 /sbin/hwclock --adjust
  if grep -wq "^UTC" /etc/hardwareclock ; then
    echo "...setting system time from the hardware clock (UTC)."
    /sbin/hwclock $CLOCK_OPT --utc --hctosys
  else
    echo "...setting system time from the hardware clock (localtime)."
    /sbin/hwclock $CLOCK_OPT --localtime --hctosys
  fi
fi
The above is what's in my rc.S file, which is the first init script that gets run from inittab when my system boots.
Again, this is Slackware, not Fedora, so I'm not sure how this applies exactly.

I am running the latest kernel, hand-made, (despite what my sidebar claims) and there are still a couple options in there regarding RTC, which I presume have some effect on what /dev/nodes are made, and/or what hardware device(s) as far as clocks go, are looked for by the kernel. One of the options as I recall is in the 'character devices' section.

Finally, I would like to think the /dev/rtc node would persist over reboots, but maybe it won't.. If not, then I would put the mknod instructions either in rc.S if you have one, and/or if your system uses the rc.1, rc.2 etc folder system for runlevel scripts, make a script accordingly and put a startup link in each of levels 1,2,3,4,5 folders.

Hope this helps

SVA
 
Old 03-18-2009, 11:18 PM   #5
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 543Reputation: 543Reputation: 543Reputation: 543Reputation: 543Reputation: 543
I dunno how a one-line inittab gets much done, but maybe it would be a worthwhile idea to put a more complete inittab on the system? Either copying one from another distro of yours and adjusting it where necessary, or I could post mine if it would help..

UPDATE: In xconfig (for making kernel) scroll down to the 'character devices' section, and you will get in there a checkbox for "Create legacy RTC device /dev/rtc" or similar. That will solve that issue properly.

Last edited by GrapefruiTgirl; 03-18-2009 at 11:25 PM. Reason: update about /dev/rtc
 
Old 03-18-2009, 11:41 PM   #6
mk27
Member
 
Registered: Sep 2008
Distribution: fedora, gentoo, ubuntu
Posts: 148

Original Poster
Rep: Reputation: 23
Quote:
Originally Posted by GrapefruiTgirl View Post
One of the options as I recall is in the 'character devices' section.
Teehee, look at that. Well I guess I just did check it automatically, because it is there. Re: the rc.S script, I grepped through all the init scripts and none of them mention hwclock except in combination with "halt". However, I run the FC10 very stripped down, maybe something that was pulled out.

Quote:
Finally, I would like to think the /dev/rtc node would persist over reboots,
Goodness no! Fedora uses udev, the entire /dev is I think empty between boots. I just noticed mounting debian that /dev contents ARE there, I had just presumed all distos were like this now. Hmmph...but there is no rtc there either. Thinks again.

Last edited by mk27; 03-18-2009 at 11:43 PM.
 
Old 03-18-2009, 11:46 PM   #7
mk27
Member
 
Registered: Sep 2008
Distribution: fedora, gentoo, ubuntu
Posts: 148

Original Poster
Rep: Reputation: 23
Quote:
Originally Posted by GrapefruiTgirl View Post
I dunno how a one-line inittab gets much done, but maybe it would be a worthwhile idea to put a more complete inittab on the system? Either copying one from another distro of yours and adjusting it where necessary, or I could post mine if it would help..
I can write an old school inittab, I used to make little bootable floppies. The trend in Fedora seems to imply "opaque souce".
 
Old 03-18-2009, 11:52 PM   #8
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 543Reputation: 543Reputation: 543Reputation: 543Reputation: 543Reputation: 543
Yeah, Slackware use UDEV too, and I'm not totally sure how it works, but one time (I was trying something or other) and I deleted the contents of my /dev folder in the hopes that upon reboot, it would remake everything afresh and without tonnes of extra nodes I didn't need. Boy was I wrong! Luckily I had backed up the contents BEFORE deleting them, as the machine would not boot at all, I had to restore the contents...So evidently SOME of the /dev nodes are carried over during reboot out of necessity, but not all.

The symlink and node I use for my modem (on another machine now) I need to recreate upon reboot, and I do that in rc.local.

Anyhow, best of luck!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
regarding hwclock davender84 Linux - General 2 03-14-2009 02:38 PM
hwclock doesn't do anything fungusamung Linux - Hardware 5 11-15-2006 06:56 PM
hwclock weirdness Peter Aleksic Linux - Software 2 12-13-2005 02:06 PM
hwclock alaios Linux - General 1 11-02-2004 08:40 AM
hwclock - HTS Linux - Software 4 10-28-2004 02:21 AM


All times are GMT -5. The time now is 02:27 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration