Do-release-upgrade from 22.04 to 24.04 deleted systemd-resolved

22.0424.04aptdo-release-upgradeupgrade

I got a warning during the upgrade from 22.04 to 24.04 that deleting systemd-resolved would create name resolution problems (no kidding).

Having completed the upgrade to 24.04, I now have no ability to resolve queries. The obvious solution would be to reinstall systemd-resolved; but apt fails because it cannot resolve 'us.archive.ubuntu.com'. (chicken–>egg–>chicken) I managed to workaround that by adding a temporary entry in /etc/hosts:

91.189.91.83 us.archive.ubuntu.com

But now apt is failing because it can't resolve 'proxy'. Temporary failure resolving 'proxy' I have no proxy configured and there is no host by that name.

What do I need to do to just get systemd-resolved installed?

Or is there new resolver for 24.04 that I need to enable?

Why did do-release-upgrade uninstall it and not replace it?

Best Answer

I have a successful workaround. Download .deb from https://packages.ubuntu.com/noble/amd64/systemd-resolved/download and install directly. Now I have working name resolution again.

One method to download with dysfunctional name resolution and curl would be to use something like this:

curl -L --doh-url https://9.9.9.9/dns-query -O $URL

where -L makes curl follow location headers (redirects) and --do-url tells it to do name resolution via the Quad9 DNS. A possible alternative would be --resolve 'somename.tld:80:[::1]' (IPv6) or --resolve 'somename.tld:80:10.0.0.1' (IPv4) to sidestep system name resolution for a single request.

Related Question