WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: ntpclient Blanks Screen  (Read 64790 times)

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
ntpclient Blanks Screen
« on: February 16, 2010, 04:33:23 AM »
In bootlocal.sh the following command sets the system time correctly then blanks the screen:
Code: [Select]
# Set the system time (use with bootcode tz=GMT)
ntpclient -s -h pool.ntp.org
The behaviour is consistently displayed in FLWM and LXDE.

Any keystroke cancels the screen-blank and returns to the GUI interface.  Moving the mouse, stopping the movement, then moving again also cancels the screen-blank.

Any suggestions on how to remove the unwanted screen-blank?
 

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: ntpclient Blanks Screen
« Reply #1 on: February 16, 2010, 04:48:33 AM »
Try this:

Quote
ntpclient -s -h pool.ntp.org &
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: ntpclient Blanks Screen
« Reply #2 on: February 16, 2010, 04:53:20 AM »
Try this:

Quote
ntpclient -s -h pool.ntp.org &
Symptoms remain unchanged.  Also tried reordering other bootlocal.sh commands again symptoms remain unchanged.

Offline vitex

  • Full Member
  • ***
  • Posts: 113
Re: ntpclient Blanks Screen
« Reply #3 on: February 16, 2010, 10:28:25 AM »
In bootlocal.sh the following command sets the system time correctly then blanks the screen:
Code: [Select]
# Set the system time (use with bootcode tz=GMT)
ntpclient -s -h pool.ntp.org
The behaviour is consistently displayed in FLWM and LXDE.

Any keystroke cancels the screen-blank and returns to the GUI interface.  Moving the mouse, stopping the movement, then moving again also cancels the screen-blank.

Any suggestions on how to remove the unwanted screen-blank?
 

Does your configuration normally blank the screen after a period of inactivity?  The behavior that you describe could possibly be caused by the screen saver kicking in when ntpclient makes a large adjustment in the time.  (I have been unable to duplicate the behavior that you describe, so this is just a guess.)  I suggest that you insert calls to "date >>/path/to/some/file" before and after the call to ntpclient in bootlocal.sh so you can see how much of a step ntpclient is making.

You can also try chrony instead of ntpclient to set the time.  Chrony will slew (adjust incrementally) instead of step the time if the offset is less than 30 seconds; that default can be adjusted in /usr/local/etc/chrony/chrony.conf .

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: ntpclient Blanks Screen
« Reply #4 on: February 16, 2010, 10:51:00 AM »
Does your configuration normally blank the screen after a period of inactivity?  The behavior that you describe could possibly be caused by the screen saver kicking in when ntpclient makes a large adjustment in the time. (I have been unable to duplicate the behavior that you describe, so this is just a guess.) [...]
Your guess gave me an idea.  Configuring the bios date and time to the correct settings at boot up prevents the screen-blanking.  The bios time was some hours out of sync with ntp server time.  Your guess was both inspired and correct. 

Many thanks

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: ntpclient Blanks Screen
« Reply #5 on: February 17, 2010, 01:52:40 AM »
Having established that the screen-blanking is canceled by any keystroke, it may be possible to use this to cater for situations where the PC BIOS is subject to 'cumulative drift'.  In such circumstances the inaccuracy of the local time will become out of sync to the point where the threshold is reached that triggers the screen-blanking when the time is reset by the ntp server.

Is it possible to append a simulated carriage return keystroke to the end of the command in bootlocal.sh which runs ntpclient?  If yes, how is the keystroke command constructed?
 

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: ntpclient Blanks Screen
« Reply #6 on: February 17, 2010, 02:00:59 AM »
You could, as I have already provided in Core, by using the TZ boot code and the getTime.sh script, the command hwclock to set your BIOS time.

Since you have chosen instead to use an extension to set the time, you still could call hwclock to write the time to BIOS.  See hwclock --help
10+ Years Contributing to Linux Open Source Projects.

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: ntpclient Blanks Screen
« Reply #7 on: February 17, 2010, 03:28:53 AM »
Does your configuration normally blank the screen after a period of inactivity?  The behavior that you describe could possibly be caused by the screen saver kicking in when ntpclient makes a large adjustment in the time. (I have been unable to duplicate the behavior that you describe, so this is just a guess.) [...]
Your guess gave me an idea.  Configuring the bios date and time to the correct settings at boot up prevents the screen-blanking.  The bios time was some hours out of sync with ntp server time.  Your guess was both inspired and correct. 

Many thanks
Some additional information from further testing in FLWM with a large discrepancy between the BIOS time and the ntp server time:
  • When time is set from bootlocal.sh the screen-blanking is observed
  • When time is set from the Tools->Run_Command screen-blanking does not occur
   

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11041
Re: ntpclient Blanks Screen
« Reply #8 on: February 17, 2010, 03:44:58 AM »
Likely because of mouse moving, or the last enter press registering as an event.
The only barriers that can stop you are the ones you create yourself.

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: ntpclient Blanks Screen
« Reply #9 on: February 17, 2010, 03:59:00 AM »
Likely because of mouse moving...
I am reasonably sure it is not attributable to mouse movement.

...the last enter press registering as an event.
This may well be the case - hence my question on how to append a simulated carriage return keystroke to the end of the command in bootlocal.sh which runs ntpclient
   

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: ntpclient Blanks Screen
« Reply #10 on: February 17, 2010, 04:09:16 AM »
You could, as I have already provided in Core, by using the TZ boot code and the getTime.sh script, the command hwclock to set your BIOS time.
Thanks for this information, I am already using the bootcode "tz=GMT" but was unaware of the availability of getTime.sh

A couple of questions...

I have attempted to run this from bootlocal.sh
Code: [Select]
/usr/bin/getTime.shbut the date and time are not reset to the correct values.  Entering the same command in a terminal does reset the values.

At a future point I may wish to direct TC to a LAN based time server.  Is this possible using getTime.sh?
  
Edit: corrected typo in command
« Last Edit: February 17, 2010, 05:48:43 AM by SamK »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11041
Re: ntpclient Blanks Screen
« Reply #11 on: February 17, 2010, 04:12:45 AM »
xvkbd should be able to send simulated key events to the current window. Just might not work from bootlocal due to X security, other users can't access your display.
The only barriers that can stop you are the ones you create yourself.

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: ntpclient Blanks Screen
« Reply #12 on: February 17, 2010, 07:59:02 AM »
xvkbd should be able to send simulated key events to the current window. Just might not work from bootlocal due to X security, other users can't access your display.
I could not get it to work from bootlocal.sh.  Thanks anyway for the suggestion.
   

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: ntpclient Blanks Screen
« Reply #13 on: February 17, 2010, 08:12:21 AM »
Reporting success...
Both getTime.sh and ntpclient work in conjunction with hwclock running from bootlocal.sh without blanking the screen.  The bootcode tz=GMT is used in both cases.

Code: [Select]
sleep 3 ; /usr/bin/getTime.sh ; /sbin/hwclock -w

Code: [Select]
sleep 3 ; ntpclient -s -h pool.ntp.org ; /sbin/hwclock -w

Both examples obtain the date and time is retrieved from an internet based server and used to set the BIOS date and time of the local PC.

The sleep command is used to ensure the network is available before attempting to get the date and time.  I would prefer to replace this with while...   but I don't know what to test for.  Can anyone suggest a valid while command?

At a future point I may wish to direct TC to a LAN based time server.  Is this possible using getTime.sh?

   

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11041
Re: ntpclient Blanks Screen
« Reply #14 on: February 17, 2010, 09:31:24 AM »
while ! ping -c1 google.com; do sleep 1; done

I think getTime.sh could be pointed to a local time server, but it would require a remaster. IIRC it also uses some other time protocol than ntp, not sure about that though.
The only barriers that can stop you are the ones you create yourself.