'How to fix "E: The list of sources could not be read" could not be read error?

I have added these two lines in etc/apt/sources.list.d/webmin.list

 `deb http://download.webmin.com/download/repository sarge contribdeb`
 `http://download.webmin.com/download/repository sarge contrib`

Now, on running the "sudo apt-get update", i am getting the following errors:

 1. E: Type 'http://download.webmin.com/download/repository' is not known on  
    line 2 in source list /etc/apt/sources.list.d/webmin.list.
 2. E: The list of sources could not be read

Thanks in advance !!



Solution 1:[1]

I have also got this error:

sudo apt-get update 
E: Type 'mongodb-org/4.2' is not known on line 2 in source list /etc/apt/sources.list.d/mongodb-org-4.2.list
E: The list of sources could not be read.

I used following command -

  1. ls /etc/apt/sources.list.d/ you can see your all .list file like ls /etc/apt/sources.list.d/getdeb.list openjdk-r-ppa-trusty.list mongodb-org-4.2.list pcf-miro-releases-trusty.list nginx.list webupd8team-java-trusty.list

choose one of them have problem and remove using following command 2. sudo rm -r /etc/apt/sources.list.d/mongodb-org-4.2.list

Solution 2:[2]

More precisely,

deb http://download.webmin.com/download/repository sarge contribdeb

is correct because it starts with the word "deb" (or it could be "deb-src"), while

http://download.webmin.com/download/repository sarge contrib

does not start with a good keyword, and the error that shows up is just telling so:

1. E: Type 'http://download.webmin.c ...: what TYPE of repository is that? deb or deb-src?

UPDATE: Looking better: probably "contribdeb", the last word of the first line, should be split in two with the "deb" going to the start of next line.
In that case actually you pasted two times the same line, with the added bonus that you did it in the wrong way. BTW, two identical (but correct) lines in that file should not be a big problem.

Solution 3:[3]

To rectify this error all you need to do is the following:
1) rm /etc/apt/sources.list
2) nano /etc/apt/sources.list
3) paste the following and save:

deb http://http.kali.org/kali kali-rolling main non-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib
deb http://http.kali.org/kali kali-rolling main non-free contrib

save the file.
4) sudo apt-get update

If this doesn't work wait for few days and try again as the link might be broken!

Solution 4:[4]

for 22.04 I used following command 1)ls /etc/apt/sources.list.d/ 2)sudo rm -r /etc/apt/sources.list.d/archive_uri-http_archive_canonical_com_-jammy.list then edit sources.list 3)nano /etc/apt/sources.list 4)paste the following at the end of list and save:

deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main 5)apt-get update

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Khalid Ali
Solution 2
Solution 3 Adrian Mole
Solution 4 nader ahmadvand