Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nvidia drivers not working after Pop OS 22.04 update that resulted in installing kernel 5.17.5 instead of 5.16.19 #2369

Closed
bassemkaroui opened this issue May 5, 2022 · 19 comments

Comments

@bassemkaroui
Copy link

bassemkaroui commented May 5, 2022

Distribution (run cat /etc/os-release):

NAME="Pop!_OS"
VERSION="22.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 22.04 LTS"
VERSION_ID="22.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
LOGO=distributor-logo-pop-os

uname -r : 5.17.5-76051705-generic


I did an update to pop os today (sudo apt update) then upgrade (sudo apt upgrade). I got a notification telling me to reboot my pc to finish the upgrade, so I did.
After the reboot, my second screen wasn't working so I run nvidia-smi and I got the error NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
I tried sudo modprobe nvidia which resulted in this error modprobe: FATAL: Module nvidia not found in directory /lib/modules/5.17.5-76051705-generic which means there are no nvidia modules for kernel 5.17.5 and that grabbed my attention to the fact that the kernel was updated : it's 5.17.5 now instead of 5.16.19 that I had before the update.
For my laptop, I managed to reconfigure grub2 to use the previous kernel instead which has the proper modules and drivers but for my desktop, which uses efi, I don't have grub2 installed so I don't know how to revert to the previous kernel automatically.

Can someone tell me how to fix this ? What's the problem with the new kernel ? Why it doesn't have nvidia drivers ? What else doesn't work with this kernel ?

Thanks

@linuxgnuru
Copy link

See if reinstalling the Nvidia drivers might fix things as this also recreates the nvidia DKMS kernel modules. To do this please run the following:

sudo apt purge ~nnvidia
sudo apt install system76-driver-nvidia

@bassemkaroui
Copy link
Author

bassemkaroui commented May 5, 2022

See if reinstalling the Nvidia drivers might fix things as this also recreates the nvidia DKMS kernel modules. To do this please run the following:

sudo apt purge ~nnvidia
sudo apt install system76-driver-nvidia

@linuxgnuru this didn't work. I ended up using this command to revert to the previous kernel 5.16.19 :
sudo kernelstub -v -k /boot/vmlinuz-5.16.19-76051619-generic -i /boot/initrd.img-5.16.19-76051619-generic

@maz-dav
Copy link

maz-dav commented May 5, 2022

See if reinstalling the Nvidia drivers might fix things as this also recreates the nvidia DKMS kernel modules. To do this please run the following:

sudo apt purge ~nnvidia
sudo apt install system76-driver-nvidia

Hi, recently I've got similar issue (nvidia kernel module not loaded and my second monitor not work) after upgrading kernel to 5.17.5. so I decide to reinstall nvidia driver, like what @linuxgnuru says with some adjustment like in this article https://support.system76.com/articles/login-loop-pop/#reinstall-nvidia-driver

sudo apt purge ~nnvidia # I change this to `sudo apt purge '^nvidia-*'`
sudo apt autoremove
sudo apt clean
sudo apt update
sudo apt full-upgrade
sudo apt install system76-driver-nvidia
sudo systemctl reboot

now I can use my second monitor with 5.17.5 kernel and 510.68.02 nvidia driver 🚀

@adnub
Copy link

adnub commented May 5, 2022

I have the same issue. Saw the following happen in apt:

Building module:
cleaning build area...
unset ARCH; [ ! -h /usr/bin/cc ] && export CC=/usr/bin/gcc; env NV_VERBOSE=1 'make' -j12 NV_EXCLUDE_BUILD_MODULES='' KERNEL_UNAME=5.17.5-76051705-generic IGNORE_XEN_PRESENCE=1 IGNORE_CC_MISMATCH=1 SYSSRC=/lib/modules/5.17.5-76051705-generic/build LD=/usr/bin/ld.bfd modules.....(bad exit status: 2)
ERROR (dkms apport): kernel package linux-headers-5.17.5-76051705-generic is not supported
Error! Bad return status for module build on kernel: 5.17.5-76051705-generic (x86_64)
Consult /var/lib/dkms/nvidia/470.86/build/make.log for more information.
...done.

Not entirely sure what I can do to fix it on my end. For now I'm just booting the previous kernel version.

@leviport
Copy link
Member

leviport commented May 5, 2022

@adnub I believe you're experiencing pop-os/nvidia-graphics-drivers-470#5

@bassemkaroui
Copy link
Author

Hi, recently I've got similar issue (nvidia kernel module not loaded and my second monitor not work) after upgrading kernel to 5.17.5. so I decide to reinstall nvidia driver, like what @linuxgnuru says with some adjustment like in this article https://support.system76.com/articles/login-loop-pop/#reinstall-nvidia-driver

sudo apt purge ~nnvidia # I change this to `sudo apt purge '^nvidia-*'`
sudo apt autoremove
sudo apt clean
sudo apt update
sudo apt full-upgrade
sudo apt install system76-driver-nvidia
sudo systemctl reboot

now I can use my second monitor with 5.17.5 kernel and 510.68.02 nvidia driver rocket

@DSPdav this worked with the 5.17.5 kernel thanks :)

@irishgordo
Copy link

I've tentatively just boot back into 5.16.19-* - by just holding down 'spacebar' at boot, dropping into the old-kernel.conf.
the thinkpad workstation I have is currently using the 470.86 driver.
would there be just an upstream change that might be worth waiting for, hanging on 5.16.19-* for a while until then?

@leviport
Copy link
Member

leviport commented May 5, 2022

@irishgordo I believe you are experiencing pop-os/nvidia-graphics-drivers-470#5. It is a different issue from this one, but pop-os/nvidia-graphics-drivers-470#6 will probably fix it.

@bassemkaroui
Copy link
Author

@leviport my issue is exactly this one pop-os/nvidia-graphics-drivers-470#5, it's the driver 470 that doesn't work with kernel 5.17.5 so I wanted to revert back automatically to the 5.16.19 kernel but I didn't know how since I don't have GRUB2 on my EFI system. Using kernelstub solved my problem though so I'm closing this issue thanks everybody and thanks Pop OS for providing this simple tool 😄

@irishgordo
Copy link

awesome thanks for that! @leviport

@Linux-cpp-lisp
Copy link

Linux-cpp-lisp commented May 5, 2022

@DSPdav's fix also worked for me with no need to boot into the 5.16 kernel... the

sudo apt install system76-driver-nvidia

command pulled the 510 driver automatically.
(Thank you for the help— I didn't need to spend any more of my day trying to read my portrait mode monitor sideways 😄 )

@xandox
Copy link

xandox commented May 17, 2022

Hi all.
I still experiencing problems with installing nvidia 510 driver.
I tried the trick with purging all nvidia packages, cleaning and installing system64-driver-nvidia but it was not help. I attached make.log from nvidia-dkms package.

$ cat /etc/os-release
NAME="Pop!_OS"
VERSION="22.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 22.04 LTS"
VERSION_ID="22.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
LOGO=distributor-logo-pop-os
$ uname -r
5.17.5-76051705-generic
$ cc --version
cc (Ubuntu 9.4.0-5ubuntu1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

/var/lib/dkms/nvidia/510.68.02/build/make.log

UPDATE:
Switching cc to gcc-11 helps.

@jokober
Copy link

jokober commented Jul 6, 2022

Switching to gcc-11 did the trick for me as well. Thanks!

@cbacary
Copy link

cbacary commented Mar 8, 2023

Switching to gcc-11 did the trick for me as well. Thanks!

Hi, can you explain how you did this? Struggling with the same issue, any help would be appreciated! Thanks!

@vikassidana
Copy link

I also need the solution

@xandox
Copy link

xandox commented Apr 8, 2023

@cbacary @vikassidana chek your 'update-alternatives'

@jokober
Copy link

jokober commented Apr 8, 2023

You can follow those instructions but for gcc version 11.

https://linuxconfig.org/how-to-switch-between-multiple-gcc-and-g-compiler-versions-on-ubuntu-20-04-lts-focal-fossa

I am have the NVIDIA runfile installation on Pop!OS 22.04 and this week I had to install gcc version 12.

@PaulBenn-UnlikelyAI
Copy link

December 2023: for anyone still stuck on this, here's the full process that worked for me.

Building on suggestions from the posts above:

  1. Nuke everything nvidia related
    sudo apt purge ~nnvidia
    sudo apt autoremove
    sudo apt autoclean
  2. Upgrade everything (removing currently installed packages if necessary to upgrade the system as a whole)
    sudo apt update
    sudo apt full-upgrade
  3. Add GCC dependencies if you don't have them already
    sudo apt install build-essential software-properties-common
  4. Add repository containing all GCC versions
    sudo add-apt-repository ppa:ubuntu-toolchain-r/test
  5. Add as many versions of GCC as you want (version 13 worked for me)
    sudo apt install gcc-12 g++-12 gcc-13 g++-13 -y
  6. Update alternatives for gcc (the third argument after --install is just the priority)
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 11 --slave /usr/bin/g++ g++ /usr/bin/g++-11
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12 --slave /usr/bin/g++ g++ /usr/bin/g++-12
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13 --slave /usr/bin/g++ g++ /usr/bin/g++-13
  7. Alias cc to gcc
    sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
    sudo update-alternatives --set cc /usr/bin/gcc
  8. Alias c++ to g++
    sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
    sudo update-alternatives --set c++ /usr/bin/g++
  9. Configure gcc (and therefore cc, as its now aliased) to point to a newer version of GCC
    sudo update-alternatives --config gcc
  10. Re-install System76 NVIDIA driver (check for dpkg errors - hopefully there's none this time)
    sudo apt install system76-driver-nvidia
  11. Reboot - PopOS should boot into hybrid graphics automatically
    sudo reboot

@zertawz
Copy link

zertawz commented Aug 5, 2024

See if reinstalling the Nvidia drivers might fix things as this also recreates the nvidia DKMS kernel modules. To do this please run the following:

sudo apt purge ~nnvidia
sudo apt install system76-driver-nvidia

It worked for me, I booted in the recovery mode typed this and all went dark, a reboot and I was good.
The magic keys are usefull to be able to reboot properly in those cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests