Unable to update or install anything after moving to another country

For some reason APT can not find the Release file in the specified repositories list.

To fix this, I would suggest the following:

  • Check if your connection to the Internet is behind a firewall, limited in any way or behind a proxy and configure your system and connection accordingly or change to a different connection if available.

  • Check if there is an APT proxy configuration file by running the following command:

ls /etc/apt/apt.conf.d/*proxy*

If the command returns back any results, move these files out of the /etc/apt/apt.conf.d/ directory or delete them.

  • Revert your repositories list to the original Ubuntu Bionic Beaver list by running the following command in the terminal:
sudo nano /etc/apt/sources.list

A file editor will be opened. Delete all the lines in it and then copy and paste the following in the file editor:

deb http://archive.ubuntu.com/ubuntu bionic main universe multiverse restricted
deb http://security.ubuntu.com/ubuntu/ bionic-security main multiverse universe restricted
deb http://archive.ubuntu.com/ubuntu bionic-updates main multiverse universe restricted

Then, save and close the file by pressing Ctrl + X then press Y then press Enter

To verify you saved the file correctly, please run the following command in the terminal:

cat /etc/apt/sources.list

The output should be exactly:

deb http://archive.ubuntu.com/ubuntu bionic main universe multiverse restricted
deb http://security.ubuntu.com/ubuntu/ bionic-security main multiverse universe restricted
deb http://archive.ubuntu.com/ubuntu bionic-updates main multiverse universe restricted

Ubuntu repositories have a defined format. They should be for example something like deb http://archive.ubuntu.com/ubuntu bionic main.

Explanation:

deb: These repositories contain binaries or precompiled packages. These repositories are required for most users.

http://archive.ubuntu.com/ubuntu: The URI (Uniform Resource Identifier), in this case a location on the internet.

bionic: is the release name of your Ubuntu installation.

main & restricted ...etc: are the section names or components. There can be several section names, separated by spaces.


After that, please update your repositories list by running the following command in the terminal:

sudo apt update

You should now be able to install packages and update your system again.


Notice:

If you still get errors, please first back up /etc/apt/sources.list.d/ to your home directory by running the following command in the terminal:

mkdir ~/old_sources_list_d && sudo cp -r /etc/apt/sources.list.d/* ~/old_sources_list_d/

After that, please clear all existing PPAs and repository lists in /etc/apt/sources.list.d/ by running the following command in the terminal:

sudo rm /etc/apt/sources.list.d/*

Then, please update your repositories list by running the following command again in the terminal:

sudo apt update

I think it is not exactly because the change of country from your connection. It is because the new connection has any proxy server or system to block or redirect Ubuntu servers ... (could be government or institution)

I have a similar problem connecting from the "sala de computo" (compute room) in my University.

I think I can use some VPN or servers configurations (DNS) to jump this ...