1

Whenever I try to update, upgrade, or install anything I get the following error lines in response:

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

I'm still not super comfortable with linux but according to other posts, I have deleted and manually copy/pasted the sources.list but I can't find any information regarding files in the sources.list.d directory. Any help would be greatly appreciated.

1
  • 3
    The error message is pretty to the point: line 1 of /etc/apt/sources.list.d/raspi.list is not conforming to the pattern needed. If you posted it, we could tell you why.
    – Janka
    Oct 11, 2018 at 1:45

2 Answers 2

2

As indicated by the message in the error message the problem (probably) lies with the first line in the file /etc/apt/sources.list.d/raspi.list. The files under sources.list.d are intended for conveniently adding extra repositories to APT and are added to the ones listed in sources.list. You can think of them as "include" files for APT.

Check this particular file with the text editor, you'll need sudo but seeing as you've already been able to check and edit your sources.list I'll assume you know how to do this. The first line should be something along the lines of (based on what's on my Pi at least)

deb http://archive.raspberrypi.org/debian/ stretch main ui

Edit the line as required and close the editor and then try sudo apt-get update.

The Raspbian pages are a little outdated so I'm not sure, short of burning the latest image to an SD card and having a look, where to check on what the latest & greatest contents of the file is supposed to be but this should get you up and running.

0

This happens because something is wrong in the file /etc/apt/sources.list.d/raspi.list.

I solved this problem by removing this file. Safety First! Always keep a backup of the files you attempt to remove. So, the best way is to use mv command:

sudo mv /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list.d/raspi.list.bak
1
  • 3
    Just removing /etc/apt/sources.list.d/raspi.list is a very bad idea! It points to the Raspberry Pi kernel and driver repository. You will never get any updates and bug fixes for them. This may result in an unstable system by the time if other packets expect to have fixed kernel/drivers.
    – Ingo
    Mar 10, 2019 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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