安装 linux-image-5.4.0-96-generic 时 nvidia 模块失败

安装 linux-image-5.4.0-96-generic 时 nvidia 模块失败

安装最新内核后,我的系统无法再启动 nvidia 守护进程。仔细检查后发现缺少以下 NVIDIA 模块linux-image-5.4.0-96-generic

sudo apt-get install --reinstall linux-image-generic linux-image-5.4.0-96-generic linux-headers-5.4.0-96-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  android-studio-4.1 cuda-command-line-tools-10-2 cuda-compiler-10-2 cuda-cudart-10-2 cuda-cudart-dev-10-2 cuda-cufft-10-2 cuda-cufft-dev-10-2 cuda-cupti-10-2 cuda-cupti-dev-10-2 cuda-curand-10-2
  cuda-curand-dev-10-2 cuda-cusolver-10-2 cuda-cusolver-dev-10-2 cuda-cusparse-10-2 cuda-cusparse-dev-10-2 cuda-documentation-10-2 cuda-driver-dev-10-2 cuda-libraries-10-2 cuda-libraries-dev-10-2
  cuda-memcheck-10-2 cuda-misc-headers-10-2 cuda-npp-10-2 cuda-npp-dev-10-2 cuda-nsight-10-2 cuda-nsight-compute-10-2 cuda-nsight-systems-10-2 cuda-nvcc-10-2 cuda-nvgraph-10-2 cuda-nvgraph-dev-10-2
  cuda-nvjpeg-10-2 cuda-nvjpeg-dev-10-2 cuda-nvml-dev-10-2 cuda-nvprof-10-2 cuda-nvprune-10-2 cuda-nvrtc-10-2 cuda-nvrtc-dev-10-2 cuda-nvtx-10-2 cuda-nvvp-10-2 cuda-samples-10-2 cuda-sanitizer-api-10-2
  cuda-toolkit-10-2 cuda-tools-10-2 cuda-visual-tools-10-2 golang-1.15-go golang-1.15-src golang-1.16-go golang-1.16-src lib32gcc1 libcublas-dev libcublas10 libllvm10:i386 libllvm11 libllvm11:i386
  libmysofa0 libplacebo18 libuv1-dev libxdamage1:i386 nsight-compute-2019.5.0 nsight-systems-2019.5.2 nvidia-modprobe shim
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 3 reinstalled, 0 to remove and 2 not upgraded.
Need to get 0 B/11.9 MB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 438750 files and directories currently installed.)
Preparing to unpack .../linux-headers-5.4.0-96-generic_5.4.0-96.109_amd64.deb ...
Unpacking linux-headers-5.4.0-96-generic (5.4.0-96.109) over (5.4.0-96.109) ...
Preparing to unpack .../linux-image-5.4.0-96-generic_5.4.0-96.109_amd64.deb ...
Unpacking linux-image-5.4.0-96-generic (5.4.0-96.109) over (5.4.0-96.109) ...
Preparing to unpack .../linux-image-generic_5.4.0.96.100_amd64.deb ...
Unpacking linux-image-generic (5.4.0.96.100) over (5.4.0.96.100) ...
Setting up linux-headers-5.4.0-96-generic (5.4.0-96.109) ...
/etc/kernel/header_postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.4.0-96-generic
   ...done.
Setting up linux-image-5.4.0-96-generic (5.4.0-96.109) ...
depmod: ERROR: failed to load symbols from /lib/modules/5.4.0-96-generic/updates/dkms/nvidia-modeset.ko: Invalid argument
depmod: ERROR: failed to load symbols from /lib/modules/5.4.0-96-generic/updates/dkms/nvidia-drm.ko: Invalid argument
depmod: ERROR: failed to load symbols from /lib/modules/5.4.0-96-generic/updates/dkms/nvidia-uvm.ko: Invalid argument
depmod: ERROR: failed to load symbols from /lib/modules/5.4.0-96-generic/updates/dkms/nvidia.ko: Invalid argument
Setting up linux-image-generic (5.4.0.96.100) ...
Processing triggers for linux-image-5.4.0-96-generic (5.4.0-96.109) ...
/etc/kernel/postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.4.0-96-generic
   ...done.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.4.0-96-generic
modinfo: ERROR: could not get modinfo from 'nvidia': Invalid argument
modinfo: ERROR: could not get modinfo from 'nvidia_drm': Invalid argument
modinfo: ERROR: could not get modinfo from 'nvidia_modeset': Invalid argument
modinfo: ERROR: could not get modinfo from 'nvidia_uvm': Invalid argument
depmod: ERROR: failed to load symbols from /var/tmp/mkinitramfs_cIT7Rf/lib/modules/5.4.0-96-generic/updates/dkms/nvidia-modeset.ko: Invalid argument
depmod: ERROR: failed to load symbols from /var/tmp/mkinitramfs_cIT7Rf/lib/modules/5.4.0-96-generic/updates/dkms/nvidia-drm.ko: Invalid argument
depmod: ERROR: failed to load symbols from /var/tmp/mkinitramfs_cIT7Rf/lib/modules/5.4.0-96-generic/updates/dkms/nvidia-uvm.ko: Invalid argument
depmod: ERROR: failed to load symbols from /var/tmp/mkinitramfs_cIT7Rf/lib/modules/5.4.0-96-generic/updates/dkms/nvidia.ko: Invalid argument
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-1061-oracle
Found initrd image: /boot/initrd.img-5.4.0-1061-oracle
Found linux image: /boot/vmlinuz-5.4.0-96-generic
Found initrd image: /boot/initrd.img-5.4.0-96-generic
Found linux image: /boot/vmlinuz-5.4.0-94-generic
Found initrd image: /boot/initrd.img-5.4.0-94-generic
Adding boot menu entry for UEFI Firmware Settings
done

为了解决这个问题,我目前只运行 5.4.0-94-generic。还有其他人遇到这个问题吗?我应该等待下一次更新吗?

每条评论均有附加信息

  • 我正在运行 Ubuntu 20.04.3。
  • sudo apt-get update并且sudo apt-get upgrade都是最新的。
  • 我安装的最新 NVIDIA 驱动程序是nvidia-driver-495

答案1

嗯... 似乎您的dkmsNVIDIA 文件已损坏。请尝试以下步骤:

  1. 删除dkmsNVIDIA 的文件。

    sudo rm -r /var/lib/dkms/nvidia
    
  2. 重新安装dkms重新生成文件:

    sudo apt install --reinstall dkms
    
  3. 清除 Nvidia 驱动程序:

    sudo apt purge nvidia-*
    
  4. 现在,使用以下命令重新安装推荐的驱动程序:

    sudo ubuntu-drivers autoinstall 
    

上述操作将重新生成您的dkms.conf文件。


  1. 重新安装内核包:

    sudo apt update
    sudo apt-get install --reinstall linux-image-generic linux-image-5.4.0-96-generic linux-headers-5.4.0-96-generic linux-generic
    
  2. 更新 Grub:

    sudo update-grub
    
  3. 更新 Initramfs:

    sudo update-initramfs -u
    

就这样!
祝你好运!

相关内容