Report this

What is the reason for this report?

How to restore default repositories in Ubuntu?

Published on August 4, 2022
How to restore default repositories in Ubuntu?

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:

  1. Main
  2. Universe
  3. Restricted
  4. Multiverse

Restore default 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:

cd /etc/apt

restore-default-repo-1

Now, move the corrupted file to other location:

sudo mv sources.list <location>
sudo mv sources.list /sid/home/Desktop

restore-default-repo-2

Create a new file using the touch command:

sudo touch /etc/apt/sources.list

restore-default-repo-3

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.

restore-default-repo-4

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.

restore-default-repo-5

Click on Reload. The software repositories will be updated.

restore-default-repo-6

Verify if repositories has been added

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

restore-default-repo-7

If there are entries without the # as shown below, the repositories has been added.

restore-default-repo-8

Finally, Update the repositories by executing the following command:

sudo apt update

restore-default-repo-9

Conclusion

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.

Learn more about our products

About the author

e09330e1749e4191a9dfe441e5129f
e09330e1749e4191a9dfe441e5129f
Author
See author profile
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.

Still looking for an answer?

Was this helpful?
Creative CommonsThis work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.
Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.