How to fix the sources list

Sometimes the apt-get may not work, it is often caused by the misspelled sources list. In most cases, you can fix it by yourself.

In this guide, I will tell you where is sources list, and how to fix it.

Where  is sources list

Sources list is located at “/etc/apt/” (File System->etc->apt), the main sources list is “sources.list”. And there will be other sources list under /etc/apt/sources.list.d/, all valid list should be end with “.list”.

How does sources list look like

If you open your sources.list, a typical line will look like this:

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

It is called an “Entry”, sources list is consists of a numbers of entries.

Every entry is made by four sections, these sections are separated by “space”. I used different color to distinguish difference sections.

The first section is represent the “Entry type”. “deb” means the list contains deb packages. Another value is “deb-src”, it means the deb packages’ source code.

The second section is the URL, it must be accessible.

The third is distribution code name, it depends on your current distribituion.

The forth section is the “components”, it can be several items.

So a complete and valid source entry will look like this:

  • Type: must be “deb” or “deb-src”
  • URL: must be an accessible url
  • Code name: “karmic”, “lucid”, “maverick” or ther Ubuntu code names.
  • Component name: if the entry is PPA, so it will always be “main”.

Now you know how to fix the sources list! Open your terminal, try to edit and correct it with root like this:

sudo gedit /etc/apt/sources.list (or other path)

If you have any other problem, please leave a comment to let me know.

113 thoughts on “How to fix the sources list

  1. I came across your weistbe on google and after reading a couple of your posts, i have decided to add you in my. iGoogle Reader. Thanks and keep up with the great posts. Will be in touch.

  2. Its really nice idea. I think it would be helpful for all. Thank you for sharing with us.ometimes the apt-get may not work, It is often caused by the misspelled sources list. In most cases, you can fix it by yourself.

  3. In today’s era of commerce, it has become essential for all business organizations to sustain an impressive online image to cater the diverse needs of their customers.
    Word – Press is a software platform designed to make blogs and can also be used to make
    websites. Apart from them all, Word – Press allows its users to use it as social networking platform through different add-on modules
    that let visitors create groups where they become each other’s friends.

  4. Nice post. I was checking constantly this blog and I
    am impressed! Extremely helpful info specifically the final section :
    ) I maintain such information a lot. I used to be looking for
    this particular information for a very long time.
    Thanks and good luck.

  5. I feel this is among the such a lot vital information for
    me. And i am satisfied reading your article.

    However wanna observation on few common things, The site taste is ideal, the articles is in point of fact excellent : D.
    Good task, cheers

  6. nice explanation about source list entities. But i want to know , why failed to fetch error occurs when excecuting update command on said:

    can you please explain why failed to fetch occurs when we execute update command

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>