Skip to main content

Linux - Configure DNS server IP to resolve errors with apt-get update

Perhaps you have a new install of Ubuntu, and you are about to install docker or any other Linux packages. The first step is to update the application repositories using the sudo apt update command.

There is a very small possibility that you will get the error below if you are using a fresh install of the Ubuntu 18.04 LTS (Bionic Beaver).



This error simply means that Linux is unable to connect to the official repository likely due to a DNS configuration or a network issue.

Here we try to help you resolve the DNS issue.

To resolve this, you must specify a DNS in your network settings. Well, there is one popular DNS that works well: Google's DNS. Follow through, please.

STEP 1: Go to the settings page of Linux (Ubuntu)


STEP 2: This should reveal a plethora of options. On the left pane, simply scroll down and click Network as shown below. This reveals your different network connections, for me, “enp0s3” is the adapter connecter to the internet. So, I must configure DNS for “enp0s3”. If you have more than one network adapter like me and you are not sure which is connected to the internet, click here to find out How many network cards/interfaces do I have and what's their IP.


STEP 3: This reveals a new configuration window as shown below. You should see a few tabs at the top of this new window. Simply click on the IPV4 tab and configure the exact values on the picture below.

That is, first disable automatic DNS, secondly set the DNS or DNS IP-address as 8.8.8.8. then click “Apply” to save the configuration.

 


That’s all, in just 3 steps we have successfully configured the appropriate DNS for the Ubuntu Desktop.

 NB: there were cases where we had to start the server, maybe twice, before we could successfully  use the sudo apt-get update

There are a few other reasons why you may have this error. For example, it could be that you are unable to download extensions from inside Microsoft’s VS Code Editor.

This will promptly fix your issue and give you some peace of mind.

We also tried to fix this issue directly from the command prompt to help those who may be stuck in a server without a graphical user interface. Sadly, this required the use of certain packages which were not shipped by default with the Ubuntu desktop which was used for this article.

Cheers! see you later in another wonderful Linux/System Admin tutorial.


Comments

Popular Articles

Issue with installing python-axolotl or python-axolotl-curve25519 on Windows

It is peeve amazing how many hours get burnt while trying to resolve simple package dependency issues. I may be too dumb to proffer a lasting one-fits-all solution to all dependency issues, but I got this issue fixed in my own case. Problem Description: The python-axolotl library requires certain dependencies that are not properly managed when installing libraries via a command line's requirement.txt file. I got real help by reading through this link below, but this page might be more helpful when it comes to detailed instructions. Actual instructions: https://github.com/tgalal/python-axolotl Typical errors might look like the following: 1. In this case, missing library(s). Libraries needed for compiling some python resources. Unfortunately, http://aka.ms/vcpython27  has been decommissioned because Python2x is EOL. You can still get the VcPython27 from an archive at https://web.archive.org/web/20210106040222/download.microsoft.com/download/7/9/6/796EF2E4-801B-4F...

Chrome Extension (part 1): Injecting External Scripts into a Web Page

Recently, I was required to develop a chrome extension for some executives. This plugin only targeted a few of our most visited websites. There was a lot of approaches to implement the extension and all our use cases. One particular challenge was trying to inject scripts from our own CDN into specific web pages. the scripts were required to interact with the page and all variables possible. Since there is a script isolation thing for Chrome Extensions, I felt this was a good challenge to take up in my spare time. Here is a sample of my content script. content.js document.onreadystatechange = function () { console.log("document state is:" + document.readyState); if (document.readyState == "complete") { let randAntiCache = Math.random().toString().split('.')[1]; let scriptURL4="http://localhost.test/testscript.js?v="+randAntiCache; let scriptnode4 = document.createElement("script"); scriptnode4.setAttribute("s...

Who is this Brown Skin Girl?

In the recent wake of a great musical sensation and a re-make of the famous Lion King movie, Beyonce has been on the global selection of artistes to share performances. Today, I will try to examine the poetry of the track titled Brown Skin Girl, All interpretations in this article are my personal candid opinion. so feel free to share yours in the comments section, i will be glad to add it to my edits. So while I may not pretty boy; your heart is amiss; Play it like a villain `cause she caught in a wave This paints the picture of a guy who feels He is not good enough for the lady of his dreams, so he said Tonight I am walking away Lined up my mind, on the grind yeah yeah meaning he tryin' to give up. But then in the chorus, He said Tonight I might fall in love Depending on how you hold me I'm glad that I'm calming down can't let no one come control me So this dude aint feeling he's the kinda guy for bae, but bae be doubting if she still want...