0

I'm seeing the following errors in my terminal:

E: Malformed line 1 in source list /etc/apt/sources.list.d/docker.list (type)
E: The list of sources could not be read.

I've already tried editing my sources.list file, but the error is still the same.

chriska
  • 1
  • 1
  • We can't help you since you haven't shown us what the line is, nor how you edited it. Telling us that you edited but still get the error isn't useful if we know neither what the line was nor what you edited it to, nor even what command you are running to get that error. So please [edit] your question, tell us what command you run, and show us the contents of /etc/apt/sources.list.d/docker.list since that is the file your system is complaining about. – terdon Mar 11 '24 at 15:11
  • The error messages tells you the file that needs correction, ie. /etc/apt/sources.list.d/docker.list and not the primary sources.list file, but a file added by a user of your system with sudo privileges. – guiverc Mar 11 '24 at 20:17

1 Answers1

2

In addition to the central /etc/apt/sources.list, there's a directory that can contain individual files with sources. This directory is /etc/apt/sources.list.d/. This type of setup, a central config file plus a directory with individual, smaller files, is quite common.

In your case, the malformed line isn't in the central sources.list, but in one of the files in sources.list.d, namely in docker.list:

E: Malformed line 1 in source list /etc/apt/sources.list.d/docker.list (type)
E: The list of sources could not be read.

As a more general remark, it's often a good idea to read the error messages completely. In many cases they spell out where the problem is quite literally.