After upgrading ubuntu from 21.10 to 22.04, my internet connection does not work anymore. I am connected to the WLAN and I can ping IP addresses (from the local network as well as from the internet) - however, resolving names does not work anymore. So ping works with 0% packet loss but ping askubuntu.com gives me an error Name or service not known (it works from another machine that is connected to the same router).

When running nmcli, it shows the following DNS configuration:

DNS configuration:
    domains: fritz.box
    interface: wlp64s0

I also tried manually adding to the DNS servers in the network manager (WiFi setting -> IPv4 -> DNS). Then, both servers are shown in the DNS configuration but the problem still persists.

Any idea what the reason could be, what I can do to narrow down the problem or how to solve it?

5 Answers 5


As pointed out in this answer and in this answer, the solution (at least in my case) was a problem with /etc/resolv.conf which only contained a commented out line "Generated by NetworkManager". Replacing that file with a symlink to /run/resolvconf/resolv.conf solved the problem for me:

sudo rm -f /etc/resolv.conf
sudo ln -s /run/resolvconf/resolv.conf /etc/resolv.conf
  • Terrific! Tomorrow morning I ran a little Ubuntu Update! After that internet was not working and also /etc/hosts was changed (the computer's name was added an inside -Laptop- and some minor - adds) so that sudo also did not work anymore. So after fixing etc/hosts, this solution here finally brought me back into the game! Thanks so much! How could this happen from a normal update???
    – pedda
    Commented Jan 4, 2023 at 19:56
  • 2
    Note that /run/resolvconf/resolv.conf may be located under /run/systemd/resolve/resolv.conf
    – MPA
    Commented Nov 17, 2023 at 9:36
  • 1
    You are a lifesaver! I was going mental trying to understand what is going on.
    – prog_24
    Commented Jun 1 at 11:34

This seems to be caused by Ubuntu 22.04 expecting to be configured via netplan. Netplan configuration is created on a fresh install, but if you've an upgraded system, the necessary configurations are not present.

If there is no configuration file (check ls /etc/netplan/*.yaml) on your system, you will not get a DNS resolver configured by default.

All of the hack recommendations to override systemd-resolved service unit or the /etc/resolv.conf directly are just covering up the symptom.

Possible files that may(should) be present on your system - run ip a and ip r and replace values and device names as required:

Default generic config created by subiquity which will probably suffice unless you have specific needs

      dhcp4: true
  version: 2

LXD container config with hardcoded IPv4, gateway and DNS resolvers

  version: 2
      addresses: []
      - to: default
        addresses: [,]

Example of a bond setup

  version: 2
  renderer: networkd
      dhcp4: no
      dhcp6: no
      dhcp4: no
      dhcp6: no
      interfaces: [eno1,eno2]
      dhcp4: no
      dhcp6: no
        mode: 802.3ad
        mii-monitor-interval: 100
      interfaces: [bond0]
      addresses: []
      - to: default
        addresses: [,]

Run netplan apply afterwards to ensure you still have connectivity (careful with running this on servers you have no other access to!) or reboot.

  • Do you have any resources on how to install netplan on Ubuntu 22 ? My VPS never had it in the first place so I don't know where to start and I'm stuck because I cannot change things like DNS
    – Hassan
    Commented Sep 30, 2022 at 10:03
  • Thinking back on this, I am not actually sure which install style this applies to. For sure with Canonical's LXD images, but I saw a direct HW install without Netplan altogether. As for installing netplan, apt install netplan should do it, but you should keep your existing network manager in mind and disabling that one when switching to netplan.
    – C0rn3j
    Commented Oct 1, 2022 at 12:02

For me, the problem was that /etc/resolv.conf was linked to a stub resolver (/run/systemd/resolve/stub-resolv.conf) instead of the usual one (/run/systemd/resolve/resolv.conf).

Check the target of the /etc/resolv.conf symlink to see if yours is the same.

I fixed this like so:

ls /run/systemd/resolve/resolv.conf && sudo mv /etc/resolv.conf /etc/resolv.conf.bak
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
sudo systemctl restart systemd-resolved

First line includes a guard so the whole operation will fail if you don't have /run/systemd/resolve/resolv.conf for some reason. Hope this helps!


Wow, I just found a very different explanation for dns breaking on an upgrade to 22.04.

I was using dnsmasq with NetworkManager. The setup used to work fine, but I had a line like this:


And after the upgrade it would return as the IP when I tried to ping example.com

Before the upgrade it would use as the DNS server and return the resolved IP address.

I changed the line to:


And it went back to resolving correctly using the DNS server.

The man page for dnsmasq did not change, but the behavior seems to have changed. Quoting the man page:

Also permitted is a -S flag which gives a domain but no IP address; this tells dnsmasq that a domain is
local and it may answer queries from /etc/hosts or DHCP but should never forward queries on that domain
to any upstream servers.  --local is a synonym for --server to make configuration files clearer in this

But it seems now that local is only a synonym for server in the case where you don't list an IP address. Before it was an alias for server even in the case where you did specify an IP address. I wish they had updated the man pages or changed the behavior to error out if you specify an IP address with local=, since this change breaks previously working--albeit ambiguous--configurations.


I had issue with same symptoms. I tracked it down to ifupdown/managed=false in



Changing this to true resolved the issue.

You must log in to answer this question.

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