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 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.

24 thoughts on “How to fix the sources list

  1. Could not initialize the Package Information

    An unresolvable problem occured while initializing the package information.

    Please report this bug against the ‘update manager’ package and include the following error message.

    ‘E:Type ‘.net/tualatrix/ppa/ubuntu’ is not known on line 1 in sources list etc/apt/sources.list.d/tualatrix-ppa-natty.list

    Please help me regarding this problem.

    Thank you

  2. To solve this, I tried to Remove the packages you recently installed and caused the problem. You could do so using Synaptic Package Manager -> Package -> Mark for removal. You might need to use Root privilege to modify /etc/apt/sources.list and sources.list.d files in case you have a problem. To open sources.list with Root privilige use:
    :~$ gksudo gedit /etc/apt/sources.list

    This is explained in details in the Ubuntu guide:

  3. When I wanted to get URLs of vlc software, I typed something like this
    #apt-get -qq –print-uris install vlc | awk -F ‘ ‘ ‘{ print $2}’ > get.lst
    but I couldn’t do that, because I did not update my Ubuntu 10.4
    The question is:
    “How to update package details for each software in Ubuntu 10.4 without an Internet connection ?”

  4. Thank u very very much for this! It was really great and it solved my prblm! My ubuntu couldnt even run software centre and all is fixed now! THANK YOU

  5. I am new to Ubuntu. i fresh installed the server i don’t have GUI. i am unable to install any ting from the terminal :(
    both sudo gedit /etc/apt/sources.list and gksudo gedit /etc/apt/sources.list are not working for me i get “command not found” error.
    Here’s my sources.list

    # deb cdrom:[Ubuntu-Server 12.04 LTS _Precise Pangolin_ - Release amd64 (20120424.1)]/ dists/precise/main/binary-i386/
    # deb cdrom:[Ubuntu-Server 12.04 LTS _Precise Pangolin_ - Release amd64 (20120424.1)]/ dists/precise/restricted/binary-i386/
    # deb cdrom:[Ubuntu-Server 12.04 LTS _Precise Pangolin_ - Release amd64 (20120424.1)]/ precise main restricted

    i can’t copy or paste any command out put since i am no the Terminal only version (couldn’t install the GUI either)
    Please Help!

  6. I do not agree with hella. Ubuntu is not a waste of time, the system is not the same as windows, and there is a lot of work around some of the problems.
    My only gripe is that if ubuntu change APPS then they should remove the offending problem from the system. Not all computer users are computer literat, and some things are beyond some people to solve, which can result in crashes happening when they try to resolve the problems.

  7. i wanted to download my vlc but im gettin this error,Malformed line 1 in source list /etc/apt/sources.list.d/launchpad_vlc.list (dist parse)

  8. hi guyz please help me when i type commands for update on my backtrack 5 r1 example
    apt-get install most
    E: Type ‘”deb’ is not known on line 10 in source list /etc/apt/sources.list
    E: The list of sources could not be read.

  9. I am unable to edit my sources.list file, it says i don’t have the permissions as i’m not the owner, yet my account is an administrator and it was the first account created onto the pc. Also, when i try to edit terminal, after putting in a command/code, i get “[sudo] password for user:” and suddenly loose the ability to type in the document.

  10. When using sudo and you are asked for password you must use the root password, that is the first password you created when installing the operating system before you created your account and it’s password. Sudo temporarily runs the commands with root privileges then returns you to normal user privileges. If sudo still doesn’t work Google “setup sudo” for your distribution and also search how to update and install packages using apt.

  11. Hi,

    I have to install postfix and ftp service in my ubuntu-12.04.2-server-amd64. I think i got a problem with the source list. I install Webmin before and other stuff and it was fine, but now, i cannot use (sudo apt-get update, sudo apt-get install postfix). I already use the “ubuntu source list generator” and replace my sourcelist without success.

    I dont know what more to do. please HELP..


    from: Puerto Rico

  12. Hello,I have a problem quite relationed with what you’re talkibg about.

    I have a trouble with my sources list.d And I can’t either use the comand apt-get or use de package installer..In bouth cases it turns out to be a mistake in the line 16 of my sourceslist,which is:
    deb non-free main unstable

    How should I fix it?

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>