[SOLVED] How to proceed with updating Fedora 42 when I have conflicting packages related to nvidia drivers?

When I run sudo dnf update it shows that these packages have conflicts

Skipping packages with conflicts:
 nvidia-driver                                                                                                                x86_64                   3:590.44.01-1.fc42                                                                                                             cuda-fedora42-x86_64                                                       18.2 MiB
 nvidia-modprobe                                                                                                              x86_64                   3:590.44.01-1.fc42                                                                                                             cuda-fedora42-x86_64                                                       54.8 KiB
 nvidia-persistenced                                                                                                          x86_64                   3:580.95.05-1.fc42                                                                                                             cuda-fedora42-x86_64                                                       58.1 KiB
 nvidia-persistenced                                                                                                          x86_64                   3:590.44.01-1.fc42                                                                                                             cuda-fedora42-x86_64                                                       58.1 KiB
 nvidia-persistenced                                                                                                          x86_64                   3:580.95.05-1.fc42                                                                                                             rpmfusion-nonfree-updates                                                  54.4 KiB
 nvidia-persistenced                                                                                                          x86_64                   3:570.133.07-1.fc42                                                                                                            rpmfusion-nonfree                                                          54.4 KiB
Skipping packages with broken dependencies:
 nvidia-settings                                                                                                              x86_64                   3:590.44.01-1.fc42                                                                                                             cuda-fedora42-x86_64                                                        1.7 MiB
 xorg-x11-drv-nvidia-cuda                                                                                                     x86_64                   3:580.105.08-1.fc42                                                                                                            rpmfusion-nonfree-nvidia-driver                                             6.3 MiB
 xorg-x11-drv-nvidia-cuda                                                                                                     x86_64                   3:580.95.05-1.fc42                                                                                                             rpmfusion-nonfree-updates                                                   6.3 MiB
 xorg-x11-drv-nvidia-cuda                                                                                                     x86_64                   3:570.133.07-1.fc42                                                                                                            rpmfusion-nonfree                                                           6.2 MiB

Transaction Summary:
 Installing:         6 packages
 Upgrading:        232 packages
 Replacing:        232 packages
 Skipping:          10 packages

Total size of inbound packages is 1 GiB. Need to download 0 B.
After this operation, 285 MiB extra will be used (install 3 GiB, remove 3 GiB).
Is this ok [y/N]:

but when I proceed with the update by typing y I get

Running transaction
Transaction failed: Rpm transaction failed.
  - file /usr/lib64/libnvidia-cfg.so.1 from install of libnvidia-cfg-3:590.44.01-1.fc42.x86_64 conflicts with file from package xorg-x11-drv-nvidia-libs-3:580.105.08-1.fc42.x86_64

It seems that for some reason my Fedora install contains both 580 and 590 nvidia drivers and currently, based on Nvidia X Server Setttings, the 580 driver is being used.

So, how to update my Fedora 42 without breaking the system? Is it safe to remove the 590 nvidia drivers?

UPDATE: I did remove nvidia drivers using dnf remove xorg-x11-drv-nvidia\* and I did a successful update using dnf update. Then I tried reinstalling the drivers with sudo dnf install akmod-nvidia and now the drivers are simply not working. The version returned by running modinfo -F version nvidia is 590.44.01 but it seems the drivers are not active, i.e the screen resolution is bad and I don’t see Nvidia X server.

UPDATE

I finally solved this issue. The culprit was that I had packages installed from the repository cuda-fedora42 I added this repository when installing cuda.

The solution was this:

Uninstall nvidia drivers: dnf remove xorg-x11-drv-nvidia\*

Swap nvidia-XNVCtrl libXNVCtril: sudo dnf swap nvidia-XNVCtrl libXNVCtril probably the installation of cuda swapped those previously, chromium browser is dependent on either of those, so do this before the next step.

Remove everything nvidia except firmware: sudo dnf remove \*nvidia\* –exclude=nvidia-gpu-firmware

Update the system sudo dnf update

Reinstall the nvidia drivers

sudo dnf install akmod-nvidia

That’s it.

I am glad you found the problem.

Many users have problems when they enable the cuda-fedoraXX repos.

I always suggest that they install only from the rpmfusion repo and enable cuda from the same source.
The rpmfusion how-to tells how to do that, and it only involves installing 2 packages.
sudo dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda