System with DNS server in /etc/network/interfaces has bogus systemd-resolved config after upgrade to 22.04
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ifupdown (Ubuntu) |
Fix Released
|
Medium
|
Heitor Alves de Siqueira | ||
Focal |
Fix Released
|
Low
|
Heitor Alves de Siqueira | ||
Jammy |
In Progress
|
Low
|
Heitor Alves de Siqueira | ||
Lunar |
In Progress
|
Low
|
Heitor Alves de Siqueira |
Bug Description
[ Impact ]
ifupdown configurations will stop having a working DNS server on upgrade
[ Test Plan ]
Upgrading from an Ubuntu 18.04 or earlier release, bounce a network interface with configured DNS server:
root@pangaea-pm:~# ifdown ens13; ifup ens13
/etc/network/
/etc/network/
/etc/network/
/etc/network/
/etc/network/
Failed to parse DNS server address: DNS
Failed to set DNS configuration: Invalid argument
This should result in no errors, and in a valid network configuration with working DNS resolution.
It's likely that existing netplan configuration needs to be removed and migrated to classic ifupdown scripts before running the test above.
[ Where problems could occur ]
Although we're only fixing the resolved scripts, more complex network setups might see regressions in DNS resolution for some cases. We should pay special attention to bridges or virtual interfaces that have been configured through ifupdown, as well as validate the other scripts under /etc/network/
[ Other Info ]
Description: Ubuntu 22.04 LTS
Release: 22.04
ifupdown:
Installed: 0.8.36+nmu1ubuntu3
Candidate: 0.8.36+nmu1ubuntu3
Version table:
*** 0.8.36+nmu1ubuntu3 500
500 http://
100 /var/lib/
After upgrading a server with classic ifupdown configuration after reboot the machine had no valid dns servers anymore.
The problem is that the state file created by ifupdown using /etc/network/
root@pangaea-pm:~# cat /run/network/
"DNS"="
"DOMAINS"
The script later sources this file and causes the following errors, easy to see when you execute this:
root@pangaea-pm:~# ifdown ens13; ifup ens13
/etc/network/
/etc/network/
/etc/network/
/etc/network/
/etc/network/
Failed to parse DNS server address: DNS
Failed to set DNS configuration: Invalid argument
This happened to me on three different servers, so this is a serious bug and should be fixed before 22.04 upgrades are allowed for everybody. Most servers provided by data centers like Hetzner (Germany) are configure like that. After a do-release-upgrade you have no working DNS anymore, unless you disable systemd-resolved. I don't want to use netplan, so changing to this is no option.
The fix is easy - remove the quotes in the script on the left side "$DNS" => $DNS; same for DOMAINS:
if [ -n "$NEW_DNS" ]; then
cat <<EOF >"$mystatedir/
$DNS="$NEW_DNS"
EOF
if [ -n "$NEW_DOMAINS" ]; then
cat <<EOF >>"$mystatedir/
$DOMAINS=
EOF
fi
fi
tags: | added: foundations-triage-discuss |
Changed in ifupdown (Ubuntu): | |
status: | Confirmed → Triaged |
importance: | Undecided → Medium |
Changed in ifupdown (Ubuntu): | |
assignee: | nobody → Heitor Alves de Siqueira (halves) |
status: | Triaged → In Progress |
description: | updated |
Changed in ifupdown (Ubuntu Focal): | |
assignee: | nobody → Heitor Alves de Siqueira (halves) |
Changed in ifupdown (Ubuntu Jammy): | |
assignee: | nobody → Heitor Alves de Siqueira (halves) |
Changed in ifupdown (Ubuntu Lunar): | |
assignee: | nobody → Heitor Alves de Siqueira (halves) |
Changed in ifupdown (Ubuntu Focal): | |
status: | New → In Progress |
Changed in ifupdown (Ubuntu Jammy): | |
status: | New → In Progress |
Changed in ifupdown (Ubuntu Lunar): | |
status: | New → In Progress |
Changed in ifupdown (Ubuntu Focal): | |
importance: | Undecided → Low |
Changed in ifupdown (Ubuntu Lunar): | |
importance: | Undecided → Critical |
Changed in ifupdown (Ubuntu Jammy): | |
importance: | Undecided → Low |
Changed in ifupdown (Ubuntu Lunar): | |
importance: | Critical → Low |
One addition, line 71 in script also looks strange:
if ! cmp --silent "$oldstate" "$newstate" 2>/dev/null; then
DNS DNS6 DOMAINS DOMAINS6 DEFAULT_ROUTE
This causes: if-up.d/ resolved: 71: DNS: not found
/etc/network/
If you are on it, please fix this, too.