{"id":5332,"date":"2018-08-09T19:25:53","date_gmt":"2018-08-09T19:25:53","guid":{"rendered":"https:\/\/really.zonky.org\/?p=5332"},"modified":"2018-08-09T19:25:58","modified_gmt":"2018-08-09T19:25:58","slug":"ntpd-not-resolving","status":"publish","type":"post","link":"https:\/\/really.zonky.org\/?p=5332","title":{"rendered":"NTPD Not Resolving"},"content":{"rendered":"\n<p>Well that was a weird error; I recently discovered that\u00a0<em>ntpd<\/em> had mysteriously stopped working; specifically it was not able to resolve NTP &#8220;pool&#8221; names :-<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ntpd: error resolving pool europe.pool.ntp.org: Name or service not known (-2)<\/code><\/pre>\n\n\n\n<p>After some time spent blundering around down dead ends with the help of an appropriate search engine, I ended up resorting to\u00a0<em>strace<\/em>. This is a tool most commonly used by developers but can be surprisingly useful for diagnosing system problems too.<\/p>\n\n\n\n<p>As long as you can look past all the inscrutable output!<\/p>\n\n\n\n<p>The\u00a0<em>strace<\/em> tool runs a command and records every system call that the command calls together with the results. And of course most commands make zillions of system calls so you&#8217;re likely to end up with a huge output file.<\/p>\n\n\n\n<p>To generate the output file, I ran the modern equivalent of\u00a0<em>ntpdate<\/em> (<em>ntpd -d<\/em>) which tries to do the same thing using the actual NTP daemon. Usefully in this case because the command starts, configures itself (which is where the error occurs), and then exits (unlike the normal d\u00e6mon). It is important to redirect the output to have a file to trawl through later :-<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>strace ntpd -d > \/var\/tmp\/ntpd.strace 2>&amp;1<\/code><\/pre>\n\n\n\n<p>Once the output was generated, it was necessary to trawl through it to look for clues. The first thing was to search for &#8220;europe&#8221; (as I use\u00a0<em>europe.pool.ntp.org<\/em> as one of my NTP servers). The first occurrence was the error claiming that the name didn&#8217;t exist :-<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>write(2, \"error resolving pool europe.pool\"..., 73error resolving pool europe.pool.ntp.org: Name or service not known (-2)<\/code><\/pre>\n\n\n\n<p>Which was somewhat odd because you would expect the string &#8220;europe&#8221; to occur within an instructable attempt resolve the name. Yet it appears as though the error occurs\u00a0<em>without<\/em> any attempt to resolve the name!<\/p>\n\n\n\n<p>As a bit of a guess I searched for &#8220;resolv.conf&#8221; which revealed :-<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>stat(\"\/etc\/resolv.conf\", {st_mode=S_IFREG|0644, st_size=362, ...}) = 0\nopenat(AT_FDCWD, \"\/etc\/resolv.conf\", O_RDONLY|O_CLOEXEC) = -1 EACCES (Permission denied)<\/code><\/pre>\n\n\n\n<p>Apparently\u00a0<em>ntpd<\/em> is unable to open the file due to a permissions problem!<\/p>\n\n\n\n<p>Looking at my\u00a0<em>\/etc\/resolv.conf<\/em> revealed an oddity dating back to when I tried configuring\u00a0<em>\/etc\/resolv.conf<\/em> as a symbolic link to a file on a separate file system. The file itself was a symbolic link to\u00a0<em>\/etc\/resolv.conf.file<\/em>.<\/p>\n\n\n\n<p>For some reason\u00a0<em>ntpd<\/em> didn&#8217;t like the symbolic link, which is a bit odd but changing it to an ordinary file fixed the problem.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"695\" height=\"463\" src=\"https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/solidus.jpeg?resize=695%2C463&#038;ssl=1\" alt=\"\" class=\"wp-image-4289\" srcset=\"https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/solidus.jpeg?w=792&amp;ssl=1 792w, https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/solidus.jpeg?resize=300%2C200&amp;ssl=1 300w, https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/solidus.jpeg?resize=768%2C512&amp;ssl=1 768w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Well that was a weird error; I recently discovered that\u00a0ntpd had mysteriously stopped working; specifically it was not able to resolve NTP &#8220;pool&#8221; names :- After some time spent blundering around down dead ends with the help of an appropriate search engine, I ended up resorting to\u00a0strace. This is a tool most commonly used by <a href='https:\/\/really.zonky.org\/?p=5332' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_share_on_mastodon":"0"},"categories":[4,209,226],"tags":[1038,1780,1782,1781],"class_list":["post-5332","post","type-post","status-publish","format-standard","hentry","category-it","category-linux-it","category-working-notes","tag-ntp","tag-ntpd","tag-resolv-conf","tag-strace","category-4-id","category-209-id","category-226-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1f2KI-1o0","_links":{"self":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/5332","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5332"}],"version-history":[{"count":1,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/5332\/revisions"}],"predecessor-version":[{"id":5333,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/5332\/revisions\/5333"}],"wp:attachment":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5332"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5332"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5332"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}