---
title: "Discussion on \"Diagnose Linux DNS Failures With getent, resolvectl and dig\" | Hashnode"
description: "Discussion on \"Diagnose Linux DNS Failures With getent, resolvectl and dig\". A Linux system can have a working network connection and still fail to reach a website by name. An application may report that a host cannot be resolved, a package manager may fail to contact a reposi"
url: "https://hashnode.com/posts/diagnose-linux-dns-failures-with-getent-resolvectl-and-dig/6aec31c4ee78ba2d608fec62"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Diagnose Linux DNS Failures With getent, resolvectl and dig](https://tech-learning-sachin.hashnode.dev/diagnose-linux-dns-failures-with-getent-resolvectl-and-dig?utm_source=hashnode&utm_medium=feed)

A Linux system can have a working network connection and still fail to reach a website by name. An application may report that a host cannot be resolved, a package manager may fail to contact a reposi

Nov 5 · 10 min read · tech-learning-sachin.hashnode.dev  
Read the article

-   [#linux](https://hashnode.com/tag/linux)

## Written by

[Uk K](https://hashnode.com/@sachintech)

@sachintech · Delhi, India

  
[View profile](https://hashnode.com/@sachintech)

## Responses 1

Markdown supported · ⌘↵ to post

[c-wind](https://hashnode.com/@c-wind)

[Nov 5](https://hashnode.com/posts/diagnose-linux-dns-failures-with-getent-resolvectl-and-dig/6aec31c4ee78ba2d608fec62/comment/6aec8413469ac3c4a91eb615)

Two mismatches that look like a dead resolver but are the lookup path.

`dig fileserver` does not apply the search list. getent and glibc do, so a short name can resolve in the application and in `getent hosts` while a plain `dig` of the same string returns NXDOMAIN. `dig +search fileserver` is the query that matches what the system actually tried. The short-name versus FQDN section is the right idea; dig's default is the part that hides it.

The other one is the action on the hosts line. A typical resolved setup is `hosts: files resolve [!UNAVAIL=return] dns`. That bracket means "keep going only if resolved is down." An NXDOMAIN from the stub is a finished answer, so the trailing `dns` module never runs. Adding `dns` at the end is not a fallback for names the stub refuses. It only helps when systemd-resolved itself is unavailable. If getent fails and `dig @` the server from the real resolv.conf works, check that action before replacing resolv.conf.
