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:

  1. What is sources.list?
  2. What happened?
  3. 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?
  • 1
    The /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 run sudo apt update which updates your system's list of software packages available from those sources. The upgrades of packages only occurs if you sudo apt upgrade or sudo 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. help.ubuntu.com/community/Repositories/Ubuntu
    – guiverc
    Commented Oct 11, 2022 at 2:48
  • That line will have been edited, or added by yourself, where something went wrong and the command sudo (which isn't a valid entry in that file) ended up inside the file. You can see when it was last edited using stat /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
    Commented Oct 11, 2022 at 2:53


Browse other questions tagged .