安装 NVIDIA Container Toolkit 时如何指定操作系统版本

安装 NVIDIA Container Toolkit 时如何指定操作系统版本

我正在尝试安装 NVIDIA Container Toolkit。设置存储库并指定 GPG 密钥的命令是:

distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
      && 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/$distribution/libnvidia-container.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

但是,我没有文件/etc/os-release。我期望它/etc/os-release旨在提供有关我的操作系统(即 Ubuntu 20.04)的信息。我确实有两个文件,它们似乎具有相似的意图,但不可执行:/usr/lib/os-release/etc/debian文件。

其内容/usr/lib/os-release 为:

$ cat /usr/lib/os-release
NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

其内容/etc/debian_version为:

$ cat /etc/debian_version 
bullseye/sid

最后,如果我执行lsb_release -a,我会得到:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:    20.04
Codename:   focal

那么我需要用什么来代替

distribution=$(. /etc/os-release;echo $ID$VERSION_ID)

相关内容