2

This question already has an answer here:

After logging in as root, I input apt-get update, and it gives me:

E: Malformed entry 51 in list file /etc/apt/sources.list (URI parse)
E: Malformed entry 1 in list file /etc/apt/sources.list.d/docker.list (Component)
E: The list of sources could not be read.

What's wrong with it?

Seeing many related answers I input the code: sudo -H gedit /etc/apt/sources.list

then it shows:

# deb cdrom:[Ubuntu 16.10 _Yakkety Yak_ - Release amd64 (20161012.2)]/ yakkety main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ yakkety main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ yakkety main restricted

## Major bug fix updates produced after the final release of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ yakkety-updates main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ yakkety-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ yakkety universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ yakkety universe
deb http://us.archive.ubuntu.com/ubuntu/ yakkety-updates universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ yakkety-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ yakkety multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ yakkety multiverse
deb http://us.archive.ubuntu.com/ubuntu/ yakkety-updates multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ yakkety-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ yakkety-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ yakkety-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu yakkety partner
# deb-src http://archive.canonical.com/ubuntu yakkety partner

deb http://security.ubuntu.com/ubuntu yakkety-security main restricted
# deb-src http://security.ubuntu.com/ubuntu yakkety-security main restricted
deb http://security.ubuntu.com/ubuntu yakkety-security universe
# deb-src http://security.ubuntu.com/ubuntu yakkety-security universe
deb http://security.ubuntu.com/ubuntu yakkety-security multiverse
deb http yakkety main  
# deb-src http yakkety main
deb http://dl.openfoam.org/ubuntu yakkety main
# deb-src http://dl.openfoam.org/ubuntu yakkety main
# deb-src http://dl.openfoam.org/ubuntu yakkety main
# deb-src http://security.ubuntu.com/ubuntu yakkety-security multiverse

Please explain to me how to remove this malformed line - line 51 is deb http yakkety main 6th from the end.

marked as duplicate by Zanna, Pilot6, muru, earthmeLon, Kaz Wolfe Jan 4 '17 at 19:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    Have you tried commenting out the line it is complaining about? You might also note that the line does not follow the format of any of the other lines. That can be a clue as to what the problem is. – Organic Marble Jan 4 '17 at 15:08
  • Could you please post the contents of "/etc/apt/sources.list.d/docker.list" so that we can diagnose the second issue. – Danyc0 Jan 4 '17 at 16:00
  • 1
    Line 51 is obviosuly malformend, so simply remove it, e.g. sed -i 51d /etc/apt/sources.list. – rexkogitans Jan 4 '17 at 16:17
4

Line 51, "deb http yakkety main", is not a reference to a repository, and the Ubuntu "yakkety/main" repository is already linked to on line 5. Therefore Line 51 should simply be removed. Line 52 is a commented out malformed line as well, and should also be removed to avoid future confusion.

To remove lines 51 and 52, either:

  • Run this command sed -i.bak -e '51d; 52d;' /etc/apt/sources.list. This will also create a backup called "/etc/apt/sources.list.bak" just in case it screws up and you want to recover it later. It should not produce any output, and you will only need to run the command once.

OR

  • Open /etc/apt/sources.list in your favourite text editor (make sure you run it with sudo. For example: sudo -H gedit /etc/apt/sources.list), delete the two lines, then save and close the file.

Now you can run sudo apt update and it should complete successfully.

  • needs to update other files as well "Malformed entry 1 in list file /etc/apt/sources.list.d/docker.list " so edit line 1 in /etc/apt/sources.list.d/docker.list – Panther Jan 4 '17 at 15:59
3

Probably you should remove deb http yakkety main since its not a repo,(url),to remove it,open the sources.list file with privileges and just delete it normally then save the file and do sudo apt-get update

Also,you didn't post the contents in /etc/apt/sources.list.d/docker.list,but you will need to remove the first line in /etc/apt/sources.list.d/docker.list as the error complains about it

Backup the files

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

sudo cp /etc/apt/sources.list.d/docker.list/ /etc/apt/sources.list.d/docker.list.bak

Then open the file with gedit sudo gedit /etc/apt/sources.list then remove the line

Do the same with docker.list, sudo gedit /etc/apt/sources.list.d/docker.list

Then save the files and your good to go.

  • needs to update other files as well "Malformed entry 1 in list file /etc/apt/sources.list.d/docker.list " so edit line 1 in /etc/apt/sources.list.d/docker.list – Panther Jan 4 '17 at 15:59
  • He probably didn't post the contents in `/etc/apt/sources.list.d/docker.list/,,anyway,i will update the answer – Arduino_Sentinel Jan 4 '17 at 16:03
  • No he did not nor does it appear anyone who has answered fully read the error message either or they would have asked for additional information as well ;) – Panther Jan 4 '17 at 16:08
1

As it says in the error. On line 51:

deb http yakkety main 

comment this out.

  • needs to update other files as well "Malformed entry 1 in list file /etc/apt/sources.list.d/docker.list " so edit line 1 in /etc/apt/sources.list.d/docker.list – Panther Jan 4 '17 at 15:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.