If you get a “failed to fetch” error occurs when apt-get update is run, then try this:
Edit DNS
First try to ping any website
ping zerai.xyz
If you can’t resolve the DNS
ping: zerai.xyz: Temporary failure in name resolution
Then first edit resolv.conf
sudo vi /etc/resolv.conf
Change your DNS to any DNS Server
nameserver 100.64.0.7
Next execute this commands :
sudo apt-get --download-only --reinstall install resolvconf
sudo dpkg --purge --force-depends resolvconf
sudo apt-get install resolvconf
Finaly if you still have DNS problems a reboot is recommended
If you have an EOL version(Ubuntu)
Just run
sudo sed -i -r 's/([a-z]{2}.)?archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
and
sudo sed -i -r 's/security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list