Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ntp-client does not start at boot.
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
LegionOfHell
Apprentice
Apprentice


Joined: 16 Mar 2019
Posts: 166
Location: Toronto, Canada

PostPosted: Fri Sep 27, 2019 10:56 pm    Post subject: ntp-client does not start at boot. Reply with quote

What I did:

emerge --ask net-misc/ntp

rc-service ntp-client start

rc-update add ntp-client default

but when I boot i get :

* Setting clock via NTP client 'ntpdate' ...

Exiting, name server cannot be used: Temporary failure in name resolution (-3) * Failed to set clock

* ERROR: ntp-client failed to start

and when i run ;

rc-service ntp-client status

it says that it is stopped...

manually starting ntp-client works...
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7602
Location: Goose Creek SC

PostPosted: Sat Sep 28, 2019 12:51 am    Post subject: Reply with quote

emerge --ask net-misc/ntp
rc-update add ntpd default
reboot
Need a network connection (net), a Domain name service (dns), and a log service (logger) for ntp-client to work. The error message says dns is missing at the time ntp-client is called to start during init's default run level.
Does /etc/resolv.conf have a valid nameserver line?
_________________
Defund the FCC.
Back to top
View user's profile Send private message
LegionOfHell
Apprentice
Apprentice


Joined: 16 Mar 2019
Posts: 166
Location: Toronto, Canada

PostPosted: Sat Sep 28, 2019 2:47 am    Post subject: Reply with quote

removed ntp-client and added ntpd to default runlevel....things are working now(I get no errors) ..

How do I disable the server in ntpd and use only the client ?
Back to top
View user's profile Send private message
freke
Guru
Guru


Joined: 23 Jan 2003
Posts: 588
Location: Somewhere in Denmark

PostPosted: Sat Sep 28, 2019 4:25 pm    Post subject: Reply with quote

ntp-client is the client - ntpd is the server - no?

is
Code:
rc_use="dns"
enabled in /etc/conf.d/ntp-client?

The client is able to recover from BIG offsets - while the server bails out on starting if the offset is too big (afaik/iirc).
Back to top
View user's profile Send private message
LegionOfHell
Apprentice
Apprentice


Joined: 16 Mar 2019
Posts: 166
Location: Toronto, Canada

PostPosted: Sat Sep 28, 2019 5:31 pm    Post subject: Reply with quote

rc_use="dns" is enabled ...

ntpd is both a server and a client too...correct ?
Back to top
View user's profile Send private message
stoffepojken
n00b
n00b


Joined: 11 Jun 2006
Posts: 26
Location: Stockholm, Sweden

PostPosted: Sat Sep 28, 2019 5:48 pm    Post subject: Reply with quote

LegionOfHell wrote:
rc_use="dns" is enabled ...

ntpd is both a server and a client too...correct ?


ntpd only listens on localhost by default
Back to top
View user's profile Send private message
LegionOfHell
Apprentice
Apprentice


Joined: 16 Mar 2019
Posts: 166
Location: Toronto, Canada

PostPosted: Sat Sep 28, 2019 5:52 pm    Post subject: Reply with quote

This is how my /etc/resolv.conf looks like :

++++++++++++++
domain home
nameserver 192.168.2.1
nameserver 207.164.234.129
++++++++++++++
Back to top
View user's profile Send private message
LegionOfHell
Apprentice
Apprentice


Joined: 16 Mar 2019
Posts: 166
Location: Toronto, Canada

PostPosted: Sat Sep 28, 2019 5:55 pm    Post subject: Reply with quote

here is the line from Gentoo Wiki:

"The server is both a client, and server. If the setup can not access net early in init, use server only instead."

https://wiki.gentoo.org/wiki/Ntp#Server_2


Last edited by LegionOfHell on Sat Sep 28, 2019 6:01 pm; edited 1 time in total
Back to top
View user's profile Send private message
stoffepojken
n00b
n00b


Joined: 11 Jun 2006
Posts: 26
Location: Stockholm, Sweden

PostPosted: Sat Sep 28, 2019 5:56 pm    Post subject: Reply with quote

LegionOfHell wrote:
LegionOfHell wrote:
rc_use="dns" is enabled ...

ntpd is both a server and a client too...correct ?


here is the line from Gentoo Wiki:

"The server is both a client, and server. If the setup can not access net early in init, use server only instead."

https://wiki.gentoo.org/wiki/Ntp#Server_2


Do you use Networkmanager?
Back to top
View user's profile Send private message
LegionOfHell
Apprentice
Apprentice


Joined: 16 Mar 2019
Posts: 166
Location: Toronto, Canada

PostPosted: Sat Sep 28, 2019 6:02 pm    Post subject: Reply with quote

dhcpcd+wpa_supplicant
Back to top
View user's profile Send private message
stoffepojken
n00b
n00b


Joined: 11 Jun 2006
Posts: 26
Location: Stockholm, Sweden

PostPosted: Sat Sep 28, 2019 6:04 pm    Post subject: Reply with quote

Enable only localhost in /etc/ntp.conf and you have no server
Back to top
View user's profile Send private message
LegionOfHell
Apprentice
Apprentice


Joined: 16 Mar 2019
Posts: 166
Location: Toronto, Canada

PostPosted: Sat Sep 28, 2019 7:25 pm    Post subject: Reply with quote

Here is the restrict lines in my /etc/ntp.conf :

restrict default kod nomodify notrap nopeer noquery
restrict 127.0.0.1

how do I disable localhost too ? so that there are no listening ports ?
Back to top
View user's profile Send private message
stoffepojken
n00b
n00b


Joined: 11 Jun 2006
Posts: 26
Location: Stockholm, Sweden

PostPosted: Sat Sep 28, 2019 7:35 pm    Post subject: Reply with quote

LegionOfHell wrote:
Here is the restrict lines in my /etc/ntp.conf :

restrict default kod nomodify notrap nopeer noquery
restrict 127.0.0.1

how do I disable localhost too ? so that there are no listening ports ?


disable ntpd and use ntpdate as cron job may work
Back to top
View user's profile Send private message
Juippisi
Developer
Developer


Joined: 30 Sep 2005
Posts: 454
Location: /home

PostPosted: Sun Sep 29, 2019 1:15 pm    Post subject: Reply with quote

Getting npt-client to sync on boot was always behind a hassle. Ever since I switched to chrony it always just worked.
Back to top
View user's profile Send private message
LegionOfHell
Apprentice
Apprentice


Joined: 16 Mar 2019
Posts: 166
Location: Toronto, Canada

PostPosted: Sun Sep 29, 2019 1:49 pm    Post subject: Reply with quote

I guess chronyd also produces some listening ports just like ntpd ? or is it different ?
Back to top
View user's profile Send private message
madurani
n00b
n00b


Joined: 08 Mar 2017
Posts: 49

PostPosted: Fri Oct 04, 2019 11:16 am    Post subject: Reply with quote

I had same problem and solution for me was small change in /etc/init.d/ntp-client

To section start I added sleep 10:

Code:

start() {
        checkconfig || return $?
        sleep 10
        ebegin "Setting clock via the NTP client '${NTPCLIENT_CMD}'"
        "${NTPCLIENT_CMD}" ${NTPCLIENT_OPTS}
        eend $? "Failed to set clock"
Back to top
View user's profile Send private message
bunder
Bodhisattva
Bodhisattva


Joined: 10 Apr 2004
Posts: 5910

PostPosted: Fri Oct 04, 2019 11:39 am    Post subject: Reply with quote

LegionOfHell wrote:
How do I disable the server in ntpd and use only the client ?


if you are using /etc/conf.d/net.* (netifrc) instead of /etc/init.d/dhcpcd, you might want to edit /etc/dhcpcd.conf and enable "option ntp_servers"... then edit ntp.conf, comment out the server lines, leave the rest as-is. restart net.* and ntpd, and if all is well, you should see only one line in "ntpq -p".

cheers
_________________
Neddyseagoon wrote:
The problem with leaving is that you can only do it once and it reduces your influence.

banned from #gentoo since sept 2017
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