如何解决“E:WSL Ubuntu中的列表文件”“中的条目1格式错误?列表文件正确

mgdq6dx1  于 2022-12-11  发布在  其他
关注(0)|答案(1)|浏览(184)

I just followed the Atlas CLI installation instructions on MongoDB's website here down to this part:

  1. Create the list file /etc/apt/sources.list.d/mongodb-org-6.0.list for your version of Ubuntu. Replace 6.0 with your edition of MongoDB.
  2. echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu/dists/bionic/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
    There is a resulting file at /etc/apt/sources.list.d/ , and inside, it only has:
deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu/dists/bionic/mongodb-org/6.0 multiverse

But when I run sudo apt-get update , it says:

E: Malformed entry 1 in list file /etc/apt/sources.list.d/mongodb-org-6.0.list (Component)
E: The list of sources could not be read.

I technically have version 6.3, but there is nothing there if I go to that URL in my browser. Nevertheless, I've separately tried:

  • changing the filename and contents to 6.3 instead of 6.0
  • removing the [ arch=amd64,arm64 ] or multiverse bit just to narrow down the issue
  • recopying and pasting the part in quotes directly into the file from the website
  • deleting-recreating the file
  • updating to the latest Ubuntu version?!

The error doesn't change with any of this. When I copy-paste the LIST file URL into my browser, it goes to the right place, so it has to be correct.
I do not know if this is connected to WSL, which causes all sorts of mysterious issues. Please help!

pdkcd3nj

pdkcd3nj1#

我也遇到了同样的问题。查看我的Ubuntu版本(与您的版本不同,我的版本是v20.04)的/etc/apt/sources.list.d/mongodb-org-6.0.list文件的内容,显示如下:

deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/6.0 multiverse

然而,这似乎缺少了一个参数。我之前安装了MongoDB v5. 0,当时的内容如下:

deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse

通过比较这两个版本,我决定手动更改6.0安装的代码行,使其格式与5.0相同:

deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse

这对我的Ubuntu 20.04安装很有效。我相信你在安装仿生海狸(18.04)(在我看来,这是有史以来最好的操作系统动物名称)时也面临着同样的情况。
在您的情况下,您具有以下内容:

deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu/dists/bionic/mongodb-org/6.0 multiverse

我相信--尽管我可能错了--它应该是这样的:

deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/6.0 multiverse

或者,运行我认为应该在MongoDB站点上运行的Bionic Beaver的完整命令可能会更容易:

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list

接下来,尝试另一个“sudo apt更新”。我希望那能起作用!

相关问题