While we believe that this content benefits our community, we have not yet thoroughly reviewed it. If you have any suggestions for improvements, please let us know by clicking the “report an issue“ button at the bottom of the tutorial.
Getting errors while updating system repositories or installing new software? You may get errors because your /etc/apt/source.list file is corrupted which contains the repositories details. In this article, We will see how to restore the default repositories in Ubuntu.
There are four standard repositories in Ubuntu:
First, We need to back up the corrupted source file by moving it to another location. Open a terminal by pressing Ctrl+Alt+T and enter the following command to change the directory to where the source file is located:
Now, move the corrupted file to other location:
sudo mv sources.list <location>
sudo mv sources.list /sid/home/Desktop
Create a new file using the touch command:
sudo touch /etc/apt/sources.list
Now, Open the Software & Updates application using the search bar or the app drawer. Change the server to the main server and enable the restriced repository. You can also enable universe and multiverse repositories if needed.
To enable the updates, Under the Updates tab, select All updates or at least security updates in Subscribed to drop-down menu and click on close.
Click on Reload. The software repositories will be updated.
To verify, open a terminal by pressing Ctrl+Alt+T. Open the /etc/apt/sources.list file by running the following command:
sudo vi /etc/apt/sources.list
If there are entries without the # as shown below, the repositories has been added.
Finally, Update the repositories by executing the following command:
sudo apt update
So, We learned how to restore default repositories in Ubuntu. Follow Journaldev.com for even more tutorials on Linux, Python and more!
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.