How do I remove a malformed line from my sources.list?

Some lines are broken in your sources.list file (or another *.list file in sources.list.d/).

Edit the file mentioned in the error to fix the broken lines.

  1. To do this, run this command (press Ctrl+Alt+T to open a Terminal):

    sudo -H gedit /etc/apt/sources.list
    

    Or, instead of Gedit (which not all Ubuntu systems have), you might prefer to open the file an a terminal-based text editor:

    sudoedit /etc/apt/sources.list
    

    If necessary, replace /etc/apt/sources.list with another file name, i.e., the path to some file inside /etc/apt/sources.list.d/.

  2. Find the lines which are incorrectly formatted (refer to the error for a line number, then look around that point). These are examples of correctly formatted lines:

    # Comment, marked by a line starting with '#'
    deb http://site.example.com/debian distribution component1 component2 component3
    deb-src http://site.example.com/debian distribution component1 component2 component3
    

    The URL, distribution and components will be different. It does not necessarily have to have 3 components.

    Anything which doesn't fit this format is incorrect.

  3. Save the file and quit the text editor. Then run this command in a Terminal window:

    sudo apt-get update
    

Assuming there are no errors, the problem is now fixed. You should be able to run the Sofware Center.

However, while some problems with the Software Center can be solved by reinstalling the software-center package, most cannot, so it's possible your original problem will remain. If that is the case, you can post a new question to get help with it.


Quick Method

A workaround for this problem can be building the sources.list entry from scratch.

deb http://archive.ubuntu.com/ubuntu precise main universe restricted multiverse
deb-src http://archive.ubuntu.com/ubuntu precise universe main multiverse restricted

deb http://security.ubuntu.com/ubuntu/ precise-security universe main multiverse restricted
deb http://archive.ubuntu.com/ubuntu precise-updates universe main multiverse restricted
deb http://archive.ubuntu.com/ubuntu precise-backports universe main multiverse restricted

# deb http://archive.canonical.com/ubuntu precise partner
# deb-src http://archive.canonical.com/ubuntu precise partner

# deb http://extras.ubuntu.com/ubuntu precise main
# deb-src http://extras.ubuntu.com/ubuntu precise main
  • Copy the above content (in grey box) and open the sources.list file as root.

    Typing sudo -H gedit /etc/apt/sources.list this in a terminal and hitting Enter will do the job.

  • Then paste the copied content in the sources.list - note you probably will need to replace precise with the codename representing your Ubuntu version - e.g. trusty for 14.04. Then save and close gedit.

  • Then do sudo apt-get update and you will see that the repository list is updated.

Explanation: Here we are completely replacing the content with another sources.list file with repository entry from Main Server. If you want to use your local server for sources.list see the method below.

Recommended Method

Go to the Ubuntu sources list generator site.

  • Select your country.
  • Select your desired branches, such as Main, Restricted, Multiverse, Universe.
  • Select desired update list, -
  • Select any third party repository list if you wish.
  • Click Generate list at the bottom of the page, you will be given a list with repositories.
  • Copy that list and replace with sources.list file you have.

You are done. (I hope this will help.)


As you can see from the error, it says that your sources.list file has a wrong entry. This wrong entry could not be parsed. This error is not related to Software Center as such but mostly to do with apt(The package manager)

The way to solve this would be to fix the malformed line 91 entry.

If you cannot understand what is wrong with line 91, please post line 91 and I will help you out


Please paste file /etc/apt/sources.list so we can troubleshoot this problem for you. See this short tutorial answer for how to do that:

How can I easily share the output of a command or a text file with others?


This can sometimes be a very easy fix, but you must backup sources.list first since it's a critical file.

  1. Open the terminal with Ctrl+Alt+T.
  2. Type/paste: sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup (this creates a backup copy)
  3. sudo sed -i -e '68d' /etc/apt/sources.list (this deletes the problematic line)
  4. sudo apt-get update (this updates the database with the hopefully-fixed file)

If you see no errors appear when you try step 4, the problem is hopefully fixed. You can exit the terminal and go back to Software Center/Update Manager and it should work.

If there is still a problem, you can restore the original file from the terminal with sudo cp /etc/apt/sources.list.backup /etc/apt/sources.list. In that case, please paste the problematic lines or even the entire file to a pastebin and then we can help out further.