WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: hwclock -w error on 4.3  (Read 2891 times)

Offline KHarvey

  • Full Member
  • ***
  • Posts: 102
hwclock -w error on 4.3
« on: February 29, 2012, 03:27:11 PM »
I think that this worked on older versions of TC but I am not around an older version right now to test.

When I run hwclock -w on TC 4.3 I receive the following error:
hwclock: can't open '/dev/misc/rtc': No such file or directory

I think this is the cause of my NTP problems as my NTPClient command on boot sets the hwclock as well.

Any suggestions?

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: hwclock -w error on 4.3
« Reply #1 on: February 29, 2012, 03:39:06 PM »
Did you run the command with the required permissions (i.e. as super-user, e.g. via sudo hwclock -w)?

Offline KHarvey

  • Full Member
  • ***
  • Posts: 102
Re: hwclock -w error on 4.3
« Reply #2 on: February 29, 2012, 03:55:02 PM »
Dang, I think I know what I did wrong now.

I am running the following command in bootlocal.sh
while ! nslookup ntpserver.local &>/dev/null ; do sleep 1 ; done ; ntpclient -s -h ntpserver.local ; hwclock -w

But it isn't updating the time on boot.  If I run
sudo ntpclient -s -h ntpserver.local
It will update the time.

If I run
sudo ntpclient -s -h ntpserver.local ; hwclock -w
Then I receive the error.

But you're right, if I run
sudo ntpclient -s -h ntpserver.local ; sudo hwclock -w
Everything runs perfectly fine.

Do I need to use sudo inside my bootlocal.sh?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11623
Re: hwclock -w error on 4.3
« Reply #3 on: February 29, 2012, 05:40:37 PM »
I've seen it stated many times here on the forum that commands in bootlocal.sh do not require sudo.

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: hwclock -w error on 4.3
« Reply #4 on: February 29, 2012, 05:41:56 PM »
I'd say NO to the need to put a 'sudo' in front of commands that are in '/opt/bootlocal.sh', as those should be executed by a super-user process.

In my experience there can be subtle differences between execution of commands from an interactive shell vs. running them as part of the boot process. I mean things like to which degree '/etc/profile' and "friends" come into the mix etc. If I would have to troubleshoot something like this I'd put my "Do not make any assumption" hat on and "pepper" the script with as much reporting of return values etc. as needed to get to the bottom of it. And of course all this surplus information logging will have to be re-directed to a log file like '/tmp/dbg.log' as one should not assume to be able to read it off the screen as things unfold.

The only obvious thing I could recommend from here is to not assume that the 'ntpclient' command has worked before running 'hwclock' (i.e. use ntpclient -s -h ntpserver.local && hwclock -w). That said I don't believe that this is your problem, I just think it to be "best practice".


Offline KHarvey

  • Full Member
  • ***
  • Posts: 102
Re: hwclock -w error on 4.3
« Reply #5 on: March 02, 2012, 10:13:43 AM »
Sorry for the delay in my response.

I figured out what my problem was.  Basically I am a dunce and I forgot the & at the end of each line of the /opt/local.sh

Thank you all for your help.  Some times it's hard to see the forest through the trees.

Also one last thing, I have found sometimes (happened 4 times out of 15) when going to the forums or this specific post I am being redirected to some malicious sites.  Now I have been connecting through Windows when this has happened, and I haven't ran a malware scan on my computer to see if it is just my computer.  But so far it has only happened on the Tiny Core forums and no other websites (I spend a lot of time online).  Not sure where I should post this at, but I will try to create another post in another forum after I run a malware scan.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: hwclock -w error on 4.3
« Reply #6 on: March 02, 2012, 10:49:55 AM »
This is the first I hear of something like that, haven't had a single redirect here myself. Likely something on your end, as we don't have any ads etc which could cause that.
The only barriers that can stop you are the ones you create yourself.