如何修复“E:源列表 /etc/apt/sources.list.d/docker.list (type) 中的第 1 行格式错误”?

如何修复“E:源列表 /etc/apt/sources.list.d/docker.list (type) 中的第 1 行格式错误”?

我在终端中看到以下错误:

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

我已经尝试编辑我的sources.list文件,但错误仍然相同。

答案1

除了中央 之外/etc/apt/sources.list,还有一个目录可以包含带有源的单个文件。此目录是/etc/apt/sources.list.d/。这种设置类型(一个中央配置文件加上一个包含单个较小文件的目录)非常常见。

在您的情况下,格式错误的行不在中央sources.list,而是在中的一个文件中sources.list.d,即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.

更一般地讲,完整阅读错误信息通常是一个好主意。在许多情况下,它们会逐字逐句地说明问题所在。

相关内容