当试图在我的20.04 LTS主机上安装nvidia专有驱动程序时,我遇到了一个在使用DKMS时它不会安装的问题。它抱怨gcc的内核版本(9.3.0)和gcc版本(9.4.0)之间的错误。问题发生在升级到最新的内核版本之后。在运行gcc版本时,它报告了9.4.0,而apt显示gcc报告了9.3.0。
gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
apt show gcc
Package: gcc
Version: 4:9.3.0-1ubuntu2
lsb_release -a
LSB Version: core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
uname -a
Linux xenon 5.4.0-104-generic #118-Ubuntu SMP Wed Mar 2 19:02:41 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
在我看来,问题似乎是gcc的包是9.3.0,如apt所示,但报告9.4.0。
有什么建议吗?
正如在一篇评论中所说,我看不到老gcc的版本。我的sources.list文件可能是问题所在吗?看起来是这样的:
###### Ubuntu Main Repos
deb http://archive.ubuntu.com/ubuntu/ focal main restricted multiverse universe
deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted multiverse universe
###### Ubuntu Update Repos
deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted multiverse universe
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted multiverse universe
deb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted multiverse universe
deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted multiverse universe
发布于 2022-03-11 23:16:45
我能够通过暂时将gcc降级到9.3来绕过这个问题,然后我可以编译nVidia驱动程序:
使用智能,我降级,然后持有g++-9,它会自动保存它的相关包。如果你喜欢的话,你也可以使用“apt-标记保持”。
下面是在我的系统中暂时保持状态的包:
[HOLD, DEPENDENCIES] cpp-9:amd64 9.3.0-10ubuntu2
[HOLD, DEPENDENCIES] g++-9:amd64 9.3.0-10ubuntu2
[HOLD, DEPENDENCIES] gcc-9:amd64 9.3.0-10ubuntu2
[HOLD, DEPENDENCIES] gcc-9-base:amd64 9.3.0-10ubuntu2
[HOLD, DEPENDENCIES] libasan5:amd64 9.3.0-10ubuntu2
[HOLD, DEPENDENCIES] libgcc-9-dev:amd64 9.3.0-10ubuntu2
[HOLD, DEPENDENCIES] libstdc++-9-dev:amd64 9.3.0-10ubuntu2
一旦用gcc 9.4编译了系统的新内核(即使用:
cat /proc/version
检查)或者当您不再需要重新编译nVidia驱动程序时,您应该能够释放已保存的9.4GCC升级,并将它们安装在您的系统上。
编辑:根据您的请求,这里有一个/etc/apt/ request。列表可以使用:
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ focal main restricted
deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ focal universe
deb-src http://archive.ubuntu.com/ubuntu/ focal universe
deb http://archive.ubuntu.com/ubuntu/ focal-updates universe
deb-src http://archive.ubuntu.com/ubuntu/ focal-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu/ focal multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu focal-security main restricted
deb-src http://security.ubuntu.com/ubuntu focal-security main restricted
deb http://security.ubuntu.com/ubuntu focal-security universe
deb-src http://security.ubuntu.com/ubuntu focal-security universe
deb http://security.ubuntu.com/ubuntu focal-security multiverse
deb-src http://security.ubuntu.com/ubuntu focal-security multiverse
请试一试。网站上有手册和教程。
https://askubuntu.com/questions/1396629
复制相似问题