Comment 0 for bug 1981103

Revision history for this message
Uwe Schindler (uwe-thetaphi) wrote :

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://de.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
        100 /var/lib/dpkg/status

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/if-up.d/resolved looks like this:

root@pangaea-pm:~# cat /run/network/ifupdown-inet-ens13
"DNS"="134.102.20.20 134.102.200.14"
"DOMAINS"="marum.de"

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/if-down.d/resolved: 12: mystatedir: not found
/etc/network/if-up.d/resolved: 12: mystatedir: not found
/etc/network/if-up.d/resolved: 71: DNS: not found
/etc/network/if-up.d/resolved: 1: /run/network/ifupdown-inet-ens13: DNS=134.102.20.20 134.102.200.14: not found
/etc/network/if-up.d/resolved: 2: /run/network/ifupdown-inet-ens13: DOMAINS=marum.de: not found
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/ifupdown-${ADDRFAM}-$interface"
$DNS="$NEW_DNS"
EOF
        if [ -n "$NEW_DOMAINS" ]; then
            cat <<EOF >>"$mystatedir/ifupdown-${ADDRFAM}-$interface"
$DOMAINS="$NEW_DOMAINS"
EOF
        fi
    fi