2

Ubuntu version: 18.04 Apt version: 1.6.13

I attempted to install a different cuda toolkit, and in doing so may have irrevocably broken apt. I believe the problem has nothing to do with cuda however, and that apt is at fault here.

If I run sudo apt-get install *anything* (or apt remove or apt purge) I get the error:

Reading package lists... Done Building dependency tree Reading state information... Done cuda is already the newest version (11.2.2-1). You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies. cuda-drivers-460 : Depends: libnvidia-common-460 (>= 460.32.03) but it is not going to be installed libnvidia-gl-460 : Depends: libnvidia-common-460 but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

so I try sudo apt --fix-broken install:

Get:1 file:/var/cuda-repo-ubuntu1804-11-2-local libnvidia-common-460 460.32.03-0ubuntu1 [10.2 kB] Err:1 file:/var/cuda-repo-ubuntu1804-11-2-local libnvidia-common-460 460.32.03-0ubuntu1 File not found - /var/cuda-repo-ubuntu1804-11-2-local/./libnvidia-common-460_460.32.03-0ubuntu1_all.deb (2: No such file or directory) E: Failed to fetch file:/var/cuda-repo-ubuntu1804-11-2-local/./libnvidia-common-460_460.32.03-0ubuntu1_all.deb File not found - /var/cuda-repo-ubuntu1804-11-2-local/./libnvidia-common-460_460.32.03-0ubuntu1_all.deb (2: No such file or directory) E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

indeed /var/cuda-repo-ubuntu1804-11-2-local does not exist, let alone the files within.

Running sudo apt-get update yields:

E: The repository 'file:/var/cuda-repo-10-1-local-10.1.105-418.39 Release' no longer has a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'file:/var/cuda-repo-ubuntu1804-11-2-local Release' no longer has a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.

which again probably stems from not having /var/cuda-repo-ubuntu1804-11-2-local (or /var/cuda-repo-10-1-local-10.1.105-418.39)

following the advice from https://forums.linuxmint.com/viewtopic.php?t=281922 I have also tried: sudo su for FILE in $(dpkg-divert --list | grep nvidia-440 | awk '{print $3}'); do dpkg-divert --remove $FILE; done exit

but entering the line beginning for FILE... does nothing (nor does replacing nvidia-440 with 450 or 460)

I am using apt version 1.6.13 which I have tried reinstalling by running sudo dpkg -i apt_1.6.13_amd64.deb (downloaded from http://archive.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.6.13_amd64.deb ) but I still get the same errors when running anything above

any suggestions would be greatly appreciated - I would really like to avoid having to reinstall ubuntu.

w1nter
  • 221

2 Answers2

10

This is as much a reply to @ubfan1 than anything, but the problem was I was unable to start afresh / remove any lingering cuda on my system. The answer in How do I install NVIDIA and CUDA drivers into Ubuntu?

provided the magic: sudo rm /etc/apt/sources.list.d/cuda* which then allowed me to run update followed by fix-broken install

w1nter
  • 221
0

I found that sudo rm /etc/apt/sources.list.d/cuda-ubuntu2004-11-7-local.list fixed the sudo apt update noise for me (while not deleting the other cuda* files as in w1nter's answer). Here's the transcript:

(torch) sharker@persephone:~$ sudo apt update
[sudo] password for sharker: 
Get:1 file:/var/cuda-repo-ubuntu2004-11-7-local  InRelease
Ign:1 file:/var/cuda-repo-ubuntu2004-11-7-local  InRelease
Get:2 file:/var/cuda-repo-ubuntu2004-11-7-local  Release
Err:2 file:/var/cuda-repo-ubuntu2004-11-7-local  Release
  File not found - /var/cuda-repo-ubuntu2004-11-7-local/Release (2: No such file or directory)
Hit:4 http://us.archive.ubuntu.com/ubuntu focal InRelease                      
Get:5 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]      
Get:6 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]     
Hit:7 http://dl.google.com/linux/chrome/deb stable InRelease                   
Ign:9 http://linux.dropbox.com/ubuntu disco InRelease                          
Hit:10 http://linux.dropbox.com/ubuntu disco Release                           
Hit:11 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  InRelease
Get:12 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]  
Hit:3 https://apt.llvm.org/focal llvm-toolchain-focal-12 InRelease   
Hit:8 https://apt.llvm.org/focal llvm-toolchain-focal-14 InRelease
Get:14 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [40.7 kB]
Get:15 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [66.7 kB]
Get:16 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [2,464 B]
Get:17 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [278 kB]
Get:18 http://us.archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [391 kB]
Get:19 http://us.archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [940 B]
Get:20 http://us.archive.ubuntu.com/ubuntu focal-backports/main amd64 DEP-11 Metadata [8,024 B]
Get:21 http://us.archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [30.5 kB]
Reading package lists... Done                                                
E: The repository 'file:/var/cuda-repo-ubuntu2004-11-7-local  Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

After consulting w1nter's answer I removed the sudo apt update errors with:

(torch) sharker@persephone:/var$ cd /etc/apt/sources.list.d
(torch) sharker@persephone:/etc/apt/sources.list.d$ ls
cuda-ubuntu2004-11-7-local.list   dropbox.list        google-chrome.list.save
cuda-ubuntu2004-x86_64.list       dropbox.list.save
cuda-ubuntu2004-x86_64.list.save  google-chrome.list
(torch) sharker@persephone:/etc/apt/sources.list.d$ ls -la
total 36
drwxr-xr-x 2 root root 4096 May 24 13:39 .
drwxr-xr-x 7 root root 4096 May 15 20:27 ..
-rw-r--r-- 1 root root  108 May  4 12:10 cuda-ubuntu2004-11-7-local.list
-rw-r--r-- 1 root root  139 May 15 20:27 cuda-ubuntu2004-x86_64.list
-rw-r--r-- 1 root root  139 May 15 20:27 cuda-ubuntu2004-x86_64.list.save
-rw-r--r-- 1 root root   65 May 15 20:27 dropbox.list
-rw-r--r-- 1 root root   65 May 15 20:27 dropbox.list.save
-rw-r--r-- 1 root root  189 May 15 20:27 google-chrome.list
-rw-r--r-- 1 root root  189 May 15 20:27 google-chrome.list.save
(torch) sharker@persephone:/etc/apt/sources.list.d$ sudo rm cuda-ubuntu2004-11-7-local.list 
(torch) sharker@persephone:/etc/apt/sources.list.d$ sudo apt update
Hit:2 http://us.archive.ubuntu.com/ubuntu focal InRelease                                 
Ign:3 http://linux.dropbox.com/ubuntu disco InRelease                                     
Hit:4 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease                         
Hit:5 http://dl.google.com/linux/chrome/deb stable InRelease                              
Hit:7 http://linux.dropbox.com/ubuntu disco Release                                       
Hit:8 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease                       
Hit:9 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  InRelease
Hit:10 http://security.ubuntu.com/ubuntu focal-security InRelease                         
Hit:1 https://apt.llvm.org/focal llvm-toolchain-focal-12 InRelease   
Hit:6 https://apt.llvm.org/focal llvm-toolchain-focal-14 InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
19 packages can be upgraded. Run 'apt list --upgradable' to see them.
(torch) sharker@persephone:/etc/apt/sources.list.d$ sudo apt upgrade