如何在 Ubuntu 中转换 nvidia-container-toolkit.list

如何在 Ubuntu 中转换 nvidia-container-toolkit.list

原文nvidia-container-toolkit.list如下GitHub

https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list

deb https://nvidia.github.io/libnvidia-container/stable/deb/$(ARCH) /
#deb https://nvidia.github.io/libnvidia-container/experimental/deb/$(ARCH) /

以下是 Nvidia 的文档:

https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html

curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
  && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
    sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
    sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

我曾尝试手动添加“ signed-by”,然后将“ $(ARCH)”替换为“ amd64”或“ amd64”:

deb [signed-by=/usr/share/keyrings/nvidia.gpg] https://nvidia.github.io/libnvidia-container/stable/deb/amd64 /

or 

deb [signed-by=/usr/share/keyrings/nvidia.gpg] https://nvidia.github.io/libnvidia-container/stable/deb/ amd64 /

但“ apt-get update”失败并出现以下错误:

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

以下是echo $(ARCH)Ubuntu 中的:

# echo $(ARCH)
ARCH: command not found

“ ” 的正确形式是什么nvidia-container-toolkit.list

更新:

如果我没有替换$(ARCH),错误仍然相同。我认为原始nvidia文档是错误的。

更新 2:

该问题可能与“$(ARCH)”有关,那么 nvidia 中的 $(ARCH) 是什么?

答案1

他们的脚本有问题。我运行了上面的 curl 脚本,它确实生成了一个损坏的 sources.list 文件。所以我更正了它,现在它可以正常apt update工作了:

$ cat /etc/apt/sources.list.d/nvidia-container-toolkit.list
deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://nvidia.github.io/libnvidia-container/stable/deb/amd64 /
#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://nvidia.github.io/libnvidia-container/experimental/deb/amd64 /

相关内容