“Temporary failure in name resolution”

I just updated a Ubuntu 20.04 LTS box to 22.04 LTS and found out my nginx server would not come up. The reason? It was not able to resolve it’s upstream servers by name. Known issue. So I started to google it. But DAMN! WTF! The internet is like a f*cking echo chamber for so-called techies writing blog posts all over the place and asking for coffees in return. It is really sad. Even the typo’s are just copy-pasted!

I wanted a solution that is NOT editing a file which states very clearly at the top:

# This is /run/systemd/resolve/stub-resolv.conf managed by man:systemd-resolved(8).
# Do not edit.

It took me quite some searching but I finally found it, the magic happens in /etc/systemd/resolved

DNS=8.8.8.8 8.8.4.4
Domains=remyblom.nl

(I used the google DNS in the example above, but I’d recomment using your local internet provider’s DNS at all time. Better for both performance and your privacy)