Skip to content
Related Articles

Related Articles

How to Restore Default Repositories in Ubuntu

View Discussion
Improve Article
Save Article
  • Last Updated : 11 Jul, 2022
View Discussion
Improve Article
Save Article

Repositories in Ubuntu are servers that contain software packaged into nice .deb or .rpm files containing the programs and libraries you need to set up of packages. A repository or repo is basically a software archive that makes it easy to install new software in your machine. In Linux, systems software is packaged into nice .deb or .rpm files which contain the programs and libraries needed by you. 

Software in Ubuntu’s repository is divided into four components or categories:-

  • Main – this component contains software that is free and open-source and is maintained by the Ubuntu team(Canonical).
  • Universe – this component contains software that is free and open-source software but maintained by the community all around the world.
  • Restricted – a small set of tools and proprietary drivers which make Ubuntu run correctly, these are maintained by the actual authors.
  • Multiverse – restricted software due to copyright or legal issues.

We have to follow these four steps in order to Restore Default Repositories in Ubuntu:

1. Deleting source.list file

Step 1: Open the terminal in your machine. Use shortcut Ctrl + Alt + T to open the terminal. Move the corrupted sources.list file to a safe location using the command below and enter your password when prompted.

sudo mv /etc/apt/sources.list ~/

Step 2: Now create the new sources.list file in the directory /etc/apt using the touch command.

sudo touch /etc/apt/sources.list

 

2. Enable Default Repositories

Step 1: Now open Software and Updates by searching in the menu or by typing the below command in the terminal

software-properties-gtk

 

Step 2: Then, change the server to the Main server or to any other server of your choice from the option Download from the Internet. We must enable some repositories from the new window to create new sources.list file in /etc/apt/ directory.

 

3. Remove Unwanted PPAs

Step 1: If you have too many PPAs installed in your system, they often mess up your system. To see the list of all the installed repositories on your Ubuntu system, open the Terminal and type the command :

ls -l etc/apt/source.list.d/

Step 2: Run this command to remove the PPA you want. Replace REPOSITORY_NAME with the name of PPA.

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

 

4. Run Update

Step 1: Now we have done all the steps successfully. And now you are ready to run an update. Run the below command.

sudo apt update

Type your password when asked and press Enter.

 

Step 2: We have successfully restored the default state of the apt package manager in your Ubuntu machine. We can now upgrade your system

sudo apt upgrade
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!