failed to connect to http://changelogs.ubuntu.com/meta-release

When I log into my Ubuntu terminal tty1, I get a message

failed to connect to http://changelogs.ubuntu.com/meta-release

I try various things, then I get an error message telling me

could not resolve us.archive.ubuntu.com

If I ping us.archive.ubuntu.com -c 4:

ping: archive.ubuntu.com: name  or service not known

And the same message for sudo apt-get update.

I did not set any proxy; I left it blank during install.

My internet connectivity is apparently disabled and I could not configure it.

I tried rebooting but nothing changed.


Solution 1:

I had this same problem with 17.10, but I'm betting the same applies to other recent versions as well.

Those MOTD messages are generated by scripts in /etc/update-motd.d. The exact script that generates that specific line is /etc/update-motd.d/91-release-upgrade, which also runs /usr/lib/ubuntu-release-upgrader/release-upgrade-motd. This last script will check for new releases and write output into /var/lib/ubuntu-release-upgrader/release-upgrade-available.

The script will only update the file every 24 hours. So if you wait long enough, the file will go stale and the script will update the file anyway. But, if you want to update it immediately, just remove /var/lib/ubuntu-release-upgrader/release-upgrade-available and run /etc/update-motd.d/91-release-upgrade and it should start working correctly.

I created this problem because when I first setup my 17.10 server, I had a typo in my DNS server address.

Solution 2:

The failed to connect status is coming from a static text file. Here's how to regenerate said file in Ubuntu 18.04:

$ sudo rm /var/lib/ubuntu-release-upgrader/release-upgrade-available
$ sudo /usr/lib/ubuntu-release-upgrader/release-upgrade-motd

(This comes from a mix of Anthony Cascianelli's answer plus eiro's comment, compiled into a concise answer and thus easier for my team to read and execute.)