Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ntp-client fails to run at boot (dns issue)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
danielittlewood
n00b
n00b


Joined: 13 Apr 2020
Posts: 60

PostPosted: Sun Oct 02, 2022 11:29 am    Post subject: ntp-client fails to run at boot (dns issue) Reply with quote

I am not sure how to actually find the logs that I get shown at boot time, but the message is roughly "could not run ntp-client - temporary failure in name resolution". I can see NetworkManager starting just before it, and the script /etc/ntp-client has dns in its dependencies:

depend() {
before cron portmap
after net
use dns logger
}

although I don't know in detail how the init.d scripts work, so maybe this is not the right configuration.

If I run ntp-client after startup, it works fine and sets the time up correctly. Is there anything I can do to fix this?
_________________
With man it is impossible, but with gcc all things are possible.
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3875

PostPosted: Sun Oct 02, 2022 11:43 am    Post subject: Reply with quote

Hi
What is the output of
Code:

ls -l /etc/resolv.conf
and
cat /etc/resolv.conf


You should enable ntp-client@default not @boot
But i suspect you are using systemd no?
Also try
Code:

systemctl disable systemd-resolved

_________________
:)
Back to top
View user's profile Send private message
danielittlewood
n00b
n00b


Joined: 13 Apr 2020
Posts: 60

PostPosted: Sun Oct 02, 2022 1:20 pm    Post subject: Reply with quote

alamahant wrote:
Hi
What is the output of
Code:

ls -l /etc/resolv.conf
and
cat /etc/resolv.conf



Hi! The results are

Code:
$ ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 31 Oct 23  2021 /etc/resolv.conf -> /run/NetworkManager/resolv.conf
$ cat /etc/resolv.conf
# Generated by openvpn for interface tun0
nameserver 10.0.0.243


which points to my VPN as a potential issue... I forgot to mention this :(
I have seen openvpn starting *after* ntp - I wonder if running it before will help?

alamahant wrote:

You should enable ntp-client@default not @boot
But i suspect you are using systemd no?
Also try
Code:

systemctl disable systemd-resolved


It is at default, sorry, bad word choice! I am running openrc. I can't see an equivalent service installed.
_________________
With man it is impossible, but with gcc all things are possible.
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3875

PostPosted: Sun Oct 02, 2022 1:24 pm    Post subject: Reply with quote

Quote:

I have seen openvpn starting *after* ntp - I wonder if running it before will help?


It should
_________________
:)
Back to top
View user's profile Send private message
danielittlewood
n00b
n00b


Joined: 13 Apr 2020
Posts: 60

PostPosted: Sun Oct 02, 2022 1:38 pm    Post subject: Reply with quote

That doesn't seem to have worked - I changed my ntp-client script to have
Code:
after net openvpn
and that seemed to do what it says - openvpn started after NetworkManager and before ntp-client. But it still failed with an error in name resolution.

It does complain that openvpn is inactive, but I don't think that means it shouldn't work. I get the same warning when I restart in userspace. I'll try to get the exact error messages saved to a file.
_________________
With man it is impossible, but with gcc all things are possible.
Back to top
View user's profile Send private message
danielittlewood
n00b
n00b


Joined: 13 Apr 2020
Posts: 60

PostPosted: Sun Oct 02, 2022 1:51 pm    Post subject: Reply with quote

Ok, here are the logs:

Code:
 * Starting NetworkManager ...
 [ ok ]
Connecting........           1sConnecting.........          1sConnecting..........
cting..............     1sConnecting...............    1sConnecting...............
 * Marking NetworkManager as inactive. It will automatically be marked
 * as started after a network connection has been established.
 * WARNING: NetworkManager has started, but is inactive
 * Starting acpid ...
 [ ok ]
 * WARNING: openvpn will start when NetworkManager has started
 * Setting clock via the NTP client 'ntpdate' ...
Exiting, name server cannot be used: Temporary failure in name resolution (-3) * Fail
 [ !! ]
 * ERROR: ntp-client failed to start


I'm going to try changing "after" to "need".
_________________
With man it is impossible, but with gcc all things are possible.
Back to top
View user's profile Send private message
danielittlewood
n00b
n00b


Joined: 13 Apr 2020
Posts: 60

PostPosted: Sun Oct 02, 2022 1:55 pm    Post subject: Reply with quote

That fixed it, but made my boot time substantially longer. Fixed, I guess?

Code:
 * local: waiting for ntp-client (50 seconds)
 * Starting local ...
 [ ok ]

_________________
With man it is impossible, but with gcc all things are possible.
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3875

PostPosted: Sun Oct 02, 2022 2:36 pm    Post subject: Reply with quote

Maybe disable openvpn and only let NM handle the vpn connection.
Are you trying to connect to a vpn server?
_________________
:)
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4008
Location: Bavaria

PostPosted: Sun Oct 02, 2022 3:42 pm    Post subject: Reply with quote

danielittlewood wrote:
That fixed it, but made my boot time substantially longer. Fixed, I guess?

If you dont want this longer boot there is another chance: You can set an IP address instead a name for ntp-client (like I also do). Example from mine (its a german ntp server):
Code:
/etc/conf.d $ more ntp-client
# /etc/conf.d/ntp-client

# Command to run to set the clock initially
# Most people should just leave this line alone ...
# however, if you know what you're doing, and you
# want to use ntpd to set the clock, change this to 'ntpd'
NTPCLIENT_CMD="ntpdate"

# Options to pass to the above command
# This default setting should work fine but you should
# change the default 'pool.ntp.org' to something closer
# to your machine.  See http://www.pool.ntp.org/ or
# try running `netselect -s 3 pool.ntp.org`.
NTPCLIENT_OPTS="-s -b -u 192.53.103.104"

# If you use hostnames above, then you should depend on dns
# being up & running before we try to run.  Otherwise, you
# can disable this.
# rc_use="dns"
Back to top
View user's profile Send private message
figueroa
Advocate
Advocate


Joined: 14 Aug 2005
Posts: 2913
Location: Edge of marsh USA

PostPosted: Mon Oct 03, 2022 3:29 am    Post subject: Reply with quote

EDITED and ADDED: I blew it. The logs shown below are from my desktop machine that syncs from my server without name resolution. I think on my server I've got lousy ntp servers in /etc/conf.d/ntp-client. I assumed that the gentoo defaults would work. Now I've got to experiment. I'll leave the entire post in case portions of it may be helpful. Otherwise, ,with regrets. If I discover anything, I'll post about it.

Are you sure it fails to start? I see the same error on-screen during startup, but it starts anyway. I can see that it started in both rc.log and the boot log.

Here is a segement from /var/log/rc.log-20220925.gz
Code:
*   Adding routes
*     default via 192.168.0.1 ...
 [ ok ]
 [ ok ]
 * Setting clock via the NTP client 'ntpdate' ...
 [ ok ]
 * Starting rpcbind ...
 [ ok ]
 * Starting NFS statd ...
 [ ok ]
 * Setting up RPC pipefs ...
 [ ok ]
 * Starting idmapd ...
 [ ok ]
 * Starting NFS sm-notify ...
 [ ok ]
 * Mounting network filesystems ...
 [ ok ]
 * Starting gpm ...
 [ ok ]
 * Setting up lightdm ...
 [ ok ]
 * Restoring Mixer Levels ...
 [ ok ]
 * Starting apcupsd ...
 [ ok ]
 * Starting cronie ...
 [ ok ]
 * Starting cupsd ...
 [ ok ]
OK: configuration test is successful
 * Starting fail2ban ...
Server ready
 [ ok ]
 * Initializing sensors ...
 [ ok ]
 * Starting ntpd ...
 [ ok ]


and in, /var/log/boot-20220925.gz which shows date-time and a six second delay at 12:07:04, but no error:
Code:
Fri Sep 23 12:07:04 2022:  *   Adding routes
Fri Sep 23 12:07:04 2022:  *     default via 192.168.0.1 ...
Fri Sep 23 12:07:04 2022:  [ ok ]
Fri Sep 23 12:07:04 2022:  [ ok ]
Fri Sep 23 12:07:04 2022:  * Setting clock via the NTP client 'ntpdate' ...
Fri Sep 23 12:07:10 2022:  [ ok ]
Fri Sep 23 12:07:10 2022:  * Starting rpcbind ...
Fri Sep 23 12:07:10 2022:  [ ok ]
Fri Sep 23 12:07:10 2022:  * Starting NFS statd ...
Fri Sep 23 12:07:11 2022:  [ ok ]
Fri Sep 23 12:07:11 2022:  * Setting up RPC pipefs ...
Fri Sep 23 12:07:11 2022:  [ ok ]
Fri Sep 23 12:07:11 2022:  * Starting idmapd ...
Fri Sep 23 12:07:11 2022:  [ ok ]
Fri Sep 23 12:07:11 2022:  * Starting NFS sm-notify ...
Fri Sep 23 12:07:11 2022:  [ ok ]
Fri Sep 23 12:07:11 2022:  * Mounting network filesystems ...
Fri Sep 23 12:07:11 2022:  [ ok ]
Fri Sep 23 12:07:11 2022:  * Starting gpm ...
Fri Sep 23 12:07:11 2022:  [ ok ]
Fri Sep 23 12:07:11 2022:  * Setting up lightdm ...
Fri Sep 23 12:07:11 2022:  [ ok ]
Fri Sep 23 12:07:12 2022:  * Restoring Mixer Levels ...
Fri Sep 23 12:07:12 2022:  [ ok ]
Fri Sep 23 12:07:12 2022:  * Starting apcupsd ...
Fri Sep 23 12:07:13 2022:  [ ok ]
Fri Sep 23 12:07:13 2022:  * Starting cronie ...
Fri Sep 23 12:07:13 2022:  [ ok ]
Fri Sep 23 12:07:13 2022:  * Starting cupsd ...
Fri Sep 23 12:07:13 2022:  [ ok ]
Fri Sep 23 12:07:17 2022: OK: configuration test is successful
Fri Sep 23 12:07:17 2022:  * Starting fail2ban ...
Fri Sep 23 12:07:21 2022: Server ready
Fri Sep 23 12:07:21 2022:  [ ok ]
Fri Sep 23 12:07:21 2022:  * Initializing sensors ...
Fri Sep 23 12:07:21 2022:  [ ok ]
Fri Sep 23 12:07:21 2022:  * Starting ntpd ...
Fri Sep 23 12:07:21 2022:  [ ok ]
Fri Sep 23 12:07:21 2022:  * Enabling numlock on ttys ...
Fri Sep 23 12:07:22 2022:  [ ok ]

_________________
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/17.1/desktop (stable), OpenRC, -systemd -pulseaudio -uefi
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security 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