Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
getting the system time right
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
mbouchard
n00b
n00b


Joined: 07 Sep 2019
Posts: 8

PostPosted: Tue Sep 10, 2019 9:12 pm    Post subject: getting the system time right Reply with quote

This is my first time installing gentoo, after years of using ubuntu almost exclusively.

I followed the manual (and Xfce install article) pretty closely for a uefi boot on a Dell Latitude E6230, with a 1TB internal SSD
So I'm installing the cryptocurrency wallets I use, and , starting with geth (ethereum sync daemon) and it tells me my system clock is off by 4 hours. When i installed, I used the timezone America/Detroit in /etc/timezone, which is 4 hours off from utc... I've done a bunch of stuff trying to fix it including ntp command.

I ended up deleting America/Detroit out of /etc/timezone just for ease of use, and I have my Xfce displaying the proper UTC time. When i run command date in bash, i get the proper utc time (on a 12-hour scale, but the right time nonetheless.) but geth and monerod are both displaying the wrong time! (UTC+4hours) they need the proper timestamps to sync the blockchains correctly, and they aren't getting it. I havent been able to figure this one out, so some help would be GREATLY appreciated.
Back to top
View user's profile Send private message
Prof. Frink
Apprentice
Apprentice


Joined: 07 Jan 2017
Posts: 176

PostPosted: Tue Sep 10, 2019 9:49 pm    Post subject: Reply with quote

Code:
# NOTES:
# DHCP clients can append or replace NTP configuration files.
# You should consult your DHCP client documentation about its
# default behaviour and how to change it.

# Name of the servers ntpd should sync with
# Please respect the access policy as stated by the responsible person.
#server      ntp.example.tld      iburst

# Common pool for random people
#server pool.ntp.org

# Pools for Gentoo users
server 0.gentoo.pool.ntp.org
server 1.gentoo.pool.ntp.org
server 2.gentoo.pool.ntp.org
server 3.gentoo.pool.ntp.org

##
# A list of available servers can be found here:
# http://www.pool.ntp.org/
# http://www.pool.ntp.org/#use
# A good way to get servers for your machine is:
# netselect -s 3 pool.ntp.org
##

# you should not need to modify the following paths
driftfile   /var/lib/ntp/ntp.drift

#server ntplocal.example.com prefer
#server timeserver.example.org

# Warning: Using default NTP settings will leave your NTP
# server accessible to all hosts on the Internet.

# If you want to deny all machines (including your own)
# from accessing the NTP server, uncomment:
#restrict default ignore


# Default configuration:
# - Allow only time queries, at a limited rate, sending KoD when in excess.
# - Allow all local queries (IPv4, IPv6)
restrict default nomodify nopeer noquery limited kod
restrict 127.0.0.1
restrict [::1]


# To allow machines within your network to synchronize
# their clocks with your server, but ensure they are
# not allowed to configure the server or used as peers
# to synchronize against, uncomment this line.
#
#restrict 192.168.0.0 mask 255.255.255.0 nomodify nopeer notrap


This is from /etc/ntp.conf . And this file is from net-misc/ntp-4.2.8_p13
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 3247
Location: Illinois, USA

PostPosted: Tue Sep 10, 2019 9:52 pm    Post subject: Reply with quote

Windows does not use UTC time. If you dual-boot you should set local time instead of UTC. This is in the manual somewhere.
I have found that if you have Windows anywhere on your LAN and you use SAMBA, set all computers, including pure Linux computers to "local time".

/etc/conf.d/hwclock
Back to top
View user's profile Send private message
mbouchard
n00b
n00b


Joined: 07 Sep 2019
Posts: 8

PostPosted: Tue Sep 10, 2019 10:05 pm    Post subject: Reply with quote

Code:
# NOTES:
# DHCP clients can append or replace NTP configuration files.
# You should consult your DHCP client documentation about its
# default behaviour and how to change it.

# Name of the servers ntpd should sync with
# Please respect the access policy as stated by the responsible person.
#server      ntp.example.tld      iburst

# Common pool for random people
server pool.ntp.org

# Pools for Gentoo users
server 0.gentoo.pool.ntp.org
server 1.gentoo.pool.ntp.org
server 2.gentoo.pool.ntp.org
server 3.gentoo.pool.ntp.org

##
# A list of available servers can be found here:
# http://www.pool.ntp.org/
# http://www.pool.ntp.org/#use
# A good way to get servers for your machine is:
# netselect -s 3 pool.ntp.org
##

# you should not need to modify the following paths
driftfile   /var/lib/ntp/ntp.drift

#server ntplocal.example.com prefer
#server timeserver.example.org

# Warning: Using default NTP settings will leave your NTP
# server accessible to all hosts on the Internet.

# If you want to deny all machines (including your own)
# from accessing the NTP server, uncomment:
#restrict default ignore


# Default configuration:
# - Allow only time queries, at a limited rate, sending KoD when in excess.
# - Allow all local queries (IPv4, IPv6)
restrict default nomodify nopeer noquery limited kod
restrict 127.0.0.1
restrict [::1]


# To allow machines within your network to synchronize
# their clocks with your server, but ensure they are
# not allowed to configure the server or used as peers
# to synchronize against, uncomment this line.
#
#restrict 192.168.0.0 mask 255.255.255.0 nomodify nopeer notrap


mine looks just like that. but i still get an error from geth:

Code:
WARN [09-10|22:03:34.472] System clock seems off by 4h0m0.708178564s, which can prevent network connectivity
Back to top
View user's profile Send private message
Prof. Frink
Apprentice
Apprentice


Joined: 07 Jan 2017
Posts: 176

PostPosted: Tue Sep 10, 2019 10:06 pm    Post subject: Reply with quote

Code:

service ntp stop
ntpd -q -g -x -n
service ntp start
Back to top
View user's profile Send private message
Prof. Frink
Apprentice
Apprentice


Joined: 07 Jan 2017
Posts: 176

PostPosted: Tue Sep 10, 2019 10:08 pm    Post subject: Reply with quote

I mean

Code:

/etc/init.d/ntpd stop
ntpd -q -g -x -n
/etc/init.d/ntpd  start
Back to top
View user's profile Send private message
mbouchard
n00b
n00b


Joined: 07 Sep 2019
Posts: 8

PostPosted: Tue Sep 10, 2019 10:11 pm    Post subject: Reply with quote

Tony0945 wrote:
If you dual-boot you should set local time instead of UTC. This is in the manual somewhere.
I have found that if you have Windows anywhere on your LAN and you use SAMBA, set all computers, including pure Linux computers to "local time".

/etc/conf.d/hwclock


I am not dual booting but this is my /etc/conf.d/hwclock:
Code:
# Set CLOCK to "UTC" if your Hardware Clock is set to UTC (also known as
# Greenwich Mean Time).  If that clock is set to the local time, then
# set CLOCK to "local".  Note that if you dual boot with Windows, then
# you should set it to "local".
clock="local"

# If you want the hwclock script to set the system time (software clock)
# to match the current hardware clock during bootup, leave this
# commented out.
# However, you can set this to "NO" if you are running a modern kernel
# and using NTP to synchronize your system clock.
#clock_hctosys="YES"

# If you do not want to set the hardware clock to the current system
# time (software clock) during shutdown, set this to no.
#clock_systohc="YES"

# If you wish to pass any other arguments to hwclock during bootup,
# you may do so here. Alpha users may wish to use --arc or --srm here.
clock_args=""

i tried setting clock="UTC" but geth is returning the same error.
The monero daemon also displays the wrong time.
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 3247
Location: Illinois, USA

PostPosted: Tue Sep 10, 2019 10:15 pm    Post subject: Reply with quote

I got errors like "file creation time is in the future". Everything on the LAN needs to be the same. If you have no Windows anywhere, you can set UTC.

EDIT:
Unless you are in the UK, then both times are the same.
Back to top
View user's profile Send private message
mbouchard
n00b
n00b


Joined: 07 Sep 2019
Posts: 8

PostPosted: Tue Sep 10, 2019 10:36 pm    Post subject: Reply with quote

Prof. Frink wrote:

Code:

/etc/init.d/ntpd stop
ntpd -q -g -x -n
/etc/init.d/ntpd  start

seems to have worked, thank you.
My system is now showing the proper local time and my crypto nodes are not giving me the time error.
Just out of curiosity, though: how does my system know im in the eastern timezone if my /etc/timezone file is empty?
Back to top
View user's profile Send private message
Prof. Frink
Apprentice
Apprentice


Joined: 07 Jan 2017
Posts: 176

PostPosted: Tue Sep 10, 2019 10:59 pm    Post subject: Reply with quote

mbouchard wrote:

seems to have worked, thank you.


Nice. :D
mbouchard wrote:
how does my system know im in the eastern timezone if my /etc/timezone file is empty?


I don't know.
Back to top
View user's profile Send private message
Fitzcarraldo
Veteran
Veteran


Joined: 30 Aug 2008
Posts: 1769
Location: United Kingdom

PostPosted: Tue Sep 10, 2019 11:25 pm    Post subject: Reply with quote

Tony0945 wrote:
I got errors like "file creation time is in the future". Everything on the LAN needs to be the same. If you have no Windows anywhere, you can set UTC.

EDIT:
Unless you are in the UK, then both times are the same.

Not quite correct, Tony. During the summer (Daylight Saving Time), the time in the UK is BST (British Summer Time) which is UTC+1. So, right now as I type this:

Code:
$ date
Wed 11 Sep 00:25:09 BST 2019


During the winter, the time in the UK is GMT (Greenwich Mean Time), which is UTC+0:

https://www.timeanddate.com/time/zones/bst

https://www.timeanddate.com/time/zones/gmt

Quote:
Where and When is GMT Observed?

Europe
European countries/territories using GMT all year:

- Greenland (Danmarkshavn)
- Iceland

European countries/territories using GMT in the winter and IST (Irish Standard Time, a.k.a. Irish Summer Time) or BST (British Summer Time) in the summer:

- Guernsey
- Ireland
- Isle of Man
- Jersey
- United Kingdom - main islands

Africa
[...]


Some other time zones are also UTC+0 but not GMT. To give just one example, the time in Portugal now is the same as in the UK, but the Portuguese time is WEST (Western European Summer Time) (UTC+1) in the summer (Daylight Saving Time) and WET (Western European Time) (UTC+0) in winter.
_________________
Clevo W230SS: amd64 nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64 xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC eudev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 3247
Location: Illinois, USA

PostPosted: Tue Sep 10, 2019 11:38 pm    Post subject: Reply with quote

Thank you, Fitzcarraldo. We live and learn!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum