I was trying to run: sudo apt-get update
The response I received was:
E: Type 'sudo' is not known on line 1 in source list /etc/apt/sources.list
E: The list of sources could not be read.
My questions:
- What is sources.list?
- What happened?
- How do I repair/fix this? I have been using Ubuntu 20.04 and thought I would try upgrade to 22.04. I do not know that much about the inner workings of Ubuntu. I am past 60 and find it difficult to know the command line workings unless I can find it printed somewhere. I cannot remember seeing this anywhere. Can you help?
/etc/apt/sources.list
file contains a list of repositories (software sources) where software packages can be found. Entries found in/etc/apt/sources.list.d/
are added to those sources. Those are run when you runsudo apt update
which updates your system's list of software packages available from those sources. The upgrades of packages only occurs if yousudo apt upgrade
orsudo apt full-upgrade
. FYI: The/etc/apt/sources.list.d/
directory is empty on a clean install; so its only populated by files you add. https://help.ubuntu.com/community/Repositories/Ubuntu – guiverc Oct 11 '22 at 02:48sudo
(which isn't a valid entry in that file) ended up inside the file. You can see when it was last edited usingstat /etc/apt/sources.list
and its line 1 that contains that invalid info. Either that line needs correction, removal and then the rest of the file explore for error(s). Restoring default maybe easier. – guiverc Oct 11 '22 at 02:53