Ubuntu安装了nvidia的驱动之后,尝试用命令行执行apt操作报错:
Reading package lists... Done
W: GPG error: file:/var/nvidia-driver-local-repo-ubuntu2204-535.129.03 InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4AB56286D8A8E7A3
E: The repository 'file:/var/nvidia-driver-local-repo-ubuntu2204-535.129.03 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.
解决方法
卸载驱动
dpkg -l | grep -i nvidia
# 查看相关已经安装的列表,找到个 local-repo的,卸载了
apt remove nvidia-driver-local-repo-ubuntu2204-535.129.03
去nvidia网站下载离线安装包:
手动安装:
dpkg -i nvidia-driver-local-repo-ubuntu2204-535.129.03_1.0-1_amd64.deb
Selecting previously unselected package nvidia-driver-local-repo-ubuntu2204-535.129.03.
(Reading database ... 212901 files and directories currently installed.)
Preparing to unpack nvidia-driver-local-repo-ubuntu2204-535.129.03_1.0-1_amd64.deb ...
Unpacking nvidia-driver-local-repo-ubuntu2204-535.129.03 (1.0-1) ...
Setting up nvidia-driver-local-repo-ubuntu2204-535.129.03 (1.0-1) ...
The public nvidia-driver-local-repo-ubuntu2204-535.129.03 GPG key does not appear to be installed.
To install the key, run this command:
sudo cp /var/nvidia-driver-local-repo-ubuntu2204-535.129.03/nvidia-driver-local-D8A8E7A3-keyring.gpg /usr/share/keyrings/
安装好,他会提示你安装证书,就是那个cp命令。
执行证书安装:
sudo cp /var/nvidia-driver-local-repo-ubuntu2204-535.129.03/nvidia-driver-local-D8A8E7A3-keyring.gpg /usr/share/keyrings/