Cannot Access Ubuntu Repositories
Last week, I tried to update the program repositories on my Ubuntu Server operating system (version 16.04). Here is the results from my “apt-get update” command:
From the graphic above showing the terminal’s output to my “apt-get update” command, you can see the repository URL’s are not being resolved, nothing is downloaded, and “dpkg” appears to be broken (probably because “dpkg” is looking for downloads that never occurred). As “apt” had been updating, upgrading, downloading, and installing programs without issue prior to this massive failure, my first thought was to wait, as there might well be a problem from Unbuntu’s side with their servers. This proved to be wishful thinking on my part, and after a few hours, nothing changed. I then checked all my network/internet settings and could not find any error. If the problem is not with Ubuntu’s servers, and not my Ubuntu operating system, then the only thing left is something amiss in the name servers of my ISP. Yeah I know, that conclusion sounded like a long shot to me at the time too.
A Rose By Any Other Name Is Still A Rose…
To test my “name server theory”, the only alternative DNS servers of which I am aware belong to Google. I went to https://developers.google.com/speed/public-dns/docs/using, and found instructions for changing DNS servers (instructions are there for Windows, Mac, and Linux), and the addresses to Goggles DNS servers. For Linux, the instructions require adding the address for Google’s DNS servers to /etc/resolve.conf. Sadly, in Ubuntu, that file does not exist; however, /email@example.com does, and it has a statement telling you to not manually change the file, as the results will be overwritten (I presume by /etc/resolveconf/update.d). In any event, I chose what I felt would be a much easier path: edit /etc/network/interfaces. I had already used this file to set up a static IP for the server, so I went back to it, shown below in a “nano” editor, and added “dns-nameservers 126.96.36.199 188.8.131.52”. I made no other changes, and did not change any router settings. I wrote out the changes, exited the editor, rebooted the server, and “apt” and “aptitude” have successfully accessed the Ubuntu repositories ever since.