Failed to fetch Temporary failure resolving '

 How to solve the error  Failed to fetch  Temporary failure resolving ' on Ubuntu Server?

Today when I was working in my VM for testing with the OS Ubuntu Server I faced the below error during the update.

One solution that I have found to solve this problem is to type this command to Temporarily add a known DNS server to your system:

echo "nameserver" | sudo tee /etc/resolv.conf > /dev/null
Then run all these commands to update all the system packages
sudo apt-get update

sudo apt-get install apt-transport-https
sudo apt-get upgrade


Leave as a comment: