Thursday, January 27, 2011

Restore your Sources List to Defaults in Ubuntu

Ubuntu Sources List Generator is available and covers all the current Ubuntu releases. It is actually a website which generates a sources.list with your intended repositories/server and then you can copy it to your /etc/apt/sources.list. Besides the official repositories, you can also add the testing PPAs for most of the commonly used apps on Ubuntu. But if you are not sure of what you are doing, don't enable any testing PPAs.

When should you consider reverting to the default sources.list

1. If you recently added any testing PPAs following any direction on the web and now are unsure how to get rid of those PPAs.
2. If you are getting an error when installing a software that says Duplicate entry in sources.list.
3. If you are getting an error when installing a software that says Malformed entry in line **.

Note: Reverting to the default sources.list is not the only fix and you can edit your existing sources.list and can correct the errors. But, if you are not sure what to do, resetting your sources.list would definitely help you.

How to generate a new sources.list

Go to this website.

http://repogen.simplylinux.ch/

Select your County and Ubuntu Release. For a default set of repositories, you need to enable these repositories.

1. All of Ubuntu Branches repositories.
2. Security - Important Security Updates.
3. Security Sources Repository
4. Updates - Recommended Updates
5. Updates Sources Repository

If you want to install software from  Canonical Partner Repositories (closed source software), enable the Ubuntu Partner Repositories (both of them) or if you choose not to, leave them alone.

If you want to install latest versions of some software say AWN, enable the 3rd party repository for AWN and any others you wish to enable.

Now, click the Generate List button at the bottom of that page and you'll see your generated sources.list.

How to replace old sources.list with the new one

Go to Applications > Accessories > Terminal:

Backup your old sources.list in case you need to revert to the older one under any circumstances.

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

Generate a new one.

gksudo gedit /etc/apt/sources.list

If you need to use a command line editor,

sudo nano /etc/apt/sources.list

Copy/paste all the text from the newly generated sources.list to this file. Save it and close and now run this command.

sudo apt-get update

It would update your repository index to the current sources.list and then you can install any software using Software Center, Synaptic or apt-get.

Enjoy!

Related Posts:

Installation , Package Manager , Troubleshooting