20

TL;DR

sudo cp -p /etc/network/if-up.d/resolved /etc/network/if-up.d/.resolved.broken-orig

#Edit /etc/network/if-up.d/resolved and take out the extraneous quotes on lines 48 and 52
#The fix looks like:
diff /etc/network/if-up.d/.resolved.broken-orig /etc/network/if-up.d/resolved
48c48
< "$DNS"="$NEW_DNS"
---
> $DNS="$NEW_DNS"
52c52
< "$DOMAINS"="$NEW_DOMAINS"
---
> $DOMAINS="$NEW_DOMAINS"

At least, this appears to be effective.


Recently upgraded an older system to Ubuntu 22.04.1 LTS via do-release-upgrade and ran into DNS issues, error messages were:

nslookup google.com
Server:     127.0.0.53
Address:    127.0.0.53#53

** server can't find google.com: SERVFAIL

and

/etc/network/if-down.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-em1: DNS=8.8.8.8: not found
/etc/network/if-up.d/resolved: 2: /run/network/ifupdown-inet-em1: DOMAINS=local_search_domain.com: not found
Failed to parse DNS server address: DNS
Failed to set DNS configuration: Invalid argument

when attempting to run an nslookup via a network connection (em1) defined in /etc/network/interfaces prior to the system upgrade.

After a period of self-soothing I located https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1981103 and https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1910273 which helped enhance my calm. It appears that, at a minimum, the errors encountered were due to a pair of typos in /etc/network/if-up.d/resolved which are easily fixed with a text editor; after manually removing the extraneous quotes I am able to bring up the network interface and query DNS servers. It's unclear to me if there are other issues with the ifupdown package currently shipped by Ubuntu 22.04.1 LTS (0.8.36+nmu1ubuntu3) or the manual edit I described above. Are there any documented fixes that don't involve editing lines 48 and 52 of /etc/network/if-up.d/resolved or is this the best workaround currently available for legacy systems that have been upgraded to Ubuntu 22.04.1 LTS?

1
  • You haven't provided enough information. What happens and what are you trying to achieve?
    – telometto
    Commented Aug 26, 2022 at 15:23

1 Answer 1

15

I bumped my Ubuntu server 18.04->22.04 and ran into this issue. As you clearly stated (thank you!) updating /etc/network/if-up.d/resolved and removing 2 quoted variables in such a way:

sudo vim /etc/network/if-up.d/.resolved.broken-orig

Old: "$DNS"="$NEW_DNS"
-->
New: $DNS="$NEW_DNS"

Old: "$DOMAINS"="$NEW_DOMAINS"
-->
New: $DOMAINS="$NEW_DOMAINS"

Solves this problem after a reboot.

4
  • 2
    Exactly what I needed! Thank you!
    – aaiezza
    Commented Jan 10, 2023 at 20:17
  • Note that the link posted by OP has the complete set of fixes required. It is not just these two lines (at least in my case). Also, if-down.d also requires fixes.
    – Domi
    Commented Feb 17, 2023 at 15:01
  • 1
    Hi Tom, thank you for this - I had a similar problem on Linux Mint 21.2 today, and had to change the /etc/network/if-up.d/resolved file so that the lines read: DNS="$NEW_DNS" and DOMAINS="$NEW_DOMAINS" i.e. without the $ and quotes on the left hand side. Commented Nov 24, 2023 at 12:17
  • 1
    debian 12 has the same bug . the solution works.
    – Alex
    Commented Sep 13 at 0:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .