1
The following packages have unmet dependencies:
 libcuinj64-11.5 : Depends: libnvidia-compute-495 (>= 495) but it is not going to be installed or
                            libnvidia-compute-495-server (>= 495) but it is not installable or
                            libcuda.so.1 (>= 495) or
                            libcuda-11.5-1
 libnvidia-ml-dev : Depends: libnvidia-compute-495 (>= 495) but it is not going to be installed or
                             libnvidia-compute-495-server (>= 495) but it is not installable or
                             libnvidia-ml.so.1 (>= 495)
 nvidia-cuda-dev : Depends: libnvidia-compute-495 (>= 495) but it is not going to be installed or
                            libnvidia-compute-495-server (>= 495) but it is not installable or
                            libcuda.so.1 (>= 495) or
                            libcuda-11.5-1
                   Recommends: libnvcuvid1 but it is not installable
E: Unable to correct problems, you have held broken packages.
Artur Meinild
  • 26,018
Kaloso
  • 11

1 Answers1

2

The problem arised at my side after upgrading to nvidia-driver-535 from the nvidia repository. I do not know if it is needed, but in this process I also got rid of dpkg --remove-architecture i386 first. So the process was:

WARNING! USE YOUR BRAIN!

If your system happens to be i386 following will kill your system.

apt-get --allow-remove-essential  purge ".*:i386"
dpkg --remove-architecture i386

Then disable NVidia-Repositories (YMMV):

cd /etc/apt/sources.list.d
mv cuda-ubuntu2204-x86_64.list cuda-ubuntu2204-x86_64.list.disabled
apt update
cat cuda-ubuntu2204-x86_64.list.disabled
deb [signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] http://HTTPS///developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /

http://HTTPS/// is there because I use apt-cacher-ng extensively. This way apt-cacher-ng is able to access the repositories via HTTPS

Then purge every trace of 535 drivers and NVidia-Things:

WARNING! USE YOUR BRAIN!

Only purge what's not needed. Purging also removes configuration which might stay in the way. Or might contain valuable information.

Note that I did this over ssh from another computer, because this probably brings down X11 as well on the machine:

dpkg --get-selections | grep 535
dpkg --get-selections | grep nvidia

gives

apt purge WHATEVER..

Then I cleaned remainders which were not in the repository anymore

apt-show-versions | grep -v '/jammy' 

For example

apt purge libxnvctrl0

Then I re-installed everything from the Ubuntu repository again:

apt install nvidia-driver-535 nvidia-cuda-toolkit nvidia-settings

Note that you probably need to install xserver-xorg-video-nvidia-535, too. I do not need it, the machine is a headless GPU server for pytorch.

Then reboot, and voila:

# nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Thu_Nov_18_09:45:30_PST_2021
Cuda compilation tools, release 11.5, V11.5.119
Build cuda_11.5.r11.5/compiler.30672275_0
# nvidia-smi 
Mon Sep 11 20:20:20 2023       
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.86.05              Driver Version: 535.86.05    CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 4090        Off | 00000000:01:00.0 Off |                  Off |
|  0%   40C    P8               6W / 450W |      3MiB / 24564MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=======================================================================================| | No running processes found | +---------------------------------------------------------------------------------------+

Final notes:

My systems are highly automated. For example snap, dkms, initrd etc. are all done by configuration management scripts, such that I do not need to think of things like this myself. Perhaps you need some additional steps for updating initrd or dkms before reboot, but I think this is all handled by apt the right way. (But I cannot be sure.)

Tino
  • 720
  • 1
  • 7
  • 16