报错
(base) tayoadmin@Nvidia-GPU-Server:~$ sudo apt update
Get:1 https://mirrors.aliyun.com/ubuntu focal InRelease [265 kB]
Get:2 https://mirrors.aliyun.com/ubuntu focal-updates InRelease [128 kB]
Get:3 https://mirrors.aliyun.com/ubuntu focal-backports InRelease [128 kB]
Get:4 https://mirrors.aliyun.com/ubuntu focal-security InRelease [128 kB]
Err:1 https://mirrors.aliyun.com/ubuntu focal InRelease
Unknown error executing apt-key
Err:2 https://mirrors.aliyun.com/ubuntu focal-updates InRelease
Unknown error executing apt-key
Err:3 https://mirrors.aliyun.com/ubuntu focal-backports InRelease
Unknown error executing apt-key
Err:4 https://mirrors.aliyun.com/ubuntu focal-security InRelease
Unknown error executing apt-key
Reading package lists... Done
W: GPG error: https://mirrors.aliyun.com/ubuntu focal InRelease: Unknown error executing apt-key
E: The repository 'https://mirrors.aliyun.com/ubuntu focal InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: https://mirrors.aliyun.com/ubuntu focal-updates InRelease: Unknown error executing apt-key
E: The repository 'https://mirrors.aliyun.com/ubuntu focal-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: https://mirrors.aliyun.com/ubuntu focal-backports InRelease: Unknown error executing apt-key
E: The repository 'https://mirrors.aliyun.com/ubuntu focal-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: https://mirrors.aliyun.com/ubuntu focal-security InRelease: Unknown error executing apt-key
E: The repository 'https://mirrors.aliyun.com/ubuntu focal-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
(base) tayoadmin@Nvidia-GPU-Server:~$ ^C
解决办法:
步骤 1:导出系统密钥到标准位置
# 确保 keyring 文件存在
sudo cp /etc/apt/trusted.gpg /usr/share/keyrings/ubuntu-archive-keyring.gpg
步骤 2:修改软件源配置,使用 signed-by
sudo nano /etc/apt/sources.list
#将每一行源(如 https://mirrors.aliyun.com/ubuntu focal)修改为:
deb [signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg] https://mirrors.aliyun.com/ubuntu/ focal main restricted
deb [signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg] https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted
deb [signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg] https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted
deb [signed-by=/usr/share/keyrings/ubuntu-archive-keyring.gpg] https://mirrors.aliyun.com/ubuntu/ focal-security main restricted
步骤 3:清理缓存并更新
sudo apt clean
sudo rm -rf /var/lib/apt/lists/*
sudo apt update