Files
omarchy/migrations/1755109182.sh
Jarek 59c70fdd46 Fix DNS migration to handle UseDNS=no in network files (#1314)
* Fix DNS migration to handle UseDNS=no in network files

Issue #1246: Migration 1755109182.sh only fixes resolved.conf but doesn't
remove UseDNS=no from network files. When UseDNS=no persists, it blocks
DHCP DNS and forces fallback to Cloudflare after reboot.

Fix: Remove UseDNS=no from all network files, matching omarchy-setup-dns DHCP behavior.

* Add new migration 1756491748.sh for existing users

Fixes DNS issue for users who already ran migration 1755109182.sh.
Removes UseDNS=no from network files to enable DHCP DNS.

* Apply requested changes

- Revert 1755109182.sh to original state
- Consolidate all fixes in new migration 1756491748.sh
- Follow migration style guidelines
2025-08-30 09:41:14 +02:00

31 lines
1.3 KiB
Bash
Executable File

echo "Reset DNS configuration to DHCP (remove forced Cloudflare DNS)"
# Reset DNS to use DHCP by default instead of forcing Cloudflare
# This preserves local development environments (.local domains, etc.)
# Users can still opt-in to Cloudflare DNS using: omarchy-setup-dns cloudflare
if [ -f /etc/systemd/resolved.conf ]; then
# Backup current config with timestamp
backup_timestamp=$(date +"%Y%m%d%H%M%S")
sudo cp /etc/systemd/resolved.conf "/etc/systemd/resolved.conf.bak.${backup_timestamp}"
# Remove explicit DNS entries to use DHCP
sudo sed -i '/^DNS=/d' /etc/systemd/resolved.conf
sudo sed -i '/^FallbackDNS=/d' /etc/systemd/resolved.conf
# Add empty DNS entries to ensure DHCP is used
echo "DNS=" | sudo tee -a /etc/systemd/resolved.conf >/dev/null
echo "FallbackDNS=" | sudo tee -a /etc/systemd/resolved.conf >/dev/null
# Remove any forced DNS config from systemd-networkd
if [ -f /etc/systemd/network/99-omarchy-dns.network ]; then
sudo rm -f /etc/systemd/network/99-omarchy-dns.network
sudo systemctl restart systemd-networkd
fi
# Restart systemd-resolved to apply changes
sudo systemctl restart systemd-resolved
echo "DNS configuration reset to use DHCP (router DNS)"
echo "To use Cloudflare DNS, run: omarchy-setup-dns Cloudflare"
fi