Affected versions: Debian 12

πŸ“– ~1 min read

Table of contents
  1. Symptom & Impact
  2. Environment & Reproduction
  3. Root Cause Analysis
  4. Quick Triage
  5. Step-by-Step Diagnosis
  6. Solution – Primary Fix
  7. Solution – Alternative Approaches
  8. Verification & Acceptance Criteria
  9. Rollback Plan
  10. Prevention & Hardening
  11. Related Errors & Cross-Refs
  12. References & Further Reading

Symptom & Impact

Hostname resolution fails, breaking package updates and external API access.

Environment & Reproduction

Seen after VPN, DHCP, or resolver configuration changes.

resolvectl status
getent hosts deb.debian.org
cat /etc/resolv.conf

Root Cause Analysis

Invalid nameserver values, stale resolver symlinks, or per-link DNS conflicts.

Quick Triage

Check resolver target and active DNS servers.

ls -l /etc/resolv.conf
resolvectl dns
resolvectl query deb.debian.org

Step-by-Step Diagnosis

Inspect resolved logs and link DNS state.

journalctl -u systemd-resolved -n 120 --no-pager
networkctl status
grep -RIn "dns|resolve" /etc/systemd 2>/dev/null
Illustrative mockup for debian-12 β€” terminal_or_shell
Testing resolver status and queries β€” Illustrative mockup β€” Progressive Robot

Solution – Primary Fix

Set valid DNS servers, flush cache, and restart resolver.

Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.

sudo resolvectl dns eth0 1.1.1.1 8.8.8.8
sudo resolvectl flush-caches
sudo systemctl restart systemd-resolved
resolvectl query deb.debian.org
Illustrative mockup for debian-12 β€” log_or_config
Applying corrected DNS resolver settings β€” Illustrative mockup β€” Progressive Robot

Solution – Alternative Approaches

Define static DNS in resolved configuration for persistence.

sudoedit /etc/systemd/resolved.conf
sudo systemctl restart systemd-resolved
resolvectl status

Verification & Acceptance Criteria

DNS queries resolve and package metadata refresh completes.

getent hosts security.debian.org
resolvectl statistics
sudo apt update

Rollback Plan

Restore previous resolver file and restart service.

sudo cp -a /etc/systemd/resolved.conf /var/tmp/resolved.conf.bak.$(date +%s)
sudo systemctl restart systemd-resolved
resolvectl status

Prevention & Hardening

Define primary/fallback DNS and monitor resolver failures.

resolvectl status
journalctl -u systemd-resolved --since -1h --no-pager
cat /etc/resolv.conf

Often linked with default-route issues and outbound firewall restrictions.

Related tutorial: View the step-by-step tutorial for Debian 12.

View all Debian 12 tutorials on the Tutorials Hub β†’

Browse all common problems & solutions on the Tutorials Hub.

References & Further Reading

Debian systemd-resolved operations and troubleshooting guides.

Need Expert Help?

If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today β€” we respond within one business day.