Score:1

Why does my 20.04 Ubuntu installation load CUDA for 18.04?

ar flag

I recently managed to muck up my CUDA installation beyond my meager ability to repair. So, I decided to purge and reinstall: I followed these steps:

apt clean; apt update; apt purge cuda; apt purge nvidia-*; apt autoremove; apt install cuda

I rebooted, and found things now seem to be working as expected:

$ nvidia-smi
Sat Nov 19 09:08:40 2022       
+---------------------------------------------+
| NVIDIA-SMI 520.61.05    Driver Version: 520.61.05    CUDA Version: 11.8     |
|-------------------------------+----------------------+----------------------+
| 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 ...  On   | 00000000:02:00.0  On |                  N/A |
| 59%   44C    P8    21W / 370W |    236MiB / 12288MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+---------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1720      G   /usr/lib/xorg/Xorg                 35MiB |
|    0   N/A  N/A      2667      G   /usr/lib/xorg/Xorg                 69MiB |
|    0   N/A  N/A      2796      G   /usr/bin/gnome-shell               92MiB |
|    0   N/A  N/A      3154      G   ...AAAAAAAA== --shared-files       23MiB |
+---------------------------------------------+
(base) $ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:33:58_PDT_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0

However, when I try sudo apt-get update I see the following result:

$ sudo apt-get update
[sudo] password : 
Hit:1 https://nvidia.github.io/libnvidia-container/experimental/ubuntu18.04/amd64  InRelease

But, I'm runing Ubuntu 20.04:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.5 LTS
Release:    20.04
Codename:   focal

Why does my 20.04 version of Ubuntu reach for the CUDA matched with Ubuntu 18.04? Should I worry about this?

================== Later Discovery =========================

I found this line in my /etc/apt/sources.list.d/nvidia-container-toolkit.list file:

deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://nvidia.github.io/libnvidia-container/experimental/ubuntu18.04/$(ARCH) /

I assume this is the source of my problem. Should I:

  1. Hand edit the 18.04 to 20.04 and hope for the best (doubtful)
  2. Repeat my nvidia purge, remove the nvidia-container-toolkit.list file and reinstall following NVIDIA's instructions and not Ubuntu's prepared apt packages (probably the best, unless I screw something up)
  3. Live with my current situation, since it's unlikely anything will really go wrong
  4. Do something else
Score:3
cn flag

Have you installed cuda on 20.04 using instructions from 18.04? It looks like your apt sources point to repository for 18.04. Using instructions linked below you can investigate your apt sources (/etc/apt/sources.list... and /etc/apt/sources.list.d/...)

https://nvidia.github.io/libnvidia-container/ (just note that in here they add another repository to the system - simply try to remove packages, then remove repository, and THEN find an OFFICIAL guide on how to properly install CUDA for your version of system)

Personally I recommend yeeting the apt installation of cuda if you want to reliably use your GPU (for me steam didn't want to launch when cuda was installed) and use the docker container with cuda: https://hub.docker.com/r/nvidia/cuda


Replying to the comment: I would purge all of nvidia's cuda almost like you did before (just watch out for purging nvidia-*, because you may uninstall your drivers? You will probably have to switch install them again and go back to nvidia from noveau after that), then simply remove the file from the /etc/apt/sources.list.d/. Maybe also remove the gpg key from keyring, but I'm not knowledgable enough to instruct you on that (because the formats changed from 18, the common keyring, to 20 - separate keyrings yada yada).

For what to do: You could go with option No. 2. but I STRONGLY recommend using docker for that, because the amount of work you will have with the barebones installation is unproportionally larger than the amount of time you will have to invest into learning and setting up docker. Also, docker image can be removed with one simple command, while cuda package... as you can see... involves a lot of work :D

What problems I had with my package cuda installation:

  • steam not working (and other programs depending on libraries, that get confused by system with cudas)
  • cuda breaking when drivers update
  • mess in the global scope
  • config files all over the system

Also one hint - apt-get is an old way of doing things, nowadays we use apt like sudo apt update.

user1245262 avatar
ar flag
I now see where I'm pointing to 18.04. I don't know what I did to put it there. I've a,ended my original question to reflect this and list my options, as I see them. I have to admit I've only yesterday started working my way thru Docker tutorials, so am not comfortable relying so heavily upon it so soon. If you have any further thoughts, I'd really appreciate them.Thx.
user1245262 avatar
ar flag
Thx.... I think I'll go thru some more Docker tutorials before relying upon it. Right now, I think of Docker as a really well contained environment. I'm afraid if I use Docker for CUDA I'll either end up with something that's really bloated, or I'll be cobbling together all sorts of images each time I start a new project (though maybe I'm already doing that with conda....)
Score:1
cn flag

https://nvidia.github.io is not an Ubuntu source and you added a github source pointing to 18.04 yourself.

When you open that link it shows:

Unsupported distribution! # Check https://nvidia.github.io/libnvidia-container

That link has instructions on installing for 20.04 and 20.94.

user1245262 avatar
ar flag
I now see where I'm pointing to 18.04. I don't know what I did to put it there. I've a,ended my original question to reflect this and list my options, as I see them. If you have any further thoughts, I'd really appreciate them. Thx.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.