How to fix “Malformed entry in /etc/apt/sources.list” error?

0/5 Votes: 0
Report this app


Recently I was installing Wine on my Ubuntu system while adding the Wine repository it displayed an error i.e. “E: Malformed entry 58 in list file /etc/apt/sources.list (Component)” you can see this in the image below.

malformed error

Here I will explain why this error is caused and what are possible solutions to this.

Why this error is caused?

This error occurs because of some problem with the given line number. The possible reasons could be –

  • You place / (slash) incorrectly in the URL.
  • If you have copied the repository URL it might be caused by some space, it is recommended to delete each space and then save the file
  • You added an incorrect URL.

There could be some other reasons but first, you should check and correct the above things.

The solution to this problem

Follow the given steps to solve this issue –

1. To fix this issue first run the given command and identify the line which is causing the problem.

sudo cat -n /etc/apt/source.list

This will display the given output in your terminal.

display source list file

2. Open the /etc/apt/sources.list using a text editor and remove that line or comment it by placing a # at the starting of the line. Use the given command to open it.

sudo nano /etc/apt/sources.list

3. Now use the given command to refresh the package repository

sudo apt update && sudo apt upgrade -y

4. Try the command once again to add the wine repository now it should work perfectly.

install software properties command

As you can see in the given image now the same command is working perfectly.


I hope this fixes your issue but if you are still facing it then write us in the comments below.

7 comments on "How to fix “Malformed entry in /etc/apt/sources.list” error?"

  1. Bobby Surcouf says:

    My /etc/apt/sources.list is all messed up. Can you provide me with a generic /etc/apt/sources.list I can use to start from scratch?

  2. Sam says:

    Can you help me to fix that problem ?

  3. Sam says:

    lsb_release-cs: command not found
    E: Malformed entry 50 in list file /etc/apt/sources.list (Component)
    E: The list of sources could not be read.

  4. Cazard says:

    Hi. Your manual got me farther than anything before.
    But in the end it didn’t do it for me. Same error message.
    I thought I might need to save it in the text editor, but it’s a read-only, I’m told that I don’t have permission.
    Meaning I don’t get to update/upgrade.

    • Cazard says:

      p.s. so the problem of the text editor being a read-only solved itself. Literally. Today I thought I’d try the insanity-defining thing and try the same once more, even though it had not yielded in any results the times before. Today I could edit. Even though I’d had it sit for a couple days, doing nothing about it.
      Apart from that it was your tutorial here that saved the situation. Clear, simple and to the point. Thank you, and I genuinely wish you a great week :)

  5. Haq Fadil says:

    The shortest solution is by:
    sudo nano /etc/apt/sources.list

    Then make sure that particular line has the correct link. The correct link is:
    sudo add-apt-repository ‘deb focal main’

    Where there IS a space BEFORE “focal main”
    Save that file. You may now update the repository.

  6. acero says:

    >_< you'v save my life… i Just need to put an "#" to fix my pop os 'apt'

Leave a Reply

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