Understanding Linux repositories and its setup for troubleshooting

Modified on Sun, 16 Mar at 7:43 PM

To view and configure the repositories on an Ubuntu device, you can follow these steps:


Viewing the Configured Repositories

 

The repositories configured in an Ubuntu system are typically listed in the `/etc/apt/sources.list` file and in any files within the `/etc/apt/sources.list.d/` directory.

 

1.View the main sources list file:

   Open a terminal and run:

   cat /etc/apt/sources.list


2. We can also verify the below as well to check if there is any additional repo link

 ls /etc/apt/sources.list.d/

On the test device, I could not find any additional repo url configured

 

Setting the Repositories to Default

If you want to reset your repositories to the default configuration, you can replace the contents of `/etc/apt/sources.list` with the default repository configuration for your specific version of Ubuntu. Here is how you can do it:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup (below screenshot shows the backed-up)

 

 

2. Replace the sources list with default repositories:

   Edit the sources list file with a text editor. You can use `nano`

   sudo nano /etc/apt/sources.list

 

Replace its contents with the default repositories. Below are the default repositories for Ubuntu 20.04 LTS (Focal Fossa) as an example:

   deb http://archive.ubuntu.com/ubuntu focal main restricted

   deb http://archive.ubuntu.com/ubuntu focal-updates main restricted

   deb http://archive.ubuntu.com/ubuntu focal universe

   deb http://archive.ubuntu.com/ubuntu focal-updates universe

   deb http://archive.ubuntu.com/ubuntu focal multiverse

   deb http://archive.ubuntu.com/ubuntu focal-updates multiverse

   deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse

   deb http://security.ubuntu.com/ubuntu focal-security main restricted

   deb http://security.ubuntu.com/ubuntu focal-security universe

   deb http://security.ubuntu.com/ubuntu focal-security multiverse

 

3. Save and exit the editor.


4. Update the package list:

   Finally, update the package list to apply the changes:

   sudo apt update

  

 

apt list –upgradable – provides more information on which are the packages that can be updated to which version

 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article