Linux · 2024年4月13日 0

Solution for Unable to Enter GUI After Ubuntu Update

After updating the system, I encountered an issue with Ubuntu 22.04 where the graphical interface could not be accessed. Upon booting, there was a black screen, white screen, flashing underscore, or a loop of login prompts. The error message “Failed to start NVIDIA Persistence Daemon” appeared based on the boot display, but it was possible to log in normally to the command-line interface.

Issue Identification

Initially, I attempted to use the command “nvidia-smi” to view NVIDIA graphics card information but encountered the following error:

Failed to initialize NVML: Driver/library version mismatch

According to the prompt, there was a mismatch between the kernel module and driver module versions of the graphics card, indicating a need to confirm their respective versions.

Checking Kernel Version

$ cat /proc/driver/nvidia/version

NVRM version: NVIDIA UNIX x86_64 Kernel Module 545.29.06 Thu Nov 16 01:59:08 UTC 2023
GCC version: gcc version 12.3.0 (Ubuntu 12.3.0-1ubuntu1~22.04)

Checking Driver Version

$ modinfo nvidia

……
version:        535.171.04
……

It was discovered that the driver version was 535 while the kernel version was 545, which was the cause of the problem.

Solution

I decided to upgrade the NVIDIA driver to match the kernel version, which was 545.

Firstly, uninstall the original graphics card driver:

sudo apt autoremove --purge nvidia-* 

Next, check all available graphics card drivers:

$ sudo ubuntu-drivers devices

driver   : nvidia-driver-450-server - distro non-free
driver   : nvidia-driver-470 - distro non-free
driver   : nvidia-driver-550 - third-party non-free
driver   : nvidia-driver-470-server - distro non-free
driver   : nvidia-driver-535-server - distro non-free
driver   : nvidia-driver-418-server - distro non-free
driver   : nvidia-driver-535 - distro non-free recommended
driver   : xserver-xorg-video-nouveau - distro free builtin

If the target version of the driver is listed here, it can be installed directly. If not, it’s necessary to add the NVIDIA graphics card driver PPA source:

sudo add-apt-respository ppa:graphics-drivers && sudo apt update

Then recheck all available graphics card drivers. If the 545 version “nvidia-driver-545” appears, install it using the apt command: (nvidia-driver-??? depends on your version)

sudo apt install nvidia-driver-545 nvidia-settings nvidia-prime

心情表态
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0